2KEYFBUF.ASM 118 KB

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