KEYFBUFF.ASM (88672B)
1 ; 2 ; Copyright 2020 Electronic Arts Inc. 3 ; 4 ; TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 ; software: you can redistribute it and/or modify it under the terms of 6 ; the GNU General Public License as published by the Free Software Foundation, 7 ; either version 3 of the License, or (at your option) any later version. 8 9 ; TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 ; in the hope that it will be useful, but with permitted additional restrictions 11 ; under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 ; distributed with this program. You should have received a copy of the 13 ; GNU General Public License along with permitted additional restrictions 14 ; with this program. If not, see [https://github.com/electronicarts/CnC_Remastered_Collection]>. 15 16 ;*************************************************************************** 17 ;** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S ** 18 ;*************************************************************************** 19 ;* * 20 ;* Project Name : Command & Conquer * 21 ;* * 22 ;* File Name : KEYFBUFF.ASM * 23 ;* * 24 ;* Programmer : David R. Dettmer * 25 ;* * 26 ;* Start Date : March 3, 1995 * 27 ;* * 28 ;* Last Update : * 29 ;* * 30 ;*-------------------------------------------------------------------------* 31 ;* Functions: * 32 ;* Buffer_Frame_To_Page -- Copies a linear buffer to a virtual viewport * 33 ;* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * 34 35 ;********************** Model & Processor Directives *********************** 36 ;IDEAL 37 ;P386 38 ;MODEL USE32 FLAT 39 ;jumps 40 41 .MODEL FLAT 42 ;.386 43 44 ;******************************** Includes ********************************* 45 ;INCLUDE "gbuffer.inc" 46 ;include "profile.inc" 47 48 OPTIMAL_BYTE_COPY equ 14 49 50 GraphicViewPort STRUCT 51 GVPOffset DD ? ; offset to virtual viewport 52 GVPWidth DD ? ; width of virtual viewport 53 GVPHeight DD ? ; height of virtual viewport 54 GVPXAdd DD ? ; x mod to get to next line 55 GVPXPos DD ? ; x pos relative to Graphic Buff 56 GVPYPos DD ? ; y pos relative to Graphic Buff 57 GVPPitch dd ? ; modulo of graphic view port 58 GVPBuffPtr DD ? ; ptr to associated Graphic Buff 59 GraphicViewPort ENDS 60 61 ;******************************** Equates ********************************** 62 63 TRUE equ 1 ; Boolean 'true' value 64 FALSE equ 0 ; Boolean 'false' value 65 66 ;*=========================================================================*/ 67 ;* The following are defines used to control what functions are linked * 68 ;* in for Buffer_Frame_To_Page. * 69 ;*=========================================================================*/ 70 ;USE_NORMAL EQU TRUE 71 ;USE_HORZ_REV EQU TRUE 72 ;USE_VERT_REV EQU TRUE 73 ;USE_SCALING EQU TRUE 74 75 76 FLAG_NORMAL EQU 0 77 FLAG_TRANS EQU 1 78 FLAG_GHOST EQU 2 79 FLAG_FADING EQU 4 80 FLAG_PREDATOR EQU 8 81 82 FLAG_MASK EQU 0Fh 83 84 85 SHAPE_NORMAL EQU 0000h ; Standard shape 86 ;SHAPE_HORZ_REV EQU 0001h ; Flipped horizontally 87 ;SHAPE_VERT_REV EQU 0002h ; Flipped vertically 88 ;SHAPE_SCALING EQU 0004h ; Scaled (WORD scale_x, WORD scale_y) 89 ;SHAPE_VIEWPORT_REL EQU 0010h ; Coords are window-relative 90 ;SHAPE_WIN_REL EQU 0010h ; Coordinates are window relative instead of absolute. 91 SHAPE_CENTER EQU 0020h ; Coords are based on shape's center pt 92 SHAPE_TRANS EQU 0040h ; has transparency 93 94 SHAPE_FADING EQU 0100h ; Fading effect (VOID * fading_table, 95 ; WORD fading_num) 96 SHAPE_PREDATOR EQU 0200h ; Transparent warping effect 97 ;SHAPE_COMPACT EQU 0400h ; Never use this bit 98 ;SHAPE_PRIORITY EQU 0800h ; Use priority system when drawing 99 SHAPE_GHOST EQU 1000h ; Shape is drawn ghosted 100 ;SHAPE_SHADOW EQU 2000h 101 SHAPE_PARTIAL EQU 4000h 102 ;SHAPE_COLOR EQU 8000h ; Remap the shape's colors 103 ; (VOID * color_table) 104 105 106 ; 107 ;.......................... Shadow Effect .................................. 108 ; 109 SHADOW_COL EQU 00FFh ; magic number for shadows 110 111 ;......................... Priority System ................................. 112 ; 113 CLEAR_UNUSED_BITS EQU 0007h ; and with 0000-0111 to clear 114 ; non-walkable high bit and 115 ; scaling id bits 116 NON_WALKABLE_BIT EQU 0080h ; and with 1000-0000 to clear all 117 ; but non-walkable bit 118 ; 119 ;......................... Predator Effect ................................. 120 ; 121 ;PRED_MASK EQU 0007h ; mask used for predator pixel puts 122 PRED_MASK EQU 000Eh ; mask used for predator pixel puts 123 124 125 ;--------------------------------------------------------------------------- 126 ; 127 ; Use a macro to make code a little cleaner. 128 ; The parameter varname is optional. 129 ; Syntax to use macro is : 130 ; WANT equ expression 131 ; USE func [,varname] 132 ; If the 'varname' is defined, a table declaration is created like: 133 ; GLOBAL TableName:DWORD 134 ; Then, the table entry is created: 135 ; If WANT is true, the table entry is created for the given function: 136 ; varname DD func 137 ; If WANT is not TRUE, a Not_Supported entry is put in the table: 138 ; varname DD Not_Supported 139 ; The resulting tables look like: 140 ; 141 ; GLOBAL ExampTable:DWORD 142 ; ExampTable DD routine1 143 ; DD routine2 144 ; DD routine3 145 ; ... 146 ; Thus, each table is an array of function pointers. 147 ; 148 ;--------------------------------------------------------------------------- 149 USE MACRO func, varname 150 IF WANT 151 varname DD func 152 ELSE 153 varname DD Not_Supported 154 ENDIF 155 ENDM 156 157 prologue macro 158 endm 159 160 161 162 epilogue macro 163 endm 164 165 166 ; IFNB <varname> 167 ; GLOBAL varname:DWORD 168 ; ENDIF 169 170 ;--------------------------------------------------------------------------- 171 172 173 .DATA 174 175 ;--------------------------------------------------------------------------- 176 ; Predator effect variables 177 ;--------------------------------------------------------------------------- 178 ; make table for negative offset and use the used space for other variables 179 180 BFPredNegTable DW -1, -3, -2, -5, -2, -4, -3, -1 181 ; 8 words below calculated 182 DW 0, 0, 0, 0, 0, 0, 0, 0 ; index ffffff00 183 DD 0, 0, 0, 0 ; index ffffff10 184 BFPredOffset DD 0, 0, 0, 0 ; index ffffff20 185 DD 0, 0, 0, 0 ; index ffffff30 186 ; partially faded predator effect value 187 BFPartialPred DD 0, 0, 0, 0 ; index ffffff40 188 BFPartialCount DD 0, 0, 0, 0 ; index ffffff50 189 DD 0, 0, 0, 0 ; index ffffff60 190 DD 0, 0, 0, 0 ; index ffffff70 191 DD 0, 0, 0, 0 ; index ffffff80 192 DD 0, 0, 0, 0 ; index ffffff90 193 DD 0, 0, 0, 0 ; index ffffffa0 194 DD 0, 0, 0, 0 ; index ffffffb0 195 DD 0, 0, 0, 0 ; index ffffffc0 196 DD 0, 0, 0, 0 ; index ffffffd0 197 DD 0, 0, 0, 0 ; index ffffffe0 198 DD 0, 0, 0, 0 ; index fffffff0 199 BFPredTable DW 1, 3, 2, 5, 2, 3, 4, 1 200 ;BFPredTable DB 1, 3, 2, 5, 4, 3, 2, 1 201 202 203 204 205 206 207 extern C BigShapeBufferStart:dword 208 extern C UseBigShapeBuffer:dword 209 extern C TheaterShapeBufferStart:dword 210 extern C IsTheaterShape:dword 211 ;extern C Single_Line_Trans_Entry:near 212 ;extern C Next_Line:near 213 extern C MMX_Done:near 214 extern C MMXAvailable:dword 215 ;extern C EndNewShapeJumpTable:byte 216 ;extern C NewShapeJumpTable:dword 217 218 219 ;********************************************************************************** 220 ; 221 ; Jump tables for new line header system 222 ; 223 ; Each line of shape data now has a header byte which describes the data on the line. 224 ; 225 226 ; 227 ; Header byte control bits 228 ; 229 BLIT_TRANSPARENT =1 230 BLIT_GHOST =2 231 BLIT_FADING =4 232 BLIT_PREDATOR =8 233 BLIT_SKIP =16 234 BLIT_ALL =BLIT_TRANSPARENT or BLIT_GHOST or BLIT_FADING or BLIT_PREDATOR or BLIT_SKIP 235 236 237 ShapeHeaderType STRUCT 238 239 draw_flags dd ? 240 shape_data dd ? 241 shape_buffer dd ? 242 243 ShapeHeaderType ENDS 244 245 246 247 ; 248 ; Global definitions for routines that draw a single line of a shape 249 ; 250 ;extern Short_Single_Line_Copy:near 251 ;extern Single_Line_Trans:near 252 ;extern Single_Line_Ghost:near 253 ;extern Single_Line_Ghost_Trans:near 254 ;extern Single_Line_Fading:near 255 ;extern Single_Line_Fading_Trans:near 256 ;extern Single_Line_Ghost_Fading:near 257 ;extern Single_Line_Ghost_Fading_Trans:near 258 ;extern Single_Line_Predator:near 259 ;extern Single_Line_Predator_Trans:near 260 ;extern Single_Line_Predator_Ghost:near 261 ;extern Single_Line_Predator_Ghost_Trans:near 262 ;extern Single_Line_Predator_Fading:near 263 ;extern Single_Line_Predator_Fading_Trans:near 264 ;extern Single_Line_Predator_Ghost_Fading:near 265 ;extern Single_Line_Predator_Ghost_Fading_Trans:near 266 ;extern Single_Line_Skip:near 267 268 ;extern Single_Line_Single_Fade:near 269 ;extern Single_Line_Single_Fade_Trans:near 270 271 ;externdef AllFlagsJumpTable:dword 272 ; 273 externdef NewShapeJumpTable:dword 274 externdef EndNewShapeJumpTable:byte 275 externdef CriticalFadeRedirections:dword 276 ;externdef BufferFrameTable:dword 277 278 ;externdef CriticalFadeRedirections:dword 279 ;externdef CriticalFadeRedirections:dword 280 ;externdef CriticalFadeRedirections:dword 281 ;externdef BF_Copy:far ptr 282 ;externdef BF_Trans:dword 283 ;externdef BF_Ghost:dword 284 ;externdef BF_Ghost_Trans:dword 285 ;externdef BF_Fading:dword 286 ;externdef BF_Fading_Trans:dword 287 ;externdef BF_Ghost_Fading:dword 288 ;externdef BF_Ghost_Fading_Trans:dword 289 ;externdef BF_Predator:dword 290 ;externdef BF_Predator_Trans:dword 291 ;externdef BF_Predator_Ghost:dword 292 ;externdef BF_Predator_Ghost_Trans:dword 293 ;externdef BF_Predator_Fading:dword 294 ;externdef BF_Predator_Fading_Trans:dword 295 ;externdef BF_Predator_Ghost_Fading:dword 296 ;externdef BF_Predator_Ghost_Fading_Trans:dword 297 298 externdef C Single_Line_Trans:near 299 externdef C Single_Line_Trans_Entry:near 300 externdef C Next_Line:near 301 302 303 .CODE 304 305 306 ;--------------------------------------------------------------------------- 307 ; Code Segment Tables: 308 ; This code uses the USE macro to set up tables of function addresses. 309 ; The tables have the following format: 310 ; Tables defined are: 311 ; BufferFrameTable 312 ;--------------------------------------------------------------------------- 313 314 WANT equ <TRUE> 315 USE BF_Copy, BufferFrameTable 316 317 WANT equ <TRUE> 318 USE BF_Trans 319 320 WANT equ <TRUE> 321 USE BF_Ghost 322 323 WANT equ <TRUE> 324 USE BF_Ghost_Trans 325 326 WANT equ <TRUE> 327 USE BF_Fading 328 329 WANT equ <TRUE> 330 USE BF_Fading_Trans 331 332 WANT equ <TRUE> 333 USE BF_Ghost_Fading 334 335 WANT equ <TRUE> 336 USE BF_Ghost_Fading_Trans 337 338 WANT equ <TRUE> 339 USE BF_Predator 340 341 WANT equ <TRUE> 342 USE BF_Predator_Trans 343 344 WANT equ <TRUE> 345 USE BF_Predator_Ghost 346 347 WANT equ <TRUE> 348 USE BF_Predator_Ghost_Trans 349 350 WANT equ <TRUE> 351 USE BF_Predator_Fading 352 353 WANT equ <TRUE> 354 USE BF_Predator_Fading_Trans 355 356 WANT equ <TRUE> 357 USE BF_Predator_Ghost_Fading 358 359 WANT equ <TRUE> 360 USE BF_Predator_Ghost_Fading_Trans 361 362 363 364 .DATA 365 366 ;NewShapeJumpTable label near ptr dword 367 368 ; 369 ; Jumptable for shape line drawing with no flags set 370 ; 371 372 NewShapeJumpTable dd Short_Single_Line_Copy 373 dd Short_Single_Line_Copy 374 dd Short_Single_Line_Copy 375 dd Short_Single_Line_Copy 376 ;CriticalFadeRedirections label dword 377 CriticalFadeRedirections dd Short_Single_Line_Copy 378 dd Short_Single_Line_Copy 379 dd Short_Single_Line_Copy 380 dd Short_Single_Line_Copy 381 dd Short_Single_Line_Copy 382 dd Short_Single_Line_Copy 383 dd Short_Single_Line_Copy 384 dd Short_Single_Line_Copy 385 dd Short_Single_Line_Copy 386 dd Short_Single_Line_Copy 387 dd Short_Single_Line_Copy 388 dd Short_Single_Line_Copy 389 dd Single_Line_Skip 390 dd Single_Line_Skip 391 dd Single_Line_Skip 392 dd Single_Line_Skip 393 dd Single_Line_Skip 394 dd Single_Line_Skip 395 dd Single_Line_Skip 396 dd Single_Line_Skip 397 dd Single_Line_Skip 398 dd Single_Line_Skip 399 dd Single_Line_Skip 400 dd Single_Line_Skip 401 dd Single_Line_Skip 402 dd Single_Line_Skip 403 dd Single_Line_Skip 404 dd Single_Line_Skip 405 406 407 ; 408 ; Jumptable for shape line drawing routines with transparent flags set 409 ; 410 dd Short_Single_Line_Copy 411 dd Single_Line_Trans 412 dd Short_Single_Line_Copy 413 dd Single_Line_Trans 414 dd Short_Single_Line_Copy 415 dd Single_Line_Trans 416 dd Short_Single_Line_Copy 417 dd Single_Line_Trans 418 dd Short_Single_Line_Copy 419 dd Single_Line_Trans 420 dd Short_Single_Line_Copy 421 dd Single_Line_Trans 422 dd Short_Single_Line_Copy 423 dd Single_Line_Trans 424 dd Short_Single_Line_Copy 425 dd Single_Line_Trans 426 dd Single_Line_Skip 427 dd Single_Line_Skip 428 dd Single_Line_Skip 429 dd Single_Line_Skip 430 dd Single_Line_Skip 431 dd Single_Line_Skip 432 dd Single_Line_Skip 433 dd Single_Line_Skip 434 dd Single_Line_Skip 435 dd Single_Line_Skip 436 dd Single_Line_Skip 437 dd Single_Line_Skip 438 dd Single_Line_Skip 439 dd Single_Line_Skip 440 dd Single_Line_Skip 441 dd Single_Line_Skip 442 443 444 ; 445 ; Jumptable for shape line drawing routines with ghost flags set 446 ; 447 448 dd Short_Single_Line_Copy 449 dd Short_Single_Line_Copy 450 dd Single_Line_Ghost 451 dd Single_Line_Ghost 452 dd Short_Single_Line_Copy 453 dd Short_Single_Line_Copy 454 dd Single_Line_Ghost 455 dd Single_Line_Ghost 456 dd Short_Single_Line_Copy 457 dd Short_Single_Line_Copy 458 dd Single_Line_Ghost 459 dd Single_Line_Ghost 460 dd Short_Single_Line_Copy 461 dd Short_Single_Line_Copy 462 dd Single_Line_Ghost 463 dd Single_Line_Ghost 464 dd Single_Line_Skip 465 dd Single_Line_Skip 466 dd Single_Line_Skip 467 dd Single_Line_Skip 468 dd Single_Line_Skip 469 dd Single_Line_Skip 470 dd Single_Line_Skip 471 dd Single_Line_Skip 472 dd Single_Line_Skip 473 dd Single_Line_Skip 474 dd Single_Line_Skip 475 dd Single_Line_Skip 476 dd Single_Line_Skip 477 dd Single_Line_Skip 478 dd Single_Line_Skip 479 dd Single_Line_Skip 480 481 482 ; 483 ; Jumptable for shape line drawing routines with ghost and transparent flags set 484 ; 485 486 dd Short_Single_Line_Copy 487 dd Single_Line_Trans 488 dd Single_Line_Ghost 489 dd Single_Line_Ghost_Trans 490 dd Short_Single_Line_Copy 491 dd Single_Line_Trans 492 dd Single_Line_Ghost 493 dd Single_Line_Ghost_Trans 494 dd Short_Single_Line_Copy 495 dd Single_Line_Trans 496 dd Single_Line_Ghost 497 dd Single_Line_Ghost_Trans 498 dd Short_Single_Line_Copy 499 dd Single_Line_Trans 500 dd Single_Line_Ghost 501 dd Single_Line_Ghost_Trans 502 dd Single_Line_Skip 503 dd Single_Line_Skip 504 dd Single_Line_Skip 505 dd Single_Line_Skip 506 dd Single_Line_Skip 507 dd Single_Line_Skip 508 dd Single_Line_Skip 509 dd Single_Line_Skip 510 dd Single_Line_Skip 511 dd Single_Line_Skip 512 dd Single_Line_Skip 513 dd Single_Line_Skip 514 dd Single_Line_Skip 515 dd Single_Line_Skip 516 dd Single_Line_Skip 517 dd Single_Line_Skip 518 519 520 521 522 523 ; 524 ; Jumptable for shape line drawing routines with fading flag set 525 ; 526 527 dd Short_Single_Line_Copy 528 dd Short_Single_Line_Copy 529 dd Short_Single_Line_Copy 530 dd Short_Single_Line_Copy 531 dd Single_Line_Single_Fade 532 dd Single_Line_Single_Fade 533 dd Single_Line_Fading 534 dd Single_Line_Fading 535 dd Short_Single_Line_Copy 536 dd Short_Single_Line_Copy 537 dd Short_Single_Line_Copy 538 dd Short_Single_Line_Copy 539 dd Single_Line_Fading 540 dd Single_Line_Fading 541 dd Single_Line_Fading 542 dd Single_Line_Fading 543 dd Single_Line_Skip 544 dd Single_Line_Skip 545 dd Single_Line_Skip 546 dd Single_Line_Skip 547 dd Single_Line_Skip 548 dd Single_Line_Skip 549 dd Single_Line_Skip 550 dd Single_Line_Skip 551 dd Single_Line_Skip 552 dd Single_Line_Skip 553 dd Single_Line_Skip 554 dd Single_Line_Skip 555 dd Single_Line_Skip 556 dd Single_Line_Skip 557 dd Single_Line_Skip 558 dd Single_Line_Skip 559 560 561 ; 562 ; Jumptable for shape line drawing routines with fading and transparent flags set 563 ; 564 565 dd Short_Single_Line_Copy 566 dd Single_Line_Trans 567 dd Short_Single_Line_Copy 568 dd Single_Line_Trans 569 dd Single_Line_Single_Fade 570 dd Single_Line_Single_Fade_Trans 571 dd Single_Line_Fading 572 dd Single_Line_Fading_Trans 573 dd Short_Single_Line_Copy 574 dd Single_Line_Trans 575 dd Short_Single_Line_Copy 576 dd Single_Line_Trans 577 dd Single_Line_Fading 578 dd Single_Line_Fading_Trans 579 dd Single_Line_Fading 580 dd Single_Line_Fading_Trans 581 dd Single_Line_Skip 582 dd Single_Line_Skip 583 dd Single_Line_Skip 584 dd Single_Line_Skip 585 dd Single_Line_Skip 586 dd Single_Line_Skip 587 dd Single_Line_Skip 588 dd Single_Line_Skip 589 dd Single_Line_Skip 590 dd Single_Line_Skip 591 dd Single_Line_Skip 592 dd Single_Line_Skip 593 dd Single_Line_Skip 594 dd Single_Line_Skip 595 dd Single_Line_Skip 596 dd Single_Line_Skip 597 598 599 ; 600 ; Jumptable for shape line drawing routines with fading and ghost flags set 601 ; 602 603 dd Short_Single_Line_Copy 604 dd Short_Single_Line_Copy 605 dd Single_Line_Ghost 606 dd Single_Line_Ghost 607 dd Single_Line_Single_Fade 608 dd Single_Line_Single_Fade 609 dd Single_Line_Ghost_Fading 610 dd Single_Line_Ghost_Fading 611 dd Short_Single_Line_Copy 612 dd Short_Single_Line_Copy 613 dd Single_Line_Ghost 614 dd Single_Line_Ghost 615 dd Single_Line_Fading 616 dd Single_Line_Fading 617 dd Single_Line_Ghost_Fading 618 dd Single_Line_Ghost_Fading 619 dd Single_Line_Skip 620 dd Single_Line_Skip 621 dd Single_Line_Skip 622 dd Single_Line_Skip 623 dd Single_Line_Skip 624 dd Single_Line_Skip 625 dd Single_Line_Skip 626 dd Single_Line_Skip 627 dd Single_Line_Skip 628 dd Single_Line_Skip 629 dd Single_Line_Skip 630 dd Single_Line_Skip 631 dd Single_Line_Skip 632 dd Single_Line_Skip 633 dd Single_Line_Skip 634 dd Single_Line_Skip 635 636 637 638 ; 639 ; Jumptable for shape line drawing routines with fading, transparent and ghost flags set 640 ; 641 642 dd Short_Single_Line_Copy 643 dd Single_Line_Trans 644 dd Single_Line_Ghost 645 dd Single_Line_Ghost_Trans 646 dd Single_Line_Single_Fade 647 dd Single_Line_Single_Fade_Trans 648 dd Single_Line_Ghost_Fading 649 dd Single_Line_Ghost_Fading_Trans 650 dd Short_Single_Line_Copy 651 dd Single_Line_Trans 652 dd Single_Line_Ghost 653 dd Single_Line_Ghost_Trans 654 dd Single_Line_Fading 655 dd Single_Line_Fading_Trans 656 dd Single_Line_Ghost_Fading 657 dd Single_Line_Ghost_Fading_Trans 658 dd Single_Line_Skip 659 dd Single_Line_Skip 660 dd Single_Line_Skip 661 dd Single_Line_Skip 662 dd Single_Line_Skip 663 dd Single_Line_Skip 664 dd Single_Line_Skip 665 dd Single_Line_Skip 666 dd Single_Line_Skip 667 dd Single_Line_Skip 668 dd Single_Line_Skip 669 dd Single_Line_Skip 670 dd Single_Line_Skip 671 dd Single_Line_Skip 672 dd Single_Line_Skip 673 dd Single_Line_Skip 674 675 676 677 678 679 680 ; 681 ; Jumptable for shape line drawing with predator flag set 682 ; 683 684 dd Short_Single_Line_Copy 685 dd Short_Single_Line_Copy 686 dd Short_Single_Line_Copy 687 dd Short_Single_Line_Copy 688 dd Short_Single_Line_Copy 689 dd Short_Single_Line_Copy 690 dd Short_Single_Line_Copy 691 dd Short_Single_Line_Copy 692 dd Single_Line_Predator 693 dd Single_Line_Predator 694 dd Single_Line_Predator 695 dd Single_Line_Predator 696 dd Single_Line_Predator 697 dd Single_Line_Predator 698 dd Single_Line_Predator 699 dd Single_Line_Predator 700 dd Single_Line_Skip 701 dd Single_Line_Skip 702 dd Single_Line_Skip 703 dd Single_Line_Skip 704 dd Single_Line_Skip 705 dd Single_Line_Skip 706 dd Single_Line_Skip 707 dd Single_Line_Skip 708 dd Single_Line_Skip 709 dd Single_Line_Skip 710 dd Single_Line_Skip 711 dd Single_Line_Skip 712 dd Single_Line_Skip 713 dd Single_Line_Skip 714 dd Single_Line_Skip 715 dd Single_Line_Skip 716 717 718 ; 719 ; Jumptable for shape line drawing routines with transparent and predator flags set 720 ; 721 dd Short_Single_Line_Copy 722 dd Single_Line_Trans 723 dd Short_Single_Line_Copy 724 dd Single_Line_Trans 725 dd Short_Single_Line_Copy 726 dd Single_Line_Trans 727 dd Short_Single_Line_Copy 728 dd Single_Line_Trans 729 dd Single_Line_Predator 730 dd Single_Line_Predator_Trans 731 dd Single_Line_Predator 732 dd Single_Line_Predator_Trans 733 dd Single_Line_Predator 734 dd Single_Line_Predator_Trans 735 dd Single_Line_Predator 736 dd Single_Line_Predator_Trans 737 dd Single_Line_Skip 738 dd Single_Line_Skip 739 dd Single_Line_Skip 740 dd Single_Line_Skip 741 dd Single_Line_Skip 742 dd Single_Line_Skip 743 dd Single_Line_Skip 744 dd Single_Line_Skip 745 dd Single_Line_Skip 746 dd Single_Line_Skip 747 dd Single_Line_Skip 748 dd Single_Line_Skip 749 dd Single_Line_Skip 750 dd Single_Line_Skip 751 dd Single_Line_Skip 752 dd Single_Line_Skip 753 754 755 ; 756 ; Jumptable for shape line drawing routines with ghost and predator flags set 757 ; 758 759 dd Short_Single_Line_Copy 760 dd Short_Single_Line_Copy 761 dd Single_Line_Ghost 762 dd Single_Line_Ghost 763 dd Short_Single_Line_Copy 764 dd Short_Single_Line_Copy 765 dd Single_Line_Ghost 766 dd Single_Line_Ghost 767 dd Single_Line_Predator 768 dd Single_Line_Predator 769 dd Single_Line_Predator_Ghost 770 dd Single_Line_Predator_Ghost 771 dd Single_Line_Predator 772 dd Single_Line_Predator 773 dd Single_Line_Predator_Ghost 774 dd Single_Line_Predator_Ghost 775 dd Single_Line_Skip 776 dd Single_Line_Skip 777 dd Single_Line_Skip 778 dd Single_Line_Skip 779 dd Single_Line_Skip 780 dd Single_Line_Skip 781 dd Single_Line_Skip 782 dd Single_Line_Skip 783 dd Single_Line_Skip 784 dd Single_Line_Skip 785 dd Single_Line_Skip 786 dd Single_Line_Skip 787 dd Single_Line_Skip 788 dd Single_Line_Skip 789 dd Single_Line_Skip 790 dd Single_Line_Skip 791 792 793 ; 794 ; Jumptable for shape line drawing routines with ghost and transparent and predator flags set 795 ; 796 797 dd Short_Single_Line_Copy 798 dd Single_Line_Trans 799 dd Single_Line_Ghost 800 dd Single_Line_Ghost_Trans 801 dd Short_Single_Line_Copy 802 dd Single_Line_Trans 803 dd Single_Line_Ghost 804 dd Single_Line_Ghost_Trans 805 dd Single_Line_Predator 806 dd Single_Line_Predator_Trans 807 dd Single_Line_Predator_Ghost 808 dd Single_Line_Predator_Ghost_Trans 809 dd Single_Line_Predator 810 dd Single_Line_Predator_Trans 811 dd Single_Line_Predator_Ghost 812 dd Single_Line_Predator_Ghost_Trans 813 dd Single_Line_Skip 814 dd Single_Line_Skip 815 dd Single_Line_Skip 816 dd Single_Line_Skip 817 dd Single_Line_Skip 818 dd Single_Line_Skip 819 dd Single_Line_Skip 820 dd Single_Line_Skip 821 dd Single_Line_Skip 822 dd Single_Line_Skip 823 dd Single_Line_Skip 824 dd Single_Line_Skip 825 dd Single_Line_Skip 826 dd Single_Line_Skip 827 dd Single_Line_Skip 828 dd Single_Line_Skip 829 830 831 832 833 834 ; 835 ; Jumptable for shape line drawing routines with fading and predator flags set 836 ; 837 838 dd Short_Single_Line_Copy 839 dd Short_Single_Line_Copy 840 dd Short_Single_Line_Copy 841 dd Short_Single_Line_Copy 842 dd Single_Line_Single_Fade 843 dd Single_Line_Single_Fade 844 dd Single_Line_Fading 845 dd Single_Line_Fading 846 dd Single_Line_Predator 847 dd Single_Line_Predator 848 dd Single_Line_Predator 849 dd Single_Line_Predator 850 dd Single_Line_Predator_Fading 851 dd Single_Line_Predator_Fading 852 dd Single_Line_Predator_Fading 853 dd Single_Line_Predator_Fading 854 dd Single_Line_Skip 855 dd Single_Line_Skip 856 dd Single_Line_Skip 857 dd Single_Line_Skip 858 dd Single_Line_Skip 859 dd Single_Line_Skip 860 dd Single_Line_Skip 861 dd Single_Line_Skip 862 dd Single_Line_Skip 863 dd Single_Line_Skip 864 dd Single_Line_Skip 865 dd Single_Line_Skip 866 dd Single_Line_Skip 867 dd Single_Line_Skip 868 dd Single_Line_Skip 869 dd Single_Line_Skip 870 871 872 ; 873 ; Jumptable for shape line drawing routines with fading and transparent and predator flags set 874 ; 875 876 dd Short_Single_Line_Copy 877 dd Single_Line_Trans 878 dd Short_Single_Line_Copy 879 dd Single_Line_Trans 880 dd Single_Line_Single_Fade 881 dd Single_Line_Single_Fade_Trans 882 dd Single_Line_Fading 883 dd Single_Line_Fading_Trans 884 dd Single_Line_Predator 885 dd Single_Line_Predator_Trans 886 dd Single_Line_Predator 887 dd Single_Line_Predator_Trans 888 dd Single_Line_Predator_Fading 889 dd Single_Line_Predator_Fading_Trans 890 dd Single_Line_Predator_Fading 891 dd Single_Line_Predator_Fading_Trans 892 dd Single_Line_Skip 893 dd Single_Line_Skip 894 dd Single_Line_Skip 895 dd Single_Line_Skip 896 dd Single_Line_Skip 897 dd Single_Line_Skip 898 dd Single_Line_Skip 899 dd Single_Line_Skip 900 dd Single_Line_Skip 901 dd Single_Line_Skip 902 dd Single_Line_Skip 903 dd Single_Line_Skip 904 dd Single_Line_Skip 905 dd Single_Line_Skip 906 dd Single_Line_Skip 907 dd Single_Line_Skip 908 909 910 ; 911 ; Jumptable for shape line drawing routines with fading and ghost and predator flags set 912 ; 913 914 dd Short_Single_Line_Copy 915 dd Short_Single_Line_Copy 916 dd Single_Line_Ghost 917 dd Single_Line_Ghost 918 dd Single_Line_Single_Fade 919 dd Single_Line_Single_Fade 920 dd Single_Line_Ghost_Fading 921 dd Single_Line_Ghost_Fading 922 dd Single_Line_Predator 923 dd Single_Line_Predator 924 dd Single_Line_Predator_Ghost 925 dd Single_Line_Predator_Ghost 926 dd Single_Line_Predator_Fading 927 dd Single_Line_Predator_Fading 928 dd Single_Line_Predator_Ghost_Fading 929 dd Single_Line_Predator_Ghost_Fading 930 dd Single_Line_Skip 931 dd Single_Line_Skip 932 dd Single_Line_Skip 933 dd Single_Line_Skip 934 dd Single_Line_Skip 935 dd Single_Line_Skip 936 dd Single_Line_Skip 937 dd Single_Line_Skip 938 dd Single_Line_Skip 939 dd Single_Line_Skip 940 dd Single_Line_Skip 941 dd Single_Line_Skip 942 dd Single_Line_Skip 943 dd Single_Line_Skip 944 dd Single_Line_Skip 945 dd Single_Line_Skip 946 947 948 949 950 951 952 953 ; 954 ; Jumptable for shape line drawing routines with all flags set 955 ; 956 957 AllFlagsJumpTable label dword 958 dd Short_Single_Line_Copy 959 dd Single_Line_Trans 960 dd Single_Line_Ghost 961 dd Single_Line_Ghost_Trans 962 dd Single_Line_Single_Fade 963 dd Single_Line_Single_Fade_Trans 964 dd Single_Line_Ghost_Fading 965 dd Single_Line_Ghost_Fading_Trans 966 dd Single_Line_Predator 967 dd Single_Line_Predator_Trans 968 dd Single_Line_Predator_Ghost 969 dd Single_Line_Predator_Ghost_Trans 970 dd Single_Line_Predator_Fading 971 dd Single_Line_Predator_Fading_Trans 972 dd Single_Line_Predator_Ghost_Fading 973 dd Single_Line_Predator_Ghost_Fading_Trans 974 dd Single_Line_Skip 975 dd Single_Line_Skip 976 dd Single_Line_Skip 977 dd Single_Line_Skip 978 dd Single_Line_Skip 979 dd Single_Line_Skip 980 dd Single_Line_Skip 981 dd Single_Line_Skip 982 dd Single_Line_Skip 983 dd Single_Line_Skip 984 dd Single_Line_Skip 985 dd Single_Line_Skip 986 dd Single_Line_Skip 987 dd Single_Line_Skip 988 dd Single_Line_Skip 989 dd Single_Line_Skip 990 991 992 EndNewShapeJumpTable db 0 993 994 .CODE 995 996 997 998 ;--------------------------------------------------------------------------- 999 1000 1001 1002 1003 ;********************************************************************************************* 1004 ;* Set_Shape_Header -- create the line header bytes for a shape * 1005 ;* * 1006 ;* INPUT: Shape width * 1007 ;* Shape height * 1008 ;* ptr to raw shape data * 1009 ;* ptr to shape headers * 1010 ;* shape flags * 1011 ;* ptr to translucency table * 1012 ;* IsTranslucent * 1013 ;* * 1014 ;* OUTPUT: none * 1015 ;* * 1016 ;* Warnings: * 1017 ;* * 1018 ;* HISTORY: * 1019 ;* 11/29/95 10:09AM ST : Created. * 1020 ;*===========================================================================================* 1021 1022 Setup_Shape_Header proc C pixel_width:DWORD, pixel_height:DWORD, src:DWORD, headers:DWORD, flags:DWORD, Translucent:DWORD, IsTranslucent:DWORD 1023 1024 ;ARG pixel_width :DWORD ; width of rectangle to blit 1025 ;ARG pixel_height :DWORD ; height of rectangle to blit 1026 ;ARG src :DWORD ; this is a member function 1027 ;ARG headers :DWORD 1028 ;ARG flags :DWORD 1029 ;ARG Translucent :DWORD 1030 ;ARG IsTranslucent :DWORD 1031 LOCAL trans_count :DWORD 1032 1033 pushad 1034 1035 1036 mov esi,[src] ;ptr to raw shape data 1037 mov edi,[headers] ;ptr to headers we are going to set up 1038 mov eax,[flags] 1039 and eax,SHAPE_TRANS or SHAPE_FADING or SHAPE_PREDATOR or SHAPE_GHOST 1040 mov [edi].ShapeHeaderType.draw_flags,eax ;save old flags in header 1041 add edi,size ShapeHeaderType 1042 mov edx,[pixel_height] ;number of shape lines to scan 1043 1044 outer_loop: mov ecx,[pixel_width] ;number of pixels in shape line 1045 xor bl,bl ;flag the we dont know anything about this line yet 1046 mov [trans_count],0 ;we havnt scanned any transparent pixels yet 1047 1048 ; 1049 ; Scan one shape line to see what kind of data it contains 1050 ; 1051 inner_loop: xor eax,eax 1052 mov al,[esi] 1053 inc esi 1054 1055 ; 1056 ; Check for transparent pixel 1057 ; 1058 test al,al 1059 jnz not_transp 1060 test [flags],SHAPE_TRANS 1061 jz not_transp 1062 or bl,BLIT_TRANSPARENT ;flag that pixel is transparent 1063 inc [trans_count] ;keep count of the number of transparent pixels on the line 1064 jmp end_lp 1065 1066 ; 1067 ; Check for predator effect on this line 1068 ; 1069 not_transp: test [flags],SHAPE_PREDATOR 1070 jz not_pred 1071 or bl,BLIT_PREDATOR 1072 1073 ; 1074 ; Check for ghost effects 1075 ; 1076 not_pred: test [flags],SHAPE_GHOST 1077 jz not_ghost 1078 push edi 1079 mov edi,[IsTranslucent] 1080 cmp byte ptr [edi+eax],-1 1081 pop edi 1082 jz not_ghost 1083 or bl,BLIT_GHOST 1084 1085 ; 1086 ; Check if fading is required 1087 ; 1088 not_ghost: test [flags],SHAPE_FADING 1089 jz end_lp 1090 or bl,BLIT_FADING 1091 1092 end_lp: dec ecx 1093 jnz inner_loop 1094 1095 1096 ; 1097 ; Interpret the info we have collected and decide which routine will be 1098 ; used to draw this line 1099 ; 1100 xor bh,bh 1101 1102 test bl,BLIT_TRANSPARENT 1103 jz no_transparencies 1104 or bh,BLIT_TRANSPARENT 1105 mov ecx,[pixel_width] 1106 cmp ecx,[trans_count] 1107 jnz not_all_trans 1108 1109 ; all pixels in the line were transparent so we dont need to draw it at all 1110 mov bh,BLIT_SKIP 1111 jmp got_line_type 1112 1113 not_all_trans: 1114 no_transparencies: 1115 mov al,bl 1116 and al,BLIT_PREDATOR 1117 or bh,al 1118 mov al,bl 1119 and al,BLIT_GHOST 1120 or bh,al 1121 mov al,bl 1122 and al,BLIT_FADING 1123 or bh,al 1124 1125 ; 1126 ; Save the line header and do the next line 1127 ; 1128 got_line_type:mov [edi],bh 1129 inc edi 1130 1131 dec edx 1132 jnz outer_loop 1133 1134 1135 popad 1136 ret 1137 1138 Setup_Shape_Header endp 1139 1140 1141 1142 1143 ;************************************************************** 1144 ; 1145 ; Macro to fetch the header of the next line and jump to the appropriate routine 1146 ; 1147 next_line macro 1148 1149 add edi , [ dest_adjust_width ] ;add in dest modulo 1150 dec edx ;line counter 1151 jz real_out ;return 1152 mov ecx,[save_ecx] ;ecx is pixel count 1153 mov eax,[header_pointer] ;ptr to next header byte 1154 mov al,[eax] 1155 inc [header_pointer] 1156 and eax,BLIT_ALL ;Make sure we dont jump to some spurious address 1157 ; if the header is wrong then its better to draw with the wrong 1158 ; shape routine than to die 1159 shl eax,2 1160 add eax,[ShapeJumpTableAddress] ;get the address to jump to 1161 jmp dword ptr [eax] ;do the jump 1162 1163 endm 1164 1165 1166 1167 1168 1169 1170 ;*************************************************************************** 1171 ;* VVC::TOPAGE -- Copies a linear buffer to a virtual viewport * 1172 ;* * 1173 ;* INPUT: WORD x_pixel - x pixel on viewport to copy from * 1174 ;* WORD y_pixel - y pixel on viewport to copy from * 1175 ;* WORD pixel_width - the width of copy region * 1176 ;* WORD pixel_height - the height of copy region * 1177 ;* BYTE * src - buffer to copy from * 1178 ;* VVPC * dest - virtual viewport to copy to * 1179 ;* * 1180 ;* OUTPUT: none * 1181 ;* * 1182 ;* WARNINGS: Coordinates and dimensions will be adjusted if they exceed * 1183 ;* the boundaries. In the event that no adjustment is * 1184 ;* possible this routine will abort. If the size of the * 1185 ;* region to copy exceeds the size passed in for the buffer * 1186 ;* the routine will automatically abort. * 1187 ;* * 1188 ;* HISTORY: * 1189 ;* 06/15/1994 PWG : Created. * 1190 ;*=========================================================================* 1191 Buffer_Frame_To_Page proc C public USES eax ebx ecx edx esi edi x_pixel:DWORD, y_pixel:DWORD, pixel_width:DWORD, pixel_height:DWORD, src:DWORD, dest:DWORD, flags:DWORD 1192 1193 ;USES eax,ebx,ecx,edx,esi,edi 1194 1195 ;*=================================================================== 1196 ;* define the arguements that our function takes. 1197 ;*=================================================================== 1198 ;ARG x_pixel :DWORD ; x pixel position in source 1199 ;ARG y_pixel :DWORD ; y pixel position in source 1200 ;ARG pixel_width :DWORD ; width of rectangle to blit 1201 ;ARG pixel_height:DWORD ; height of rectangle to blit 1202 ;ARG src :DWORD ; this is a member function 1203 ;ARG dest :DWORD ; what are we blitting to 1204 1205 ;ARG flags :DWORD ; flags passed 1206 1207 ;*=================================================================== 1208 ; Define some locals so that we can handle things quickly 1209 ;*=================================================================== 1210 LOCAL IsTranslucent :DWORD ; ptr to the is_translucent table 1211 LOCAL Translucent :DWORD ; ptr to the actual translucent table 1212 LOCAL FadingTable :DWORD ; extracted fading table pointer 1213 LOCAL FadingNum :DWORD ; get the number of times to fade 1214 1215 LOCAL StashECX :DWORD ; temp variable for ECX register 1216 1217 LOCAL jflags :DWORD ; flags used to goto correct buff frame routine 1218 LOCAL BufferFrameRout :DWORD ; ptr to the buffer frame routine 1219 1220 LOCAL jmp_loc :DWORD ; calculated jump location 1221 LOCAL loop_cnt :DWORD 1222 1223 LOCAL x1_pixel :DWORD 1224 LOCAL y1_pixel :DWORD 1225 LOCAL scr_x :DWORD 1226 LOCAL scr_y :DWORD 1227 LOCAL dest_adjust_width :DWORD 1228 LOCAL scr_adjust_width :DWORD 1229 LOCAL header_pointer :DWORD 1230 LOCAL use_old_draw :DWORD 1231 LOCAL save_ecx :DWORD 1232 LOCAL ShapeJumpTableAddress :DWORD 1233 LOCAL shape_buffer_start :DWORD 1234 1235 prologue 1236 cmp [ src ] , 0 1237 jz real_out 1238 1239 ; 1240 ; Save the line attributes pointers and 1241 ; Modify the src pointer to point to the actual image 1242 ; 1243 cmp [UseBigShapeBuffer],0 1244 jz do_args ;just use the old shape drawing system 1245 1246 mov edi,[src] 1247 mov [header_pointer],edi 1248 1249 mov eax,[BigShapeBufferStart] 1250 cmp [edi].ShapeHeaderType.shape_buffer,0 1251 jz is_ordinary_shape 1252 mov eax,[TheaterShapeBufferStart] 1253 is_ordinary_shape: 1254 mov [shape_buffer_start],eax 1255 1256 mov edi,[edi].ShapeHeaderType.shape_data 1257 add edi,[shape_buffer_start] 1258 mov [src],edi 1259 mov [use_old_draw],0 1260 1261 1262 ;==================================================================== 1263 ; Pull off optional arguments: 1264 ; EDI is used as an offset from the 'flags' parameter, to point 1265 ; to the optional argument currently being processed. 1266 ;==================================================================== 1267 do_args: 1268 mov edi , 4 ; optional params start past flags 1269 mov [ jflags ] , 0 ; clear jump flags 1270 1271 check_centering: 1272 ;------------------------------------------------------------------- 1273 ; See if we need to center the frame 1274 ;------------------------------------------------------------------- 1275 test [ flags ] , SHAPE_CENTER ; does this need to be centered? 1276 je check_trans ; if not the skip over this stuff 1277 1278 mov eax , [ pixel_width ] 1279 mov ebx , [ pixel_height ] 1280 sar eax , 1 1281 sar ebx , 1 1282 sub [ x_pixel ] , eax 1283 sub [ y_pixel ] , ebx 1284 1285 check_trans: 1286 test [ flags ] , SHAPE_TRANS 1287 jz check_ghost 1288 1289 or [ jflags ] , FLAG_TRANS 1290 1291 ;-------------------------------------------------------------------- 1292 ; SHAPE_GHOST: DWORD is_translucent tbl 1293 ;-------------------------------------------------------------------- 1294 check_ghost: 1295 test [ flags ] , SHAPE_GHOST ; are we ghosting this shape 1296 jz check_fading 1297 1298 mov eax , [ flags + edi ] 1299 or [ jflags ] , FLAG_GHOST 1300 mov [ IsTranslucent ] , eax ; save ptr to is_trans. tbl 1301 add eax , 0100h ; add 256 for first table 1302 add edi , 4 ; next argument 1303 mov [ Translucent ] , eax ; save ptr to translucent tbl 1304 1305 1306 1307 check_fading: 1308 ;______________________________________________________________________ 1309 ; If this is the first time through for this shape then 1310 ; set up the shape header 1311 ;______________________________________________________________________ 1312 pushad 1313 1314 cmp [UseBigShapeBuffer],0 1315 jz new_shape 1316 1317 mov edi,[header_pointer] 1318 cmp [edi].ShapeHeaderType.draw_flags,-1 1319 jz setup_headers 1320 mov eax,[flags] ;Redo the shape headers if this shape was 1321 and eax,SHAPE_TRANS or SHAPE_FADING or SHAPE_PREDATOR or SHAPE_GHOST ;initially set up with different flags 1322 cmp eax,[edi].ShapeHeaderType.draw_flags 1323 jz no_header_setup 1324 new_shape: 1325 mov [use_old_draw],1 1326 jmp no_header_setup 1327 1328 setup_headers: 1329 push [IsTranslucent] 1330 push [Translucent] 1331 push [flags] 1332 push [header_pointer] 1333 push [src] 1334 push [pixel_height] 1335 push [pixel_width] 1336 call Setup_Shape_Header 1337 add esp,7*4 1338 mov [ShapeJumpTableAddress], offset AllFlagsJumpTable 1339 jmp headers_set 1340 no_header_setup: 1341 1342 xor eax,eax 1343 test [flags],SHAPE_PREDATOR 1344 jz not_shape_predator 1345 or al,BLIT_PREDATOR 1346 1347 not_shape_predator: 1348 test [flags],SHAPE_FADING 1349 jz not_shape_fading 1350 or al,BLIT_FADING 1351 1352 not_shape_fading: 1353 1354 test [flags],SHAPE_TRANS 1355 jz not_shape_transparent 1356 or al,BLIT_TRANSPARENT 1357 1358 not_shape_transparent: 1359 1360 test [flags],SHAPE_GHOST 1361 jz not_shape_ghost 1362 or al,BLIT_GHOST 1363 1364 not_shape_ghost: 1365 1366 1367 shl eax,7 1368 add eax, offset NewShapeJumpTable 1369 mov [ShapeJumpTableAddress],eax 1370 ;call Init_New_Shape_Jump_Table_Address 1371 1372 1373 headers_set: 1374 popad 1375 1376 ;-------------------------------------------------------------------- 1377 ; SHAPE_FADING: DWORD fade_table[256], DWORD fade_count 1378 ;-------------------------------------------------------------------- 1379 test [ flags ] , SHAPE_FADING ; are we fading this shape 1380 jz check_predator 1381 1382 mov eax , [ flags + edi ] 1383 mov [ FadingTable ] , eax ; save address of fading tbl 1384 mov eax , [ flags + edi + 4 ] ; get fade num 1385 or [ jflags ] , FLAG_FADING 1386 and eax , 03fh ; no need for more than 63 1387 add edi , 8 ; next argument 1388 cmp eax , 0 ; check if it's 0 1389 jnz set_fading ; if not, store fade num 1390 1391 and [ flags ] , NOT SHAPE_FADING ; otherwise, don't fade 1392 1393 set_fading: 1394 mov [ FadingNum ] , eax 1395 1396 mov ebx,[ShapeJumpTableAddress] 1397 mov dword ptr [CriticalFadeRedirections-NewShapeJumpTable+ebx],offset Single_Line_Single_Fade 1398 mov dword ptr [CriticalFadeRedirections-NewShapeJumpTable+ebx+4],offset Single_Line_Single_Fade_Trans 1399 cmp eax,1 1400 jz single_fade 1401 mov dword ptr [CriticalFadeRedirections-NewShapeJumpTable+ebx],offset Single_Line_Fading 1402 mov dword ptr [CriticalFadeRedirections-NewShapeJumpTable+ebx+4],offset Single_Line_Fading_Trans 1403 1404 single_fade: 1405 1406 ;-------------------------------------------------------------------- 1407 ; SHAPE_PREDATOR: DWORD init_pred_lookup_offset (0-7) 1408 ;-------------------------------------------------------------------- 1409 check_predator: 1410 test [ flags ] , SHAPE_PREDATOR ; is predator effect on 1411 jz check_partial 1412 1413 mov eax , [ flags + edi ] ; pull the partial value 1414 or [ jflags ] , FLAG_PREDATOR 1415 shl eax , 1 1416 cmp eax , 0 1417 jge check_range 1418 1419 neg eax 1420 mov ebx , -1 1421 and eax , PRED_MASK ; keep entries within bounds 1422 mov bl , al 1423 mov eax , ebx ; will be ffffff00-ffffff07 1424 jmp pred_cont 1425 1426 check_range: 1427 and eax , PRED_MASK ; keep entries within bounds 1428 1429 pred_cont: 1430 add edi , 4 ; next argument 1431 mov [ BFPredOffset ] , eax 1432 mov [ BFPartialCount ] , 0 ; clear the partial count 1433 mov [ BFPartialPred ] , 100h ; init partial to off 1434 1435 pred_neg_init: 1436 mov esi , [ dest ] ; get ptr to dest 1437 mov ebx, 7 * 2 1438 1439 pred_loop: 1440 movzx eax , [ WORD PTR BFPredNegTable + ebx ] 1441 add eax , [esi].GraphicViewPort.GVPWidth ; add width 1442 add eax , [esi].GraphicViewPort.GVPXAdd ; add x add 1443 add eax , [esi].GraphicViewPort.GVPPitch ; extra pitch of DD surface ST - 9/29/95 1:08PM 1444 mov [ WORD PTR BFPredNegTable + 16 + ebx ] , ax 1445 dec ebx 1446 dec ebx 1447 jge pred_loop 1448 1449 ;-------------------------------------------------------------------- 1450 ; SHAPE_PARTIAL: DWORD partial_pred_value (0-255) 1451 ;-------------------------------------------------------------------- 1452 check_partial: 1453 test [ flags ] , SHAPE_PARTIAL ; is this a partial pred? 1454 jz setupfunc 1455 1456 mov eax , [ flags + edi ] ; pull the partial value 1457 add edi , 4 ; next argument 1458 and eax , 0ffh ; make sure 0-255 1459 mov [ BFPartialPred ] , eax ; store it off 1460 1461 setupfunc: 1462 mov ebx , [ jflags ] ; load flags value 1463 and ebx , FLAG_MASK ; clip high bits 1464 add ebx , ebx ; mult by 4 to get DWORD offset 1465 add ebx , ebx 1466 mov ebx , dword ptr [ BufferFrameTable + ebx ] ; get table value 1467 mov dword ptr [ BufferFrameRout ] , ebx ; store it in the function pointer 1468 1469 ; Clip dest Rectangle against source Window boundaries. 1470 1471 mov [ scr_x ] , 0 1472 mov [ scr_y ] , 0 1473 mov esi , [ dest ] ; get ptr to dest 1474 xor ecx , ecx 1475 xor edx , edx 1476 mov edi , [esi].GraphicViewPort.GVPWidth ; get width into register 1477 mov ebx , [ x_pixel ] 1478 mov eax , [ x_pixel ] 1479 add ebx , [ pixel_width ] 1480 shld ecx , eax , 1 1481 mov [ x1_pixel ] , ebx 1482 inc edi 1483 shld edx , ebx , 1 1484 sub eax , edi 1485 sub ebx , edi 1486 shld ecx , eax , 1 1487 shld edx , ebx , 1 1488 1489 mov edi,[esi].GraphicViewPort.GVPHeight ; get height into register 1490 mov ebx , [ y_pixel ] 1491 mov eax , [ y_pixel ] 1492 add ebx , [ pixel_height ] 1493 shld ecx , eax , 1 1494 mov [ y1_pixel ] , ebx 1495 inc edi 1496 shld edx , ebx , 1 1497 sub eax , edi 1498 sub ebx , edi 1499 shld ecx , eax , 1 1500 shld edx , ebx , 1 1501 1502 xor cl , 5 1503 xor dl , 5 1504 mov al , cl 1505 test dl , cl 1506 jnz real_out 1507 1508 or al , dl 1509 jz do_blit 1510 1511 mov [use_old_draw],1 1512 test cl , 1000b 1513 jz dest_left_ok 1514 1515 mov eax , [ x_pixel ] 1516 neg eax 1517 mov [ x_pixel ] , 0 1518 mov [ scr_x ] , eax 1519 1520 dest_left_ok: 1521 test cl , 0010b 1522 jz dest_bottom_ok 1523 1524 mov eax , [ y_pixel ] 1525 neg eax 1526 mov [ y_pixel ] , 0 1527 mov [ scr_y ] , eax 1528 1529 dest_bottom_ok: 1530 test dl , 0100b 1531 jz dest_right_ok 1532 1533 mov eax , [esi].GraphicViewPort.GVPWidth ; get width into register 1534 mov [ x1_pixel ] , eax 1535 1536 dest_right_ok: 1537 test dl , 0001b 1538 jz do_blit 1539 1540 mov eax , [esi].GraphicViewPort.GVPHeight ; get width into register 1541 mov [ y1_pixel ] , eax 1542 1543 do_blit: 1544 cld 1545 mov eax , [esi].GraphicViewPort.GVPXAdd 1546 add eax , [esi].GraphicViewPort.GVPPitch 1547 add eax , [esi].GraphicViewPort.GVPWidth 1548 mov edi , [esi].GraphicViewPort.GVPOffset 1549 1550 mov ecx , eax 1551 mul [ y_pixel ] 1552 add edi , [ x_pixel ] 1553 add edi , eax 1554 1555 add ecx , [ x_pixel ] 1556 sub ecx , [ x1_pixel ] 1557 mov [ dest_adjust_width ] , ecx 1558 1559 mov esi , [ src ] 1560 mov eax , [ pixel_width ] 1561 sub eax , [ x1_pixel ] 1562 add eax , [ x_pixel ] 1563 mov [ scr_adjust_width ] , eax 1564 1565 mov eax , [ scr_y ] 1566 mul [ pixel_width ] 1567 add eax , [ scr_x ] 1568 add esi , eax 1569 1570 ; 1571 ; If the shape needs to be clipped then we cant handle it with the new header systen 1572 ; so draw it with the old shape drawer 1573 ; 1574 cmp [use_old_draw],0 1575 jnz use_old_stuff 1576 1577 add [header_pointer],size ShapeHeaderType 1578 mov edx,[pixel_height] 1579 mov ecx,[pixel_width] 1580 mov eax,[header_pointer] 1581 mov al,[eax] 1582 mov [save_ecx],ecx 1583 inc [header_pointer] 1584 and eax,BLIT_ALL 1585 shl eax,2 1586 add eax,[ShapeJumpTableAddress] 1587 jmp dword ptr [eax] 1588 1589 1590 use_old_stuff: 1591 mov edx , [ y1_pixel ] 1592 mov eax , [ x1_pixel ] 1593 1594 sub edx , [ y_pixel ] 1595 jle real_out 1596 1597 sub eax , [ x_pixel ] 1598 jle real_out 1599 1600 jmp [ BufferFrameRout ] ; buffer frame to viewport routine 1601 1602 real_out: 1603 1604 cmp [MMXAvailable],0 1605 jz no_mmx_cleanup 1606 call MMX_Done 1607 1608 no_mmx_cleanup: 1609 epilogue 1610 1611 ret 1612 1613 1614 ; ******************************************************************** 1615 ; Forward bitblit only 1616 ; the inner loop is so efficient that 1617 ; the optimal consept no longer apply because 1618 ; the optimal byte have to by a number greather than 9 bytes 1619 ; ******************************************************************** 1620 ;extern BF_Copy:near 1621 1622 BF_Copy: 1623 prologue 1624 1625 cmp eax , 10 1626 jl forward_loop_bytes 1627 1628 forward_loop_dword: 1629 mov ecx , edi 1630 mov ebx , eax 1631 neg ecx 1632 and ecx , 3 1633 sub ebx , ecx 1634 rep movsb 1635 mov ecx , ebx 1636 shr ecx , 2 1637 rep movsd 1638 mov ecx , ebx 1639 and ecx , 3 1640 rep movsb 1641 1642 add esi , [ scr_adjust_width ] 1643 add edi , [ dest_adjust_width ] 1644 dec edx 1645 jnz forward_loop_dword 1646 1647 ret 1648 1649 forward_loop_bytes: 1650 mov ecx , eax 1651 rep movsb 1652 add esi , [ scr_adjust_width ] 1653 add edi , [ dest_adjust_width ] 1654 dec edx ; decrement the height 1655 jnz forward_loop_bytes 1656 1657 epilogue 1658 1659 ret 1660 1661 1662 ;******************************************************************** 1663 ;******************************************************************** 1664 1665 ; segment code page public use32 'code' ; Need stricter segment alignment 1666 ; for pentium optimisations 1667 1668 1669 ; 1670 ; Expand the 'next_line' macro so we can jump to it 1671 ; 1672 ; 1673 ; ST - 12/20/2018 3:48PM 1674 Next_Line:: next_line 1675 1676 1677 1678 ;***************************************************************************** 1679 ; Draw a single line with transparent pixels 1680 ; 1681 ; 11/29/95 10:21AM - ST 1682 ; 1683 ;align 32 1684 1685 Single_Line_Trans:: 1686 prologue 1687 1688 Single_Line_Trans_Entry:: 1689 1690 slt_mask_map_lp: ; Pentium pipeline usage 1691 ;Pipe Cycles 1692 mov al,[esi] ;U 1 1693 inc esi ;Vee 1 1694 1695 test al,al ;U 1 1696 jz slt_skip ;Vee 1/5 1697 1698 slt_not_trans:mov [edi],al ;u 1 1699 1700 inc edi ;vee 1 1701 dec ecx ;u 1 1702 1703 jnz slt_mask_map_lp ;vee (maybe) 1 1704 1705 slt_end_line: epilogue 1706 next_line 1707 1708 ;align 32 1709 1710 slt_skip: inc edi 1711 dec ecx 1712 jz slt_skip_end_line 1713 1714 mov al,[esi] 1715 inc esi 1716 test al,al 1717 jz slt_skip2 1718 mov [edi],al 1719 inc edi 1720 dec ecx 1721 jnz slt_mask_map_lp 1722 1723 epilogue 1724 next_line 1725 1726 ;align 32 1727 1728 slt_skip2: inc edi 1729 dec ecx 1730 jz slt_end_line 1731 1732 ; 1733 ; If we have hit two transparent pixels in a row then we go into 1734 ; the transparent optimised bit 1735 ; 1736 slt_round_again: 1737 rept 64 1738 mov al,[esi] ; ;pipe 1 1739 inc esi ;1 ;pipe 2 1740 test al,al ; ;pipe 1 1741 jnz slt_not_trans;pipe 2 (not pairable in 1) 1742 ;2 1743 inc edi ; ;pipe 1 1744 dec ecx ;3 ;pipe 2 1745 jz slt_end_line ;4 ;pipe 1 (not pairable) 1746 endm ; best case is 4 cycles per iteration 1747 jmp slt_round_again 1748 1749 1750 1751 slt_skip_end_line: 1752 epilogue 1753 next_line 1754 1755 1756 1757 ;***************************************************************************** 1758 ; Draw a single line with no transparent pixels 1759 ; 1760 ; 11/29/95 10:21AM - ST 1761 ; 1762 ; We have to align the destination for cards that dont bankswitch correctly 1763 ; when you write non-aligned data. 1764 ; 1765 ;align 32 1766 Long_Single_Line_Copy: 1767 prologue 1768 1769 rept 3 1770 test edi,3 1771 jz LSLC_aligned 1772 movsb 1773 dec ecx 1774 endm 1775 1776 LSLC_aligned: 1777 mov ebx,ecx 1778 1779 shr ecx,2 1780 rep movsd 1781 and ebx,3 1782 jz proc_out 1783 movsb 1784 dec bl 1785 jz proc_out 1786 movsb 1787 dec bl 1788 jz proc_out 1789 movsb 1790 proc_out: epilogue 1791 next_line 1792 1793 1794 1795 ;***************************************************************************** 1796 ; Draw a single short line with no transparent pixels 1797 ; 1798 ; 11/29/95 10:21AM - ST 1799 ; 1800 ;align 32 1801 Short_Single_Line_Copy: 1802 prologue 1803 cmp ecx,16 1804 jge Long_Single_Line_Copy 1805 mov ebx,ecx 1806 rep movsb 1807 mov ecx,ebx 1808 epilogue 1809 next_line 1810 1811 1812 ;***************************************************************************** 1813 ; Skip a line of source that is all transparent 1814 ; 1815 ; 11/29/95 10:21AM - ST 1816 ; 1817 1818 ;align 32 1819 Single_Line_Skip: 1820 prologue 1821 add esi,ecx 1822 add edi,ecx 1823 epilogue 1824 next_line 1825 1826 1827 1828 ;***************************************************************************** 1829 ; Draw a single line with ghosting 1830 ; 1831 ; 11/29/95 10:21AM - ST 1832 ; 1833 ;align 32 1834 Single_Line_Ghost: 1835 1836 prologue 1837 xor eax,eax 1838 slg_loop: mov al,[esi] 1839 mov ebx,[IsTranslucent] 1840 inc esi 1841 mov bh,[eax+ebx] 1842 cmp bh,-1 1843 jz slg_store_pixel 1844 1845 and ebx,0ff00h 1846 mov al,[edi] 1847 add ebx,[Translucent] 1848 mov al,[eax+ebx] 1849 1850 slg_store_pixel: 1851 mov [edi],al 1852 1853 inc edi 1854 dec ecx 1855 jnz slg_loop 1856 epilogue 1857 next_line 1858 1859 1860 1861 ;***************************************************************************** 1862 ; Draw a single line with transparent pixels and ghosting 1863 ; 1864 ; 11/29/95 10:21AM - ST 1865 ; 1866 ;align 32 1867 Single_Line_Ghost_Trans: 1868 prologue 1869 xor eax,eax 1870 ; cmp ecx,3 1871 ; ja slgt4 1872 1873 slgt_loop: mov al,[esi] 1874 inc esi 1875 test al,al 1876 jz slgt_transparent 1877 1878 slgt_not_transparent: 1879 mov ebx,[IsTranslucent] 1880 mov bh,[eax+ebx] 1881 cmp bh,-1 1882 jz slgt_store_pixel 1883 1884 and ebx,0ff00h 1885 mov al,[edi] 1886 add ebx,[Translucent] 1887 mov al,[eax+ebx] 1888 1889 slgt_store_pixel: 1890 mov [edi],al 1891 inc edi 1892 dec ecx 1893 jnz slgt_loop 1894 epilogue 1895 next_line 1896 1897 1898 ;align 32 1899 1900 slgt_transparent: 1901 inc edi ;1 1902 dec ecx ;2 1903 jz slgt_out ;1 (not pairable) 1904 1905 slgt_round_again: 1906 rept 64 1907 mov al,[esi] ; ;pipe 1 1908 inc esi ;1 ;pipe 2 1909 test al,al ; ;pipe 1 1910 jnz slgt_not_transparent ;pipe 2 (not pairable in 1) 1911 ;2 1912 inc edi ; ;pipe 1 1913 dec ecx ;3 ;pipe 2 1914 jz slgt_out ;4 ;pipe 1 (not pairable) 1915 endm ; best case is 4 cycles per iteration 1916 jmp slgt_round_again 1917 1918 slgt_out: epilogue 1919 next_line 1920 1921 1922 1923 ; 1924 ; Optimised video memory access version 1925 ; 1926 ;align 32 1927 1928 slgt4: push edx 1929 mov edx,[edi] 1930 1931 rept 4 1932 local slgt4_store1 1933 local slgt4_trans1 1934 mov al,[esi] 1935 inc esi 1936 test al,al 1937 jz slgt4_trans1 1938 1939 mov ebx,[IsTranslucent] 1940 mov bh,[eax+ebx] 1941 cmp bh,-1 1942 jz slgt4_store1 1943 1944 and ebx,0ff00h 1945 mov al,dl 1946 add ebx,[Translucent] 1947 mov al,[eax+ebx] 1948 1949 slgt4_store1: mov dl,al 1950 1951 slgt4_trans1: ror edx,8 1952 endm 1953 mov [edi],edx 1954 pop edx 1955 lea edi,[edi+4] 1956 lea ecx,[ecx+0fffffffch] 1957 cmp ecx,3 1958 ja slgt4 1959 test ecx,ecx 1960 jnz slgt_loop 1961 1962 epilogue 1963 next_line 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 ;***************************************************************************** 1975 ; Draw a single line with fading (colour remapping) 1976 ; 1977 ; 11/29/95 10:21AM - ST 1978 ; 1979 ;align 32 1980 1981 Single_Line_Fading: 1982 prologue 1983 xor eax,eax 1984 mov ebx,[FadingTable] 1985 push ebp 1986 mov ebp,[FadingNum] 1987 push ebp 1988 1989 slf_loop: mov al,[esi] 1990 inc esi 1991 1992 mov ebp,[esp] 1993 1994 slf_fade_loop:mov al,[ebx+eax] 1995 dec ebp 1996 jnz slf_fade_loop 1997 1998 mov [edi],al 1999 inc edi 2000 2001 dec ecx 2002 jnz slf_loop 2003 add esp,4 2004 pop ebp 2005 epilogue 2006 next_line 2007 2008 2009 ;***************************************************************************** 2010 ; Draw a single line with transparent pixels and fading (colour remapping) 2011 ; 2012 ; 11/29/95 10:21AM - ST 2013 ; 2014 ;align 32 2015 2016 Single_Line_Fading_Trans: 2017 prologue 2018 xor eax,eax 2019 mov ebx,[FadingTable] 2020 push ebp 2021 mov ebp,[FadingNum] 2022 push ebp 2023 2024 slft_loop: mov al,[esi] 2025 inc esi 2026 test al,al 2027 jz slft_transparent 2028 2029 mov ebp,[esp] 2030 2031 slft_fade_loop: 2032 mov al,[ebx+eax] 2033 dec ebp 2034 jnz slft_fade_loop 2035 2036 mov [edi],al 2037 slft_transparent: 2038 inc edi 2039 2040 dec ecx 2041 jnz slft_loop 2042 add esp,4 2043 pop ebp 2044 epilogue 2045 next_line 2046 2047 2048 2049 2050 2051 ;***************************************************************************** 2052 ; Draw a single line with a single fade level (colour remap) 2053 ; 2054 ; 11/29/95 10:21AM - ST 2055 ; 2056 ;align 32 2057 2058 Single_Line_Single_Fade: 2059 prologue 2060 xor eax,eax 2061 mov ebx,[FadingTable] 2062 2063 slsf_loop: mov al,[esi] 2064 mov al,[ebx+eax] 2065 mov [edi],al 2066 inc esi 2067 inc edi 2068 2069 dec ecx 2070 jnz slsf_loop 2071 epilogue 2072 next_line 2073 2074 2075 2076 ;***************************************************************************** 2077 ; Draw a single line with transparent pixels and a single fade level (colour remap) 2078 ; 2079 ; 11/29/95 10:21AM - ST 2080 ; 2081 ;align 32 2082 2083 Single_Line_Single_Fade_Trans: 2084 prologue 2085 xor eax,eax 2086 mov ebx,[FadingTable] 2087 2088 slsft_loop: mov al,[esi] 2089 inc esi 2090 test al,al 2091 jz slsft_transparent 2092 mov al,[ebx+eax] 2093 mov [edi],al 2094 inc edi 2095 dec ecx 2096 jnz slsft_loop 2097 epilogue 2098 next_line 2099 2100 ;align 32 2101 2102 slsft_transparent: 2103 inc edi 2104 2105 dec ecx 2106 jz slsft_next_line 2107 mov al,[esi] 2108 inc esi 2109 test al,al 2110 jz slsft_transparent 2111 mov al,[ebx+eax] 2112 mov [edi],al 2113 inc edi 2114 dec ecx 2115 jnz slsft_loop 2116 2117 slsft_next_line: 2118 epilogue 2119 next_line 2120 2121 2122 2123 2124 2125 ;***************************************************************************** 2126 ; Draw a single line with ghosting and fading (colour remapping) 2127 ; 2128 ; 11/29/95 10:21AM - ST 2129 ; 2130 ;align 32 2131 2132 Single_Line_Ghost_Fading: 2133 2134 prologue 2135 mov [StashECX],ecx 2136 2137 SLGF_loop: xor eax,eax 2138 mov al,[esi] 2139 mov ebx,[IsTranslucent] 2140 mov bh,[eax+ebx] 2141 cmp bh,-1 2142 jz slgf_do_fading 2143 2144 and ebx,0ff00h 2145 2146 mov al,[edi] 2147 add ebx,[Translucent] 2148 mov al,[ebx+eax] 2149 2150 slgf_do_fading: 2151 mov ebx,[FadingTable] 2152 mov ecx,[FadingNum] 2153 2154 slgf_fade_loop: 2155 mov al,[eax+ebx] 2156 dec ecx 2157 jnz slgf_fade_loop 2158 2159 mov [edi],al 2160 inc esi 2161 inc edi 2162 2163 dec [StashECX] 2164 jnz SLGF_loop 2165 epilogue 2166 next_line 2167 2168 2169 ;***************************************************************************** 2170 ; Draw a single line with transparent pixels, ghosting and fading 2171 ; 2172 ; 11/29/95 10:21AM - ST 2173 ; 2174 ;align 32 2175 2176 Single_Line_Ghost_Fading_Trans: 2177 prologue 2178 mov [StashECX],ecx 2179 xor eax,eax 2180 2181 ; cmp ecx,3 2182 ; ja slgft4 2183 2184 SLGFT_loop: mov al,[esi] 2185 inc esi 2186 test al,al 2187 jz slgft_trans_pixel 2188 mov ebx,[IsTranslucent] 2189 mov bh,[eax+ebx] 2190 cmp bh,-1 2191 jz slgft_do_fading 2192 2193 and ebx,0ff00h 2194 2195 mov al,[edi] 2196 add ebx,[Translucent] 2197 mov al,[ebx+eax] 2198 2199 slgft_do_fading: 2200 mov ebx,[FadingTable] 2201 mov ecx,[FadingNum] 2202 2203 slgft_fade_loop: 2204 mov al,[eax+ebx] 2205 dec ecx 2206 jnz slgft_fade_loop 2207 2208 mov [edi],al 2209 slgft_trans_pixel: 2210 inc edi 2211 2212 dec [StashECX] 2213 jnz SLGFT_loop 2214 epilogue 2215 next_line 2216 2217 2218 ;align 32 2219 2220 slgft4: push edx 2221 mov edx,[edi] 2222 2223 rept 4 2224 local slgft4_fade 2225 local slgft4_fade_lp 2226 local slgft4_trans 2227 mov al,[esi] 2228 inc esi 2229 test al,al 2230 jz slgft4_trans 2231 mov ebx,[IsTranslucent] 2232 mov bh,[eax+ebx] 2233 cmp bh,-1 2234 jz slgft4_fade 2235 2236 and ebx,0ff00h 2237 2238 mov al,dl 2239 add ebx,[Translucent] 2240 mov al,[ebx+eax] 2241 2242 slgft4_fade: mov ebx,[FadingTable] 2243 mov ecx,[FadingNum] 2244 2245 slgft4_fade_lp: mov al,[eax+ebx] 2246 dec ecx 2247 jnz slgft4_fade_lp 2248 2249 mov dl,al 2250 2251 slgft4_trans: ror edx,8 2252 endm 2253 mov [edi],edx 2254 pop edx 2255 lea edi,[edi+4] 2256 sub [StashECX],4 2257 jz slgft4_out 2258 cmp [StashECX],3 2259 ja slgft4 2260 jmp SLGFT_loop 2261 2262 slgft4_out: epilogue 2263 next_line 2264 2265 2266 ;***************************************************************************** 2267 ; Draw a single line with predator effect 2268 ; 2269 ; 11/29/95 10:21AM - ST 2270 ; 2271 ;align 32 2272 2273 Single_Line_Predator: 2274 2275 prologue 2276 2277 slp_loop: mov al,[esi] 2278 2279 mov ebx,[BFPartialCount] 2280 add ebx,[BFPartialPred] 2281 or bh,bh 2282 jnz slp_get_pred 2283 2284 mov [BFPartialCount] , ebx 2285 jmp slp_skip_pixel 2286 2287 slp_get_pred: xor bh , bh 2288 mov eax,[BFPredOffset] 2289 mov [BFPartialCount] , ebx 2290 add byte ptr [BFPredOffset],2 2291 mov eax, dword ptr [BFPredTable+eax] 2292 and byte ptr [BFPredOffset],PRED_MASK 2293 and eax,0ffffh 2294 2295 mov al,[edi+eax] 2296 mov [edi],al 2297 2298 slp_skip_pixel: 2299 inc esi 2300 inc edi 2301 2302 dec ecx 2303 jnz slp_loop 2304 2305 epilogue 2306 next_line 2307 2308 2309 2310 2311 ;***************************************************************************** 2312 ; Draw a single line with transparent pixels and predator effect 2313 ; 2314 ; 11/29/95 10:21AM - ST 2315 ; 2316 ;align 32 2317 2318 Single_Line_Predator_Trans: 2319 2320 prologue 2321 2322 slpt_loop: mov al,[esi] 2323 inc esi 2324 test al,al 2325 jz slpt_skip_pixel 2326 2327 mov ebx,[BFPartialCount] 2328 add ebx,[BFPartialPred] 2329 or bh,bh 2330 jnz slpt_get_pred 2331 2332 mov [BFPartialCount] , ebx 2333 jmp slpt_skip_pixel 2334 2335 slpt_get_pred:xor bh , bh 2336 mov eax,[BFPredOffset] 2337 mov [BFPartialCount] , ebx 2338 add byte ptr [BFPredOffset],2 2339 mov eax,dword ptr [BFPredTable+eax] 2340 and byte ptr [BFPredOffset ] , PRED_MASK 2341 and eax,0ffffh 2342 2343 mov al,[edi+eax] 2344 mov [edi],al 2345 2346 slpt_skip_pixel: 2347 inc edi 2348 2349 dec ecx 2350 jnz slpt_loop 2351 2352 epilogue 2353 next_line 2354 2355 2356 ;***************************************************************************** 2357 ; Draw a single line with predator and ghosting 2358 ; 2359 ; 11/29/95 10:21AM - ST 2360 ; 2361 ;align 32 2362 2363 Single_Line_Predator_Ghost: 2364 2365 prologue 2366 2367 slpg_loop: mov al,[esi] 2368 mov ebx,[BFPartialCount] 2369 add ebx,[BFPartialPred] 2370 test bh,bh 2371 jnz slpg_get_pred ; is this a predator pixel? 2372 2373 mov [BFPartialCount],ebx 2374 jmp slpg_check_ghost 2375 2376 slpg_get_pred: 2377 xor bh,bh 2378 mov eax,[BFPredOffset] 2379 mov [BFPartialCount],ebx 2380 add byte ptr [BFPredOffset],2 2381 mov eax,dword ptr [BFPredTable+eax ] 2382 and byte ptr [BFPredOffset],PRED_MASK 2383 and eax,0ffffh 2384 mov al,[edi+eax] 2385 2386 slpg_check_ghost: 2387 mov ebx,[IsTranslucent] 2388 mov bh,[ebx+eax] 2389 cmp bh,0ffh 2390 je slpg_store_pixel 2391 2392 xor eax,eax 2393 and ebx,0FF00h 2394 2395 mov al,[edi] 2396 add ebx,[Translucent] 2397 2398 mov al,[ebx+eax] 2399 2400 slpg_store_pixel: 2401 mov [edi],al 2402 inc esi 2403 inc edi 2404 2405 dec ecx 2406 jnz slpg_loop 2407 2408 epilogue 2409 next_line 2410 2411 2412 2413 ;***************************************************************************** 2414 ; Draw a single line with transparent pixels, predator and ghosting 2415 ; 2416 ; 11/29/95 10:21AM - ST 2417 ; 2418 ;align 32 2419 2420 Single_Line_Predator_Ghost_Trans: 2421 prologue 2422 2423 slpgt_loop: mov al,[esi] 2424 inc esi 2425 test al,al 2426 jz slpgt_transparent 2427 2428 mov ebx,[BFPartialCount] 2429 add ebx,[BFPartialPred] 2430 test bh,bh 2431 jnz slpgt_get_pred ; is this a predator pixel? 2432 2433 mov [BFPartialCount],ebx 2434 jmp slpgt_check_ghost 2435 2436 slpgt_get_pred: 2437 xor bh,bh 2438 mov eax,[BFPredOffset] 2439 mov [BFPartialCount],ebx 2440 add byte ptr [BFPredOffset],2 2441 mov eax,dword ptr [BFPredTable+eax ] 2442 and byte ptr [BFPredOffset],PRED_MASK 2443 and eax,0ffffh 2444 mov al,[edi+eax] 2445 2446 slpgt_check_ghost: 2447 mov ebx,[IsTranslucent] 2448 mov bh,[ebx+eax] 2449 cmp bh,0ffh 2450 je slpgt_store_pixel 2451 2452 xor eax,eax 2453 and ebx,0FF00h 2454 2455 mov al,[edi] 2456 add ebx,[Translucent] 2457 2458 mov al,[ebx+eax] 2459 2460 slpgt_store_pixel: 2461 mov [edi],al 2462 slpgt_transparent: 2463 inc edi 2464 2465 dec ecx 2466 jnz slpgt_loop 2467 2468 pop ecx 2469 epilogue 2470 next_line 2471 2472 2473 ;***************************************************************************** 2474 ; Draw a single line with predator and fading 2475 ; 2476 ; 11/29/95 10:21AM - ST 2477 ; 2478 ;align 32 2479 2480 Single_Line_Predator_Fading: 2481 2482 prologue 2483 mov [StashECX],ecx 2484 2485 slpf_loop: mov al,[esi] 2486 mov ebx,[BFPartialCount] 2487 inc esi 2488 add ebx,[BFPartialPred] 2489 test bh,bh 2490 jnz slpf_get_pred 2491 2492 mov [BFPartialCount],ebx 2493 jmp slpf_do_fading 2494 2495 slpf_get_pred:xor bh,bh 2496 mov eax,[BFPredOffset] 2497 mov [BFPartialCount],ebx 2498 and byte ptr [BFPredOffset],2 2499 mov eax,dword ptr [BFPredTable+eax] 2500 and byte ptr [BFPredOffset],PRED_MASK 2501 2502 and eax,0ffffh 2503 mov al,[eax+edi] 2504 2505 slpf_do_fading: 2506 and eax,255 2507 mov ebx,[FadingTable] 2508 mov ecx,[FadingNum] 2509 2510 slpf_fade_loop: 2511 mov al,[eax+ebx] 2512 dec ecx 2513 jnz slpf_fade_loop 2514 2515 mov [edi],al 2516 inc edi 2517 2518 dec [StashECX] 2519 jnz slpf_loop 2520 2521 epilogue 2522 next_line 2523 2524 2525 2526 ;***************************************************************************** 2527 ; Draw a single line with transparent pixels, fading and predator 2528 ; 2529 ; 11/29/95 10:21AM - ST 2530 ; 2531 ;align 32 2532 2533 Single_Line_Predator_Fading_Trans: 2534 prologue 2535 mov [StashECX],ecx 2536 2537 slpft_loop: mov al,[esi] 2538 inc esi 2539 test al,al 2540 jz slpft_transparent 2541 mov ebx,[BFPartialCount] 2542 add ebx,[BFPartialPred] 2543 test bh,bh 2544 jnz slpft_get_pred 2545 2546 mov [BFPartialCount],ebx 2547 jmp slpft_do_fading 2548 2549 slpft_get_pred: 2550 xor bh,bh 2551 mov eax,[BFPredOffset] 2552 mov [BFPartialCount],ebx 2553 and byte ptr [BFPredOffset],2 2554 mov eax,dword ptr [BFPredTable+eax] 2555 and byte ptr [BFPredOffset],PRED_MASK 2556 2557 and eax,0ffffh 2558 mov al,[eax+edi] 2559 2560 slpft_do_fading: 2561 and eax,255 2562 mov ebx,[FadingTable] 2563 mov ecx,[FadingNum] 2564 2565 slpft_fade_loop: 2566 mov al,[eax+ebx] 2567 dec ecx 2568 jnz slpft_fade_loop 2569 2570 mov [edi],al 2571 slpft_transparent: 2572 inc edi 2573 2574 dec [StashECX] 2575 jnz slpft_loop 2576 2577 epilogue 2578 next_line 2579 2580 2581 2582 ;***************************************************************************** 2583 ; Draw a single line with predator, ghosting and fading 2584 ; 2585 ; 11/29/95 10:21AM - ST 2586 ; 2587 ;align 32 2588 2589 Single_Line_Predator_Ghost_Fading: 2590 2591 prologue 2592 mov [StashECX],ecx 2593 2594 slpgf_loop: mov al,[esi] 2595 mov ebx,[BFPartialCount] 2596 inc esi 2597 add ebx,[BFPartialPred] 2598 test bh , bh 2599 jnz slpgf_get_pred ; is this a predator pixel? 2600 2601 mov [BFPartialCount],ebx 2602 jmp slpgf_check_ghost 2603 2604 slpgf_get_pred: 2605 xor bh,bh 2606 mov eax,[BFPredOffset] 2607 mov [BFPartialCount],ebx 2608 add byte ptr [BFPredOffset],2 2609 mov eax,dword ptr [BFPredTable+eax] 2610 and byte ptr [BFPredOffset],PRED_MASK 2611 and eax,0ffffh 2612 2613 mov al,[edi+eax] 2614 2615 slpgf_check_ghost: 2616 and eax,255 2617 mov ebx,[IsTranslucent] 2618 mov bh,[ebx+eax] 2619 cmp bh,0ffh 2620 je slpgf_do_fading 2621 2622 and ebx , 0FF00h 2623 2624 mov al,[edi] 2625 add ebx,[Translucent] 2626 2627 mov al,[ebx+eax] 2628 2629 slpgf_do_fading: 2630 xor eax,eax 2631 mov ebx,[FadingTable] 2632 mov ecx,[FadingNum] 2633 2634 slpgf_fade_loop: 2635 mov al,[ebx+eax] 2636 dec ecx 2637 jnz slpgf_fade_loop 2638 2639 slpgf_store_pixel: 2640 mov [edi],al 2641 inc edi 2642 2643 dec [StashECX] 2644 jnz slpgf_loop 2645 2646 epilogue 2647 next_line 2648 2649 2650 2651 ;***************************************************************************** 2652 ; Draw a single line with transparent pixels, predator, ghosting and fading 2653 ; 2654 ; 11/29/95 10:21AM - ST 2655 ; 2656 ;align 32 2657 2658 Single_Line_Predator_Ghost_Fading_Trans: 2659 2660 prologue 2661 mov [StashECX],ecx 2662 2663 slpgft_loop: mov al,[esi] 2664 inc esi 2665 test al,al 2666 jz slpgft_transparent 2667 2668 mov ebx,[BFPartialCount] 2669 add ebx,[BFPartialPred] 2670 test bh , bh 2671 jnz slpgft_get_pred ; is this a predator pixel? 2672 2673 mov [BFPartialCount],ebx 2674 jmp slpgft_check_ghost 2675 2676 slpgft_get_pred: 2677 xor bh,bh 2678 mov eax,[BFPredOffset] 2679 mov [BFPartialCount],ebx 2680 add byte ptr [BFPredOffset],2 2681 mov eax,dword ptr [BFPredTable+eax] 2682 and byte ptr [BFPredOffset],PRED_MASK 2683 and eax,0ffffh 2684 2685 mov al,[edi+eax] 2686 2687 slpgft_check_ghost: 2688 and eax,255 2689 mov ebx,[IsTranslucent] 2690 mov bh,[ebx+eax] 2691 cmp bh,0ffh 2692 je slpgft_do_fading 2693 2694 and ebx , 0FF00h 2695 2696 mov al,[edi] 2697 add ebx,[Translucent] 2698 2699 mov al,[ebx+eax] 2700 2701 slpgft_do_fading: 2702 xor eax,eax 2703 mov ebx,[FadingTable] 2704 mov ecx,[FadingNum] 2705 2706 slpgft_fade_loop: 2707 mov al,[ebx+eax] 2708 dec ecx 2709 jnz slpgft_fade_loop 2710 2711 slpgft_store_pixel: 2712 mov [edi],al 2713 slpgft_transparent: 2714 inc edi 2715 2716 dec [StashECX] 2717 jnz slpgft_loop 2718 2719 epilogue 2720 next_line 2721 2722 2723 2724 2725 ; ends ;end of strict alignment segment 2726 2727 ; codeseg 2728 2729 2730 2731 ;extern BF_Trans:near 2732 2733 BF_Trans: 2734 2735 prologue 2736 ; calc the code location to skip to 10 bytes per REPT below!!!! 2737 mov ecx , eax 2738 and ecx , 01fh 2739 lea ecx , [ ecx + ecx * 4 ] ; quick multiply by 5 2740 neg ecx 2741 shr eax , 5 2742 lea ecx , [ trans_reference + ecx * 2 ] ; next multiply by 2 2743 mov [ loop_cnt ] , eax 2744 mov [ jmp_loc ] , ecx 2745 2746 trans_loop: 2747 mov ecx , [ loop_cnt ] 2748 jmp [ jmp_loc ] 2749 2750 ; the following code should NOT be changed without changing the calculation 2751 ; above!!!!!! 2752 2753 trans_line: 2754 2755 REPT 32 2756 local trans_pixel 2757 mov bl , [ esi ] 2758 inc esi 2759 test bl , bl 2760 jz trans_pixel 2761 2762 mov [ edi ] , bl 2763 2764 trans_pixel: 2765 inc edi 2766 ENDM 2767 2768 trans_reference: 2769 dec ecx 2770 jge trans_line 2771 2772 add esi , [ scr_adjust_width ] 2773 add edi , [ dest_adjust_width ] 2774 dec edx 2775 jnz trans_loop 2776 epilogue 2777 2778 ret 2779 2780 ;******************************************************************** 2781 ;******************************************************************** 2782 2783 ;extern BF_Ghost:near 2784 BF_Ghost: 2785 2786 prologue 2787 mov ebx , eax ; width 2788 2789 ; NOTE: the below calculation assumes a group of instructions is 2790 ; less than 256 bytes 2791 2792 ; get length of the 32 groups of instructions 2793 2794 lea ecx, [offset ghost_reference] 2795 sub ecx, [offset ghost_line] 2796 2797 shr ebx , 5 ; width / 32 2798 shr ecx , 5 ; length of instructions / 32 2799 and eax , 01fh ; mod of width / 32 2800 mul cl ; calc offset to start of group 2801 neg eax ; inverse of width 2802 mov [ loop_cnt ] , ebx ; save width / 32 2803 lea ecx , [ ghost_reference + eax ] 2804 mov eax , 0 2805 mov [ jmp_loc ] , ecx 2806 2807 ghost_loop: 2808 mov ecx , [ loop_cnt ] 2809 jmp [ jmp_loc ] 2810 2811 ghost_line: 2812 2813 REPT 32 2814 local store_pixel 2815 mov al , [ esi ] 2816 inc esi 2817 mov ebx , [ IsTranslucent ] ; is it a translucent color? 2818 mov bh , BYTE PTR [ ebx + eax ] 2819 cmp bh , 0ffh 2820 je store_pixel 2821 2822 and ebx , 0FF00h ; clear all of ebx except bh 2823 ; we have the index to the translation table 2824 ; ((trans_colour * 256) + dest colour) 2825 mov al , [ edi ] ; mov pixel at destination to al 2826 add ebx , [ Translucent ] ; get the ptr to it! 2827 ; Add the (trans_color * 256) of the translation equ. 2828 mov al , BYTE PTR [ ebx + eax ] ; get new pixel in al 2829 2830 store_pixel: 2831 mov [ edi ] , al 2832 inc edi 2833 2834 ENDM 2835 2836 ghost_reference: 2837 dec ecx 2838 jge ghost_line 2839 2840 add esi , [ scr_adjust_width ] 2841 add edi , [ dest_adjust_width ] 2842 dec edx 2843 jnz ghost_loop 2844 2845 epilogue 2846 ret 2847 2848 2849 ;******************************************************************** 2850 ;******************************************************************** 2851 2852 ;extern BF_Ghost_Trans:near 2853 BF_Ghost_Trans: 2854 2855 prologue 2856 mov ebx , eax ; width 2857 2858 ; NOTE: the below calculation assumes a group of instructions is 2859 ; less than 256 bytes 2860 2861 ; get length of the 32 groups of instructions 2862 2863 lea ecx , [ offset ghost_t_reference ] 2864 sub ecx, [ offset ghost_t_line ] 2865 2866 shr ebx , 5 ; width / 32 2867 shr ecx , 5 ; length of instructions / 32 2868 and eax , 01fh ; mod of width / 32 2869 mul cl ; calc offset to start of group 2870 neg eax ; inverse of width 2871 mov [ loop_cnt ] , ebx ; save width / 32 2872 lea ecx , [ ghost_t_reference + eax ] 2873 mov eax , 0 2874 mov [ jmp_loc ] , ecx 2875 2876 ghost_t_loop: 2877 mov ecx , [ loop_cnt ] 2878 jmp [ jmp_loc ] 2879 2880 ghost_t_line: 2881 2882 REPT 32 2883 local transp_pixel 2884 local store_pixel 2885 mov al , [ esi ] 2886 inc esi 2887 test al , al 2888 jz transp_pixel 2889 2890 mov ebx , [ IsTranslucent ] ; is it a translucent color? 2891 mov bh , BYTE PTR [ ebx + eax ] 2892 cmp bh , 0ffh 2893 je store_pixel 2894 2895 and ebx , 0FF00h ; clear all of ebx except bh 2896 ; we have the index to the translation table 2897 ; ((trans_colour * 256) + dest colour) 2898 mov al , [ edi ] ; mov pixel at destination to al 2899 add ebx , [ Translucent ] ; get the ptr to it! 2900 ; Add the (trans_color * 256) of the translation equ. 2901 mov al , BYTE PTR [ ebx + eax ] ; get new pixel in al 2902 2903 store_pixel: 2904 mov [ edi ] , al 2905 2906 transp_pixel: 2907 inc edi 2908 2909 ENDM 2910 2911 ghost_t_reference: 2912 dec ecx 2913 jge ghost_t_line 2914 2915 add esi , [ scr_adjust_width ] 2916 add edi , [ dest_adjust_width ] 2917 dec edx 2918 jnz ghost_t_loop 2919 2920 epilogue 2921 ret 2922 2923 2924 ;******************************************************************** 2925 ;******************************************************************** 2926 2927 ;extern BF_Fading:near 2928 BF_Fading: 2929 2930 prologue 2931 mov ebx , eax ; width 2932 2933 ; NOTE: the below calculation assumes a group of instructions is 2934 ; less than 256 bytes 2935 2936 ; get length of the 32 groups of instructions 2937 2938 lea ecx , [ offset fading_reference ] 2939 sub ecx, [ offset fading_line ] 2940 2941 shr ebx , 5 ; width / 32 2942 shr ecx , 5 ; length of instructions / 32 2943 and eax , 01fh ; mod of width / 32 2944 mul cl ; calc offset to start of group 2945 neg eax ; inverse of width 2946 mov [ loop_cnt ] , ebx ; save width / 32 2947 lea ecx , [ fading_reference + eax ] 2948 mov eax , 0 2949 mov [ jmp_loc ] , ecx 2950 2951 fading_loop: 2952 mov ecx , [ loop_cnt ] 2953 mov [ StashECX ] , ecx ; preserve ecx for later 2954 mov ebx , [ FadingTable ] ; run color through fading table 2955 jmp [ jmp_loc ] 2956 2957 fading_line_begin: 2958 mov [ StashECX ] , ecx ; preserve ecx for later 2959 2960 fading_line: 2961 2962 REPT 32 2963 local fade_loop 2964 mov al , [ esi ] 2965 inc esi 2966 mov ecx , [ FadingNum ] 2967 2968 fade_loop: 2969 mov al, byte ptr [ebx + eax] 2970 dec ecx 2971 jnz fade_loop 2972 2973 mov [ edi ] , al 2974 inc edi 2975 2976 ENDM 2977 2978 fading_reference: 2979 mov ecx , [ StashECX ] ; restore ecx for main draw loop 2980 dec ecx 2981 jge fading_line_begin 2982 2983 add esi , [ scr_adjust_width ] 2984 add edi , [ dest_adjust_width ] 2985 dec edx 2986 jnz fading_loop 2987 2988 epilogue 2989 ret 2990 2991 2992 ;******************************************************************** 2993 ;******************************************************************** 2994 2995 ;extern BF_Fading_Trans:near 2996 BF_Fading_Trans: 2997 2998 prologue 2999 mov ebx , eax ; width 3000 3001 ; NOTE: the below calculation assumes a group of instructions is 3002 ; less than 256 bytes 3003 3004 ; get length of the 32 groups of instructions 3005 3006 lea ecx , [ offset fading_t_reference ] 3007 sub ecx, [ offset fading_t_line ] 3008 3009 shr ebx , 5 ; width / 32 3010 shr ecx , 5 ; length of instructions / 32 3011 and eax , 01fh ; mod of width / 32 3012 mul cl ; calc offset to start of group 3013 neg eax ; inverse of width 3014 mov [ loop_cnt ] , ebx ; save width / 32 3015 lea ecx , [ fading_t_reference + eax ] 3016 mov eax , 0 3017 mov [ jmp_loc ] , ecx 3018 3019 fading_t_loop: 3020 mov ecx , [ loop_cnt ] 3021 mov [ StashECX ] , ecx ; preserve ecx for later 3022 mov ebx , [ FadingTable ] ; run color through fading table 3023 jmp [ jmp_loc ] 3024 3025 fading_t_line_begin: 3026 mov [ StashECX ] , ecx ; preserve ecx for later 3027 3028 fading_t_line: 3029 3030 REPT 32 3031 local transp_pixel 3032 local fade_loop 3033 mov al , [ esi ] 3034 inc esi 3035 test al , al 3036 jz transp_pixel 3037 3038 mov ecx , [ FadingNum ] 3039 3040 fade_loop: 3041 mov al, byte ptr [ebx + eax] 3042 dec ecx 3043 jnz fade_loop 3044 3045 mov [ edi ] , al 3046 3047 transp_pixel: 3048 inc edi 3049 3050 ENDM 3051 3052 fading_t_reference: 3053 mov ecx , [ StashECX ] ; restore ecx for main draw loop 3054 dec ecx 3055 jge fading_t_line_begin 3056 3057 add esi , [ scr_adjust_width ] 3058 add edi , [ dest_adjust_width ] 3059 dec edx 3060 jnz fading_t_loop 3061 3062 epilogue 3063 ret 3064 3065 3066 ;******************************************************************** 3067 ;******************************************************************** 3068 3069 ;extern BF_Ghost_Fading:near 3070 BF_Ghost_Fading: 3071 3072 prologue 3073 mov ebx , eax ; width 3074 3075 ; NOTE: the below calculation assumes a group of instructions is 3076 ; less than 256 bytes 3077 3078 ; get length of the 32 groups of instructions 3079 3080 lea ecx , [ offset ghost_f_reference ] 3081 sub ecx, [ offset ghost_f_line ] 3082 3083 shr ebx , 5 ; width / 32 3084 shr ecx , 5 ; length of instructions / 32 3085 and eax , 01fh ; mod of width / 32 3086 mul cl ; calc offset to start of group 3087 neg eax ; inverse of width 3088 mov [ loop_cnt ] , ebx ; save width / 32 3089 lea ecx , [ ghost_f_reference + eax ] 3090 mov eax , 0 3091 mov [ jmp_loc ] , ecx 3092 3093 ghost_f_loop: 3094 mov ecx , [ loop_cnt ] 3095 mov [ StashECX ] , ecx ; preserve ecx for later 3096 jmp [ jmp_loc ] 3097 3098 ghost_f_line_begin: 3099 mov [ StashECX ] , ecx ; preserve ecx for later 3100 3101 ghost_f_line: 3102 3103 REPT 32 3104 local store_pixel 3105 local do_fading 3106 local fade_loop 3107 mov al , [ esi ] 3108 inc esi 3109 mov ebx , [ IsTranslucent ] ; is it a lucent color? 3110 mov bh , byte ptr [ ebx + eax ] 3111 cmp bh , 0ffh 3112 je do_fading 3113 3114 and ebx , 0FF00h ; clear all of ebx except bh 3115 ; we have the index to the lation table 3116 ; ((_colour * 256) + dest colour) 3117 mov al , [ edi ] ; mov pixel at destination to al 3118 add ebx , [ Translucent ] ; get the ptr to it! 3119 ; Add the (_color * 256) of the lation equ. 3120 mov al , byte ptr [ ebx + eax ] ; get new pixel in al 3121 ; DRD jmp store_pixel 3122 3123 do_fading: 3124 mov ebx , [ FadingTable ] ; run color through fading table 3125 mov ecx , [ FadingNum ] 3126 3127 fade_loop: 3128 mov al, byte ptr [ebx + eax] 3129 dec ecx 3130 jnz fade_loop 3131 3132 store_pixel: 3133 mov [ edi ] , al 3134 inc edi 3135 3136 ENDM 3137 3138 ghost_f_reference: 3139 mov ecx , [ StashECX ] ; restore ecx for main draw loop 3140 dec ecx 3141 jge ghost_f_line_begin 3142 3143 add esi , [ scr_adjust_width ] 3144 add edi , [ dest_adjust_width ] 3145 dec edx 3146 jnz ghost_f_loop 3147 3148 epilogue 3149 ret 3150 3151 3152 ;******************************************************************** 3153 ;******************************************************************** 3154 3155 ;extern BF_Ghost_Fading_Trans:near 3156 BF_Ghost_Fading_Trans: 3157 3158 prologue 3159 mov ebx , eax ; width 3160 3161 ; NOTE: the below calculation assumes a group of instructions is 3162 ; less than 256 bytes 3163 3164 ; get length of the 32 groups of instructions 3165 3166 lea ecx , [ offset ghost_f_t_reference ] 3167 sub ecx, [ offset ghost_f_t_line ] 3168 3169 shr ebx , 5 ; width / 32 3170 shr ecx , 5 ; length of instructions / 32 3171 and eax , 01fh ; mod of width / 32 3172 mul cl ; calc offset to start of group 3173 neg eax ; inverse of width 3174 mov [ loop_cnt ] , ebx ; save width / 32 3175 lea ecx , [ ghost_f_t_reference + eax ] 3176 mov eax , 0 3177 mov [ jmp_loc ] , ecx 3178 3179 ghost_f_t_loop: 3180 mov ecx , [ loop_cnt ] 3181 mov [ StashECX ] , ecx ; preserve ecx for later 3182 jmp [ jmp_loc ] 3183 3184 ghost_f_t_line_begin: 3185 mov [ StashECX ] , ecx ; preserve ecx for later 3186 3187 ghost_f_t_line: 3188 3189 REPT 32 3190 local transp_pixel 3191 local store_pixel 3192 local do_fading 3193 local fade_loop 3194 mov al , [ esi ] 3195 inc esi 3196 test al , al 3197 jz transp_pixel 3198 3199 mov ebx , [ IsTranslucent ] ; is it a translucent color? 3200 mov bh , byte ptr [ ebx + eax ] 3201 cmp bh , 0ffh 3202 je do_fading 3203 3204 and ebx , 0FF00h ; clear all of ebx except bh 3205 ; we have the index to the translation table 3206 ; ((trans_colour * 256) + dest colour) 3207 mov al , [ edi ] ; mov pixel at destination to al 3208 add ebx , [ Translucent ] ; get the ptr to it! 3209 ; Add the (trans_color * 256) of the translation equ. 3210 mov al , byte ptr [ ebx + eax ] ; get new pixel in al 3211 ; DRD jmp store_pixel 3212 3213 do_fading: 3214 mov ebx , [ FadingTable ] ; run color through fading table 3215 mov ecx , [ FadingNum ] 3216 3217 fade_loop: 3218 mov al, byte ptr [ebx + eax] 3219 dec ecx 3220 jnz fade_loop 3221 3222 store_pixel: 3223 mov [ edi ] , al 3224 3225 transp_pixel: 3226 inc edi 3227 3228 ENDM 3229 3230 ghost_f_t_reference: 3231 mov ecx , [ StashECX ] ; restore ecx for main draw loop 3232 dec ecx 3233 jge ghost_f_t_line_begin 3234 3235 add esi , [ scr_adjust_width ] 3236 add edi , [ dest_adjust_width ] 3237 dec edx 3238 jnz ghost_f_t_loop 3239 3240 epilogue 3241 ret 3242 3243 3244 ;******************************************************************** 3245 ;******************************************************************** 3246 3247 ;extern BF_Predator:near 3248 BF_Predator: 3249 3250 prologue 3251 mov ebx , eax ; width 3252 3253 ; NOTE: the below calculation assumes a group of instructions is 3254 ; less than 256 bytes 3255 3256 ; get length of the 32 groups of instructions 3257 3258 lea ecx , [ offset predator_reference ] 3259 sub ecx, [offset predator_line ] 3260 3261 shr ebx , 5 ; width / 32 3262 shr ecx , 5 ; length of instructions / 32 3263 and eax , 01fh ; mod of width / 32 3264 mul cl ; calc offset to start of group 3265 neg eax ; inverse of width 3266 mov [ loop_cnt ] , ebx ; save width / 32 3267 lea ecx , [ predator_reference + eax ] 3268 mov eax , 0 3269 mov [ jmp_loc ] , ecx 3270 3271 predator_loop: 3272 mov ecx , [ loop_cnt ] 3273 jmp [ jmp_loc ] 3274 3275 predator_line: 3276 3277 REPT 32 3278 local get_pred 3279 local skip_pixel 3280 mov al , [ esi ] 3281 inc esi 3282 mov ebx , [ BFPartialCount ] 3283 add ebx , [ BFPartialPred ] 3284 or bh , bh 3285 jnz get_pred ; is this a predator pixel? 3286 3287 mov [ BFPartialCount ] , ebx 3288 jmp skip_pixel 3289 3290 get_pred: 3291 xor bh , bh 3292 mov eax, [ BFPredOffset ] 3293 mov [ BFPartialCount ] , ebx 3294 add BYTE PTR [ BFPredOffset ] , 2 3295 movzx eax , WORD PTR [ BFPredTable + eax ] 3296 and BYTE PTR [ BFPredOffset ] , PRED_MASK 3297 ; pick up a color offset a pseudo- 3298 ; random amount from the current 3299 movzx eax , BYTE PTR [ edi + eax ] ; viewport address 3300 3301 ; xor bh , bh 3302 ; mov eax , [ BFPredValue ] ; pick up a color offset a pseudo- 3303 ; ; random amount from the current 3304 ; mov [ BFPartialCount ] , ebx 3305 ; mov al , [ edi + eax ] ; viewport address 3306 3307 mov [ edi ] , al 3308 3309 skip_pixel: 3310 inc edi 3311 3312 ENDM 3313 3314 predator_reference: 3315 dec ecx 3316 jge predator_line 3317 3318 add esi , [ scr_adjust_width ] 3319 add edi , [ dest_adjust_width ] 3320 dec edx 3321 jnz predator_loop 3322 3323 epilogue 3324 ret 3325 3326 3327 ;******************************************************************** 3328 ;******************************************************************** 3329 3330 ;extern BF_Predator_Trans:near 3331 BF_Predator_Trans: 3332 3333 prologue 3334 mov ebx , eax ; width 3335 3336 ; NOTE: the below calculation assumes a group of instructions is 3337 ; less than 256 bytes 3338 3339 ; get length of the 32 groups of instructions 3340 3341 lea ecx , [ offset predator_t_reference ] 3342 sub ecx, [ offset predator_t_line ] 3343 3344 shr ebx , 5 ; width / 32 3345 shr ecx , 5 ; length of instructions / 32 3346 and eax , 01fh ; mod of width / 32 3347 mul cl ; calc offset to start of group 3348 neg eax ; inverse of width 3349 mov [ loop_cnt ] , ebx ; save width / 32 3350 lea ecx , [ predator_t_reference + eax ] 3351 mov eax , 0 3352 mov [ jmp_loc ] , ecx 3353 3354 predator_t_loop: 3355 mov ecx , [ loop_cnt ] 3356 jmp [ jmp_loc ] 3357 3358 predator_t_line: 3359 3360 REPT 32 3361 local trans_pixel 3362 local get_pred 3363 local store_pixel 3364 mov al , [ esi ] 3365 inc esi 3366 test al , al 3367 jz trans_pixel 3368 3369 mov ebx , [ BFPartialCount ] 3370 add ebx , [ BFPartialPred ] 3371 or bh , bh 3372 jnz get_pred ; is this a predator pixel? 3373 3374 mov [ BFPartialCount ] , ebx 3375 jmp store_pixel 3376 3377 get_pred: 3378 xor bh , bh 3379 mov eax, [ BFPredOffset ] 3380 mov [ BFPartialCount ] , ebx 3381 add BYTE PTR [ BFPredOffset ] , 2 3382 movzx eax , WORD PTR [ BFPredTable + eax ] 3383 and BYTE PTR [ BFPredOffset ] , PRED_MASK 3384 ; pick up a color offset a pseudo- 3385 ; random amount from the current 3386 movzx eax , BYTE PTR [ edi + eax ] ; viewport address 3387 3388 store_pixel: 3389 mov [ edi ] , al 3390 3391 trans_pixel: 3392 inc edi 3393 3394 ENDM 3395 3396 predator_t_reference: 3397 dec ecx 3398 jge predator_t_line 3399 3400 add esi , [ scr_adjust_width ] 3401 add edi , [ dest_adjust_width ] 3402 dec edx 3403 jnz predator_t_loop 3404 3405 epilogue 3406 ret 3407 3408 3409 ;******************************************************************** 3410 ;******************************************************************** 3411 3412 ;extern BF_Predator_Ghost:near 3413 BF_Predator_Ghost: 3414 3415 prologue 3416 mov ebx , eax ; width 3417 3418 ; NOTE: the below calculation assumes a group of instructions is 3419 ; less than 256 bytes 3420 3421 ; get length of the 32 groups of instructions 3422 3423 lea ecx , [ offset predator_g_reference ] 3424 sub ecx, [ offset predator_g_line ] 3425 3426 shr ebx , 5 ; width / 32 3427 shr ecx , 5 ; length of instructions / 32 3428 and eax , 01fh ; mod of width / 32 3429 mul cl ; calc offset to start of group 3430 neg eax ; inverse of width 3431 mov [ loop_cnt ] , ebx ; save width / 32 3432 lea ecx , [ predator_g_reference + eax ] 3433 mov eax , 0 3434 mov [ jmp_loc ] , ecx 3435 3436 predator_g_loop: 3437 mov ecx , [ loop_cnt ] 3438 jmp [ jmp_loc ] 3439 3440 predator_g_line: 3441 3442 REPT 32 3443 local get_pred 3444 local check_ghost 3445 local store_pixel 3446 mov al , [ esi ] 3447 mov ebx , [ BFPartialCount ] 3448 inc esi 3449 add ebx , [ BFPartialPred ] 3450 or bh , bh 3451 jnz get_pred ; is this a predator pixel? 3452 3453 mov [ BFPartialCount ] , ebx 3454 jmp check_ghost 3455 3456 get_pred: 3457 xor bh , bh 3458 mov eax, [ BFPredOffset ] 3459 mov [ BFPartialCount ] , ebx 3460 add BYTE PTR [ BFPredOffset ] , 2 3461 movzx eax , WORD PTR [ BFPredTable + eax ] 3462 and BYTE PTR [ BFPredOffset ] , PRED_MASK 3463 ; pick up a color offset a pseudo- 3464 ; random amount from the current 3465 movzx eax , BYTE PTR [ edi + eax ] ; viewport address 3466 3467 check_ghost: 3468 mov ebx , [ IsTranslucent ] ; is it a translucent color? 3469 mov bh , BYTE PTR [ ebx + eax ] 3470 cmp bh , 0ffh 3471 je store_pixel 3472 3473 and ebx , 0FF00h ; clear all of ebx except bh 3474 ; we have the index to the translation table 3475 ; ((trans_colour * 256) + dest colour) 3476 mov al , [ edi ] ; mov pixel at destination to al 3477 add ebx , [ Translucent ] ; get the ptr to it! 3478 ; Add the (trans_color * 256) of the translation equ. 3479 mov al , BYTE PTR [ ebx + eax ] ; get new pixel in al 3480 3481 store_pixel: 3482 mov [ edi ] , al 3483 inc edi 3484 3485 ENDM 3486 3487 predator_g_reference: 3488 dec ecx 3489 jge predator_g_line 3490 3491 add esi , [ scr_adjust_width ] 3492 add edi , [ dest_adjust_width ] 3493 dec edx 3494 jnz predator_g_loop 3495 3496 epilogue 3497 ret 3498 3499 3500 ;******************************************************************** 3501 ;******************************************************************** 3502 3503 ;extern BF_Predator_Ghost_Trans:near 3504 BF_Predator_Ghost_Trans: 3505 3506 prologue 3507 mov ebx , eax ; width 3508 3509 ; NOTE: the below calculation assumes a group of instructions is 3510 ; less than 256 bytes 3511 3512 ; get length of the 32 groups of instructions 3513 3514 lea ecx , [ offset predator_g_t_reference ] 3515 sub ecx, [ offset predator_g_t_line ] 3516 3517 shr ebx , 5 ; width / 32 3518 shr ecx , 5 ; length of instructions / 32 3519 and eax , 01fh ; mod of width / 32 3520 mul cl ; calc offset to start of group 3521 neg eax ; inverse of width 3522 mov [ loop_cnt ] , ebx ; save width / 32 3523 lea ecx , [ predator_g_t_reference + eax ] 3524 mov eax , 0 3525 mov [ jmp_loc ] , ecx 3526 3527 predator_g_t_loop: 3528 mov ecx , [ loop_cnt ] 3529 jmp [ jmp_loc ] 3530 3531 predator_g_t_line: 3532 3533 REPT 32 3534 local trans_pixel 3535 local get_pred 3536 local check_ghost 3537 local store_pixel 3538 mov al , [ esi ] 3539 inc esi 3540 test al , al 3541 jz trans_pixel 3542 3543 mov ebx , [ BFPartialCount ] 3544 add ebx , [ BFPartialPred ] 3545 or bh , bh 3546 jnz get_pred ; is this a predator pixel? 3547 3548 mov [ BFPartialCount ] , ebx 3549 jmp check_ghost 3550 3551 get_pred: 3552 xor bh , bh 3553 mov eax, [ BFPredOffset ] 3554 mov [ BFPartialCount ] , ebx 3555 add BYTE PTR [ BFPredOffset ] , 2 3556 movzx eax , WORD PTR [ BFPredTable + eax ] 3557 and BYTE PTR [ BFPredOffset ] , PRED_MASK 3558 ; pick up a color offset a pseudo- 3559 ; random amount from the current 3560 movzx eax , BYTE PTR [ edi + eax ] ; viewport address 3561 3562 check_ghost: 3563 mov ebx , [ IsTranslucent ] ; is it a translucent color? 3564 mov bh , BYTE PTR [ ebx + eax ] 3565 cmp bh , 0ffh 3566 je store_pixel 3567 3568 and ebx , 0FF00h ; clear all of ebx except bh 3569 ; we have the index to the translation table 3570 ; ((trans_colour * 256) + dest colour) 3571 mov al , [ edi ] ; mov pixel at destination to al 3572 add ebx , [ Translucent ] ; get the ptr to it! 3573 ; Add the (trans_color * 256) of the translation equ. 3574 mov al , BYTE PTR [ ebx + eax ] ; get new pixel in al 3575 3576 store_pixel: 3577 mov [ edi ] , al 3578 3579 trans_pixel: 3580 inc edi 3581 3582 ENDM 3583 3584 predator_g_t_reference: 3585 dec ecx 3586 jge predator_g_t_line 3587 3588 add esi , [ scr_adjust_width ] 3589 add edi , [ dest_adjust_width ] 3590 dec edx 3591 jnz predator_g_t_loop 3592 3593 epilogue 3594 ret 3595 3596 3597 ;******************************************************************** 3598 ;******************************************************************** 3599 3600 ;extern BF_Predator_Fading:near 3601 BF_Predator_Fading: 3602 3603 prologue 3604 mov ebx , eax ; width 3605 3606 ; NOTE: the below calculation assumes a group of instructions is 3607 ; less than 256 bytes 3608 3609 ; get length of the 32 groups of instructions 3610 3611 lea ecx , [ offset predator_f_reference ] 3612 sub ecx, [ offset predator_f_line ] 3613 3614 shr ebx , 5 ; width / 32 3615 shr ecx , 5 ; length of instructions / 32 3616 and eax , 01fh ; mod of width / 32 3617 mul cl ; calc offset to start of group 3618 neg eax ; inverse of width 3619 mov [ loop_cnt ] , ebx ; save width / 32 3620 lea ecx , [ predator_f_reference + eax ] 3621 mov eax , 0 3622 mov [ jmp_loc ] , ecx 3623 3624 predator_f_loop: 3625 mov ecx , [ loop_cnt ] 3626 mov [ StashECX ] , ecx ; preserve ecx for later 3627 jmp [ jmp_loc ] 3628 3629 predator_f_line_begin: 3630 mov [ StashECX ] , ecx ; preserve ecx for later 3631 3632 predator_f_line: 3633 3634 REPT 32 3635 local get_pred 3636 local do_fading 3637 local fade_loop 3638 mov al , [ esi ] 3639 mov ebx , [ BFPartialCount ] 3640 inc esi 3641 add ebx , [ BFPartialPred ] 3642 or bh , bh 3643 jnz get_pred ; is this a predator pixel? 3644 3645 mov [ BFPartialCount ] , ebx 3646 jmp do_fading 3647 3648 get_pred: 3649 xor bh , bh 3650 mov eax, [ BFPredOffset ] 3651 mov [ BFPartialCount ] , ebx 3652 add BYTE PTR [ BFPredOffset ] , 2 3653 movzx eax , WORD PTR [ BFPredTable + eax ] 3654 and BYTE PTR [ BFPredOffset ] , PRED_MASK 3655 ; pick up a color offset a pseudo- 3656 ; random amount from the current 3657 movzx eax , BYTE PTR [ edi + eax ] ; viewport address 3658 3659 do_fading: 3660 mov ebx , [ FadingTable ] ; run color through fading table 3661 mov ecx , [ FadingNum ] 3662 3663 fade_loop: 3664 mov al, byte ptr [ebx + eax] 3665 dec ecx 3666 jnz fade_loop 3667 3668 mov [ edi ] , al 3669 inc edi 3670 3671 ENDM 3672 3673 predator_f_reference: 3674 mov ecx , [ StashECX ] ; restore ecx for main draw loop 3675 dec ecx 3676 jge predator_f_line_begin 3677 3678 add esi , [ scr_adjust_width ] 3679 add edi , [ dest_adjust_width ] 3680 dec edx 3681 jnz predator_f_loop 3682 3683 epilogue 3684 ret 3685 3686 3687 ;******************************************************************** 3688 ;******************************************************************** 3689 3690 ;extern BF_Predator_Fading_Trans:near 3691 BF_Predator_Fading_Trans: 3692 3693 prologue 3694 mov ebx , eax ; width 3695 3696 ; NOTE: the below calculation assumes a group of instructions is 3697 ; less than 256 bytes 3698 3699 ; get length of the 32 groups of instructions 3700 3701 lea ecx , [ offset predator_f_t_reference ] 3702 sub ecx, [ offset predator_f_t_line ] 3703 3704 shr ebx , 5 ; width / 32 3705 shr ecx , 5 ; length of instructions / 32 3706 and eax , 01fh ; mod of width / 32 3707 mul cl ; calc offset to start of group 3708 neg eax ; inverse of width 3709 mov [ loop_cnt ] , ebx ; save width / 32 3710 lea ecx , [ predator_f_t_reference + eax ] 3711 mov eax , 0 3712 mov [ jmp_loc ] , ecx 3713 3714 predator_f_t_loop: 3715 mov ecx , [ loop_cnt ] 3716 mov [ StashECX ] , ecx ; preserve ecx for later 3717 jmp [ jmp_loc ] 3718 3719 predator_f_t_line_begin: 3720 mov [ StashECX ] , ecx ; preserve ecx for later 3721 3722 predator_f_t_line: 3723 3724 REPT 32 3725 local trans_pixel 3726 local get_pred 3727 local do_fading 3728 local fade_loop 3729 mov al , [ esi ] 3730 inc esi 3731 test al , al 3732 jz trans_pixel 3733 3734 mov ebx , [ BFPartialCount ] 3735 add ebx , [ BFPartialPred ] 3736 or bh , bh 3737 jnz get_pred ; is this a predator pixel? 3738 3739 mov [ BFPartialCount ] , ebx 3740 jmp do_fading 3741 3742 get_pred: 3743 xor bh , bh 3744 mov eax, [ BFPredOffset ] 3745 mov [ BFPartialCount ] , ebx 3746 add BYTE PTR [ BFPredOffset ] , 2 3747 movzx eax , WORD PTR [ BFPredTable + eax ] 3748 and BYTE PTR [ BFPredOffset ] , PRED_MASK 3749 ; pick up a color offset a pseudo- 3750 ; random amount from the current 3751 movzx eax , BYTE PTR [ edi + eax ] ; viewport address 3752 3753 do_fading: 3754 mov ebx , [ FadingTable ] ; run color through fading table 3755 mov ecx , [ FadingNum ] 3756 3757 fade_loop: 3758 mov al, byte ptr [ebx + eax] 3759 dec ecx 3760 jnz fade_loop 3761 3762 mov [ edi ] , al 3763 3764 trans_pixel: 3765 inc edi 3766 3767 ENDM 3768 3769 predator_f_t_reference: 3770 mov ecx , [ StashECX ] ; restore ecx for main draw loop 3771 dec ecx 3772 jge predator_f_t_line_begin 3773 3774 add esi , [ scr_adjust_width ] 3775 add edi , [ dest_adjust_width ] 3776 dec edx 3777 jnz predator_f_t_loop 3778 3779 epilogue 3780 ret 3781 3782 3783 ;******************************************************************** 3784 ;******************************************************************** 3785 3786 ;extern BF_Predator_Ghost_Fading:near 3787 BF_Predator_Ghost_Fading: 3788 3789 prologue 3790 mov ebx , eax ; width 3791 3792 ; NOTE: the below calculation assumes a group of instructions is 3793 ; less than 256 bytes 3794 3795 ; get length of the 32 groups of instructions 3796 3797 lea ecx , [ offset predator_g_f_reference ] 3798 sub ecx, [ offset predator_g_f_line ] 3799 3800 shr ebx , 5 ; width / 32 3801 shr ecx , 5 ; length of instructions / 32 3802 and eax , 01fh ; mod of width / 32 3803 mul cl ; calc offset to start of group 3804 neg eax ; inverse of width 3805 mov [ loop_cnt ] , ebx ; save width / 32 3806 lea ecx , [ predator_g_f_reference + eax ] 3807 mov eax , 0 3808 mov [ jmp_loc ] , ecx 3809 3810 predator_g_f_loop: 3811 mov ecx , [ loop_cnt ] 3812 mov [ StashECX ] , ecx ; preserve ecx for later 3813 jmp [ jmp_loc ] 3814 3815 predator_g_f_line_begin: 3816 mov [ StashECX ] , ecx ; preserve ecx for later 3817 3818 predator_g_f_line: 3819 3820 REPT 32 3821 local get_pred 3822 local check_ghost 3823 local store_pixel 3824 local do_fading 3825 local fade_loop 3826 mov al , [ esi ] 3827 mov ebx , [ BFPartialCount ] 3828 inc esi 3829 add ebx , [ BFPartialPred ] 3830 or bh , bh 3831 jnz get_pred ; is this a predator pixel? 3832 3833 mov [ BFPartialCount ] , ebx 3834 jmp check_ghost 3835 3836 get_pred: 3837 xor bh , bh 3838 mov eax, [ BFPredOffset ] 3839 mov [ BFPartialCount ] , ebx 3840 add BYTE PTR [ BFPredOffset ] , 2 3841 movzx eax , WORD PTR [ BFPredTable + eax ] 3842 and BYTE PTR [ BFPredOffset ] , PRED_MASK 3843 ; pick up a color offset a pseudo- 3844 ; random amount from the current 3845 movzx eax , BYTE PTR [ edi + eax ] ; viewport address 3846 3847 check_ghost: 3848 mov ebx , [ IsTranslucent ] ; is it a translucent color? 3849 mov bh , BYTE PTR [ ebx + eax ] 3850 cmp bh , 0ffh 3851 je do_fading 3852 3853 and ebx , 0FF00h ; clear all of ebx except bh 3854 ; we have the index to the translation table 3855 ; ((trans_colour * 256) + dest colour) 3856 mov al , [ edi ] ; mov pixel at destination to al 3857 add ebx , [ Translucent ] ; get the ptr to it! 3858 ; Add the (trans_color * 256) of the translation equ. 3859 mov al , BYTE PTR [ ebx + eax ] ; get new pixel in al 3860 ; DRD jmp store_pixel 3861 3862 do_fading: 3863 mov ebx , [ FadingTable ] ; run color through fading table 3864 mov ecx , [ FadingNum ] 3865 3866 fade_loop: 3867 mov al, byte ptr [ebx + eax] 3868 dec ecx 3869 jnz fade_loop 3870 3871 store_pixel: 3872 mov [ edi ] , al 3873 inc edi 3874 3875 ENDM 3876 3877 predator_g_f_reference: 3878 mov ecx , [ StashECX ] ; restore ecx for main draw loop 3879 dec ecx 3880 jge predator_g_f_line_begin 3881 3882 add esi , [ scr_adjust_width ] 3883 add edi , [ dest_adjust_width ] 3884 dec edx 3885 jnz predator_g_f_loop 3886 3887 epilogue 3888 ret 3889 3890 3891 ;******************************************************************** 3892 ;******************************************************************** 3893 3894 ;extern BF_Predator_Ghost_Fading_Trans:near 3895 BF_Predator_Ghost_Fading_Trans: 3896 3897 prologue 3898 mov ebx , eax ; width 3899 3900 ; NOTE: the below calculation assumes a group of instructions is 3901 ; less than 256 bytes 3902 3903 ; get length of the 32 groups of instructions 3904 3905 lea ecx , [ offset predator_g_f_t_reference ] 3906 sub ecx, [ offset predator_g_f_t_line ] 3907 3908 shr ebx , 5 ; width / 32 3909 shr ecx , 5 ; length of instructions / 32 3910 and eax , 01fh ; mod of width / 32 3911 mul cl ; calc offset to start of group 3912 neg eax ; inverse of width 3913 mov [ loop_cnt ] , ebx ; save width / 32 3914 lea ecx , [ predator_g_f_t_reference + eax ] 3915 mov eax , 0 3916 mov [ jmp_loc ] , ecx 3917 3918 predator_g_f_t_loop: 3919 mov ecx , [ loop_cnt ] 3920 mov [ StashECX ] , ecx ; preserve ecx for later 3921 jmp [ jmp_loc ] 3922 3923 predator_g_f_t_line_begin: 3924 mov [ StashECX ] , ecx ; preserve ecx for later 3925 3926 predator_g_f_t_line: 3927 3928 REPT 32 3929 local trans_pixel 3930 local get_pred 3931 local check_ghost 3932 local store_pixel 3933 local do_fading 3934 local fade_loop 3935 mov al , [ esi ] 3936 inc esi 3937 test al , al 3938 jz trans_pixel 3939 3940 mov ebx , [ BFPartialCount ] 3941 add ebx , [ BFPartialPred ] 3942 or bh , bh 3943 jnz get_pred ; is this a predator pixel? 3944 3945 mov [ BFPartialCount ] , ebx 3946 jmp check_ghost 3947 3948 get_pred: 3949 xor bh , bh 3950 mov eax, [ BFPredOffset ] 3951 mov [ BFPartialCount ] , ebx 3952 add BYTE PTR [ BFPredOffset ] , 2 3953 movzx eax , WORD PTR [ BFPredTable + eax ] 3954 and BYTE PTR [ BFPredOffset ] , PRED_MASK 3955 ; pick up a color offset a pseudo- 3956 ; random amount from the current 3957 movzx eax , BYTE PTR [ edi + eax ] ; viewport address 3958 3959 check_ghost: 3960 mov ebx , [ IsTranslucent ] ; is it a translucent color? 3961 mov bh , BYTE PTR [ ebx + eax ] 3962 cmp bh , 0ffh 3963 je do_fading 3964 3965 and ebx , 0FF00h ; clear all of ebx except bh 3966 ; we have the index to the translation table 3967 ; ((trans_colour * 256) + dest colour) 3968 mov al , [ edi ] ; mov pixel at destination to al 3969 add ebx , [ Translucent ] ; get the ptr to it! 3970 ; Add the (trans_color * 256) of the translation equ. 3971 mov al , BYTE PTR [ ebx + eax ] ; get new pixel in al 3972 ; DRD jmp store_pixel 3973 3974 do_fading: 3975 mov ebx , [ FadingTable ] ; run color through fading table 3976 mov ecx , [ FadingNum ] 3977 3978 fade_loop: 3979 mov al, byte ptr [ebx + eax] 3980 dec ecx 3981 jnz fade_loop 3982 3983 store_pixel: 3984 mov [ edi ] , al 3985 3986 trans_pixel: 3987 inc edi 3988 3989 ENDM 3990 3991 predator_g_f_t_reference: 3992 mov ecx , [ StashECX ] ; restore ecx for main draw loop 3993 dec ecx 3994 jge predator_g_f_t_line_begin 3995 3996 add esi , [ scr_adjust_width ] 3997 add edi , [ dest_adjust_width ] 3998 dec edx 3999 jnz predator_g_f_t_loop 4000 4001 epilogue 4002 ret 4003 4004 4005 ;******************************************************************** 4006 ;******************************************************************** 4007 4008 Not_Supported: 4009 ret 4010 4011 Buffer_Frame_To_Page ENDP 4012 4013 4014 end 4015