KEYFBUFF.ASM 118 KB

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