From 9599894a4b2f79672fc3e2ca5a93ef9c7d457c08 Mon Sep 17 00:00:00 2001 From: Vladimir Menshakov Date: Wed, 15 Jun 2011 17:53:45 +0400 Subject: DREAMWEB: Added original sources. Released with permission from Neil Dodwell. --- devtools/tasmrecover/.gitignore | 1 - devtools/tasmrecover/dreamweb/LICENSE | 339 ++ devtools/tasmrecover/dreamweb/backdrop.asm | 877 ++++ devtools/tasmrecover/dreamweb/debug.asm | 382 ++ devtools/tasmrecover/dreamweb/dreamweb.asm | 6262 ++++++++++++++++++++++++++++ devtools/tasmrecover/dreamweb/keypad.asm | 1758 ++++++++ devtools/tasmrecover/dreamweb/look.asm | 167 + devtools/tasmrecover/dreamweb/monitor.asm | 1496 +++++++ devtools/tasmrecover/dreamweb/newplace.asm | 581 +++ devtools/tasmrecover/dreamweb/object.asm | 2608 ++++++++++++ devtools/tasmrecover/dreamweb/print.asm | 591 +++ devtools/tasmrecover/dreamweb/saveload.asm | 1495 +++++++ devtools/tasmrecover/dreamweb/sblaster.asm | 1293 ++++++ devtools/tasmrecover/dreamweb/sprite.asm | 5034 ++++++++++++++++++++++ devtools/tasmrecover/dreamweb/talk.asm | 580 +++ devtools/tasmrecover/dreamweb/titles.asm | 583 +++ devtools/tasmrecover/dreamweb/use.asm | 3810 +++++++++++++++++ devtools/tasmrecover/dreamweb/vars.asm | 564 +++ devtools/tasmrecover/dreamweb/vgafades.asm | 867 ++++ devtools/tasmrecover/dreamweb/vgagrafx.asm | 1763 ++++++++ 20 files changed, 31050 insertions(+), 1 deletion(-) create mode 100644 devtools/tasmrecover/dreamweb/LICENSE create mode 100644 devtools/tasmrecover/dreamweb/backdrop.asm create mode 100644 devtools/tasmrecover/dreamweb/debug.asm create mode 100644 devtools/tasmrecover/dreamweb/dreamweb.asm create mode 100644 devtools/tasmrecover/dreamweb/keypad.asm create mode 100644 devtools/tasmrecover/dreamweb/look.asm create mode 100644 devtools/tasmrecover/dreamweb/monitor.asm create mode 100644 devtools/tasmrecover/dreamweb/newplace.asm create mode 100644 devtools/tasmrecover/dreamweb/object.asm create mode 100644 devtools/tasmrecover/dreamweb/print.asm create mode 100644 devtools/tasmrecover/dreamweb/saveload.asm create mode 100644 devtools/tasmrecover/dreamweb/sblaster.asm create mode 100644 devtools/tasmrecover/dreamweb/sprite.asm create mode 100644 devtools/tasmrecover/dreamweb/talk.asm create mode 100644 devtools/tasmrecover/dreamweb/titles.asm create mode 100644 devtools/tasmrecover/dreamweb/use.asm create mode 100644 devtools/tasmrecover/dreamweb/vars.asm create mode 100644 devtools/tasmrecover/dreamweb/vgafades.asm create mode 100644 devtools/tasmrecover/dreamweb/vgagrafx.asm (limited to 'devtools/tasmrecover') diff --git a/devtools/tasmrecover/.gitignore b/devtools/tasmrecover/.gitignore index c1b0a4c6eb..f2bff8e8d9 100644 --- a/devtools/tasmrecover/.gitignore +++ b/devtools/tasmrecover/.gitignore @@ -1,5 +1,4 @@ *.pyc -dreamweb dreamgen.* _stubs* diff --git a/devtools/tasmrecover/dreamweb/LICENSE b/devtools/tasmrecover/dreamweb/LICENSE new file mode 100644 index 0000000000..d159169d10 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/devtools/tasmrecover/dreamweb/backdrop.asm b/devtools/tasmrecover/dreamweb/backdrop.asm new file mode 100644 index 0000000000..189199db91 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/backdrop.asm @@ -0,0 +1,877 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +;----------------------------------------------Code to draw floor and panel---- + +Blockget proc near + + mov ah,al + mov al,0 + mov ds,backdrop + mov si,blocks + add si,ax + ret + + endp + + + + + + + + + + + + + + + + +;--------------------------------------------------------Background display---- + + + + + + + + +Drawfloor proc near + + push es bx ;in case this was called during + call eraseoldobs ;some sprite update. + call drawflags + call calcmapad + call doblocks + call showallobs + call showallfree + call showallex + call paneltomap + call initrain + mov newobs,0 + pop bx es + ret + + endp + + + + + + + + + + + + + + + + + + +Calcmapad proc near + + call getdimension + + push cx dx + + mov al,11 + sub al,dl + sub al,cl + sub al,cl + cbw + mov bx,8 + mul bx + add ax,mapoffsetx + mov mapadx,ax + pop dx cx + + mov al,10 + sub al,dh + sub al,ch + sub al,ch + cbw + mov bx,8 + mul bx + add ax,mapoffsety + mov mapady,ax + ret + + endp + + + + + + + + + +Getdimension proc near ;Routine finds width, length + ;and top corner of room + + mov es,buffers + mov bx,mapflags + mov ch,0 +dimloop1: call addalong + cmp al,0 + jnz finishdim1 + inc ch + jmp dimloop1 ;ch holds y of top corner + +finishdim1: mov bx,mapflags + mov cl,0 +dimloop2: push bx + call addlength + pop bx + cmp al,0 + jnz finishdim2 + inc cl + add bx,3 + jmp dimloop2 ;cl holds x of top corner + +finishdim2: mov bx,mapflags+(11*3*9) + mov dh,10 +dimloop3: push bx + call addalong + pop bx + cmp al,0 + jnz finishdim3 + dec dh + sub bx,11*3 + jmp dimloop3 ;dh holds y of bottom corner + +finishdim3: mov bx,mapflags+(3*10) + mov dl,11 +dimloop4: push bx + call addlength + pop bx + cmp al,0 + jnz finishdim4 + dec dl + sub bx,3 + jmp dimloop4 ;dl holds x of bottom corner + +finishdim4: mov al,cl ;cl holds x start + mov ah,0 + shl ax,1 + shl ax,1 + shl ax,1 + shl ax,1 + mov mapxstart,ax + mov al,ch ;ch holds y start + mov ah,0 + shl ax,1 + shl ax,1 + shl ax,1 + shl ax,1 + mov mapystart,ax + + sub dl,cl + sub dh,ch + ;dx holds x and y size of room + mov al,dl ;dl holds x size + mov ah,0 + shl ax,1 + shl ax,1 + shl ax,1 + shl ax,1 + mov mapxsize,al + mov al,dh ;dh holds y size + mov ah,0 + shl ax,1 + shl ax,1 + shl ax,1 + shl ax,1 + mov mapysize,al ;cx still holds top left corner + ret + + endp + + + + + + + + + + + + +Addalong proc near + + mov ah,11 +addloop: cmp byte ptr [es:bx],0 + jnz gotalong + add bx,3 + dec ah + jnz addloop + mov al,0 + ret +gotalong: mov al,1 + ret + + endp + + + + + +Addlength proc near + + mov ah,10 +addloop2: cmp byte ptr [es:bx],0 + jnz gotlength + add bx,3*11 + dec ah + jnz addloop2 + mov al,0 + ret +gotlength: mov al,1 + ret + + endp + + + + + + + + + + + + + + + + + + + + +Drawflags proc near + + mov es,buffers + mov di,mapflags + mov al,mapy + mov ah,0 + mov cx,mapwidth + mul cx + mov bl,mapx + mov bh,0 + add ax,bx + mov si,map + add si,ax + + mov cx,10 +$28: push cx + mov cx,11 +$28a: mov ds,mapdata + lodsb + mov ds,backdrop + push si ax + mov ah,0 + add ax,ax + mov si,flags + add si,ax + movsw + pop ax + stosb + pop si + loop $28a + add si,mapwidth-11 + pop cx + loop $28 + ret + + endp + + + + + + + + + + + + + + +;-------------------------------------------------------Set object printing---- + +Eraseoldobs proc near + + cmp newobs,0 + jz donterase + + mov es,buffers + mov bx,spritetable + + mov cx,16 +oberase: push cx bx + mov ax,[es:bx+20] + cmp ax,0ffffh + jz notthisob + mov di,bx + mov al,255 + mov cx,tablesize + rep stosb +notthisob: pop bx cx + add bx,tablesize + loop oberase + +donterase: ret + + endp + + + + + + + + + + + + + + + + + + + + +Showallobs proc near + + mov es,buffers + mov bx,setlist + mov listpos,bx + mov di,bx + mov cx,128*5 + mov al,255 + rep stosb + + mov es,setframes + mov frsegment,es + mov ax,framedata + mov dataad,ax + mov ax,frames + mov framesad,ax + mov currentob,0 + + mov ds,setdat + mov si,0 + + mov cx,128 +showobsloop: push cx si + + push si + add si,58 + mov es,setdat + call getmapad + pop si + cmp ch,0 + jz blankframe + + mov al,[es:si+18] + mov ah,0 + mov currentframe,ax + cmp al,255 + jz blankframe + + push es si + call calcfrframe + call finalframe + pop si es + + mov al,[es:si+18] + mov [es:si+17],al + cmp byte ptr [es:si+8],0 + jnz animating + cmp byte ptr [es:si+5],5 + jz animating + cmp byte ptr [es:si+5],6 + jz animating + mov ax,currentframe + mov ah,0 + add di,mapadx + add bx,mapady + call showframe + jmp drawnsetob + +animating: call makebackob + +drawnsetob: mov si,listpos + mov es,buffers + mov al,savex + mov ah,savey + mov [es:si],ax + mov cx,ax + mov ax,savesize + add al,cl + add ah,ch + mov [es:si+2],ax + mov al,currentob + mov [es:si+4],al + add si,5 + mov listpos,si + +blankframe: inc currentob + pop si cx + add si,64 + dec cx + jz finishedsetobs + jmp showobsloop + +finishedsetobs: ret + + endp + + + + + + + + + + + + + + +Makebackob proc near + + cmp newobs,0 + jz nomake + + mov al,[es:si+5] ; priority + mov ah,[es:si+8] ; type - steady, constant,random,door etc. + push si ax si + mov ax,objectx + mov bx,objecty + mov ah,bl + mov si,ax + mov cx,offset cs:backobject + mov dx,setframes + mov di,framedata + call makesprite + pop ax + mov [es:bx+20],ax + pop ax + cmp al,255 + jnz usedpriority ; forgotten to specify priority + mov al,0 +usedpriority: mov [es:bx+23],al + mov [es:bx+30],ah + mov byte ptr [es:bx+16],0 + mov byte ptr [es:bx+18],0 + mov byte ptr [es:bx+19],0 + pop si +nomake: ret + + endp + + + + +;------------------------------------------------------Free object printing---- + +Showallfree proc near + + mov es,buffers + mov bx,freelist + mov listpos,bx + mov di,freelist + mov cx,80*5 + mov al,255 + rep stosb + + mov es,freeframes + mov frsegment,es + mov ax,frframedata + mov dataad,ax + mov ax,frframes + mov framesad,ax + mov al,0 + mov currentfree,al + + mov ds,freedat + mov si,2 + + mov cx,0 +loop127: push cx si + + push si + mov es,freedat + call getmapad + pop si + cmp ch,0 + jz over138 + + mov al,currentfree + mov ah,0 + mov dx,ax + add ax,ax + add ax,dx + mov currentframe,ax + + push es si + call calcfrframe + mov es,mapstore + mov ds,frsegment + call finalframe + pop si es + cmp cx,0 + jz over138 + + mov ax,currentframe + mov ah,0 + add di,mapadx + add bx,mapady + call showframe + mov si,listpos + mov es,buffers + mov al,savex + mov ah,savey + mov [es:si],ax + mov cx,ax + mov ax,savesize + add al,cl + add ah,ch + mov [es:si+2],ax + pop ax cx + push cx ax + mov [es:si+4],cl + add si,5 + mov listpos,si + +over138: inc currentfree + pop si cx + add si,16 + inc cx + cmp cx,80 + jz finfree + jmp loop127 + +finfree: ret + + endp + + + + + + + + + + + + +Showallex proc near + + mov es,buffers + mov bx,exlist + mov listpos,bx + mov di,exlist + mov cx,100*5 + mov al,255 + rep stosb + + mov es,extras + mov frsegment,es + mov ax,exframedata + mov dataad,ax + mov ax,exframes + mov framesad,ax + mov currentex,0 + + mov si,exdata+2 + + mov cx,0 +exloop: push cx si + + mov es,extras + + push si + mov ch,0 + cmp byte ptr [es:si],255 + jz notinroom + mov al,[es:si-2] + cmp al,reallocation + jnz notinroom + call getmapad +notinroom: pop si + cmp ch,0 + jz blankex + + mov al,currentex + mov ah,0 + mov dx,ax + add ax,ax + add ax,dx + mov currentframe,ax + + push es si + call calcfrframe + mov es,mapstore + mov ds,frsegment + call finalframe + pop si es + cmp cx,0 + jz blankex + + mov ax,currentframe + mov ah,0 + add di,mapadx + add bx,mapady + call showframe + mov si,listpos + mov es,buffers + mov al,savex + mov ah,savey + mov [es:si],ax + mov cx,ax + mov ax,savesize + add al,cl + add ah,ch + mov [es:si+2],ax + pop ax cx + push cx ax + mov [es:si+4],cl + add si,5 + mov listpos,si + +blankex: inc currentex + pop si cx + add si,16 + inc cx + cmp cx,100 + jz finex + jmp exloop + +finex: ret + + endp + + + + + + + +Calcfrframe proc near + + mov dx,frsegment + mov ax,framesad + push ax + mov cx,dataad + mov ax,currentframe + mov ds,dx + mov bx,6 + mul bx + add ax,cx + mov bx,ax + mov cx,[bx] + mov ax,[bx+2] + mov dx,[bx+4] + pop bx + push dx + add ax,bx ;ax=source add, cx=x,y + ;need this later + mov savesource,ax + mov savesize,cx + pop ax + push ax + mov ah,0 + mov offsetx,ax + pop ax + mov al,ah + mov ah,0 + mov offsety,ax + ret +nullframe: pop ax + mov cx,0 + mov savesize,cx + ret + + endp + + + + + + + + + + + + + + + + + + +Finalframe proc near + + mov ax,objecty + add ax,offsety + mov bx,objectx + add bx,offsetx + mov savex,bl + mov savey,al + mov di,objectx + mov bx,objecty + ret + + endp + + + + + + + + + + + + + +Adjustlen proc near + + mov ah,al + add al,ch + cmp al,100 + jc over242 + mov al,224 + sub al,ch + mov ch,al +over242: ret + + endp + + + + + + + + + +Getmapad proc near + + call getxad + cmp ch,0 + jz over146 + mov objectx,ax + call getyad + cmp ch,0 + jz over146 + mov objecty,ax + mov ch,1 +over146: ret + + endp + + + + + + + + + +Getxad proc near + + mov cl,[es:si] + inc si + mov al,[es:si] + inc si + mov ah,[es:si] + inc si + cmp cl,0 + jnz over148 + sub al,mapx + jc over148 + cmp al,11 + jnc over148 + mov cl,4 + shl al,cl + or al,ah + mov ah,0 + mov ch,1 + ret +over148: mov ch,0 + ret + + endp + + + + + + + + + +Getyad proc near + + mov al,[es:si] + inc si + mov ah,[es:si] + inc si + sub al,mapy + jc over147 + cmp al,10 + jnc over147 + mov cl,4 + shl al,cl + or al,ah + mov ah,0 + mov ch,1 + ret + +over147: mov ch,0 + ret + + endp + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/debug.asm b/devtools/tasmrecover/dreamweb/debug.asm new file mode 100644 index 0000000000..3c24913b2e --- /dev/null +++ b/devtools/tasmrecover/dreamweb/debug.asm @@ -0,0 +1,382 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text + + if debuglevel2 + + +Debugkeys proc near + + ret + + endp + + + +Debugstart proc near + + call allpalette + mov reeltohold,-1 + mov newlocation,23 + mov dreamnumber,0 + mov al,"W" + mov ah,"S" + mov cl,"H" + mov ch,"D" + call findexobject + mov byte ptr [es:bx+12],"S"-"A" + mov byte ptr [es:bx+13],"C"-"A" + mov byte ptr [es:bx+14],"R"-"A" + mov byte ptr [es:bx+15],"W"-"A" + mov al,"W" + mov ah,"E" + mov cl,"T" + mov ch,"A" + call findexobject + mov byte ptr [es:bx+12],"G"-"A" + mov byte ptr [es:bx+13],"U"-"A" + mov byte ptr [es:bx+14],"N"-"A" + mov byte ptr [es:bx+15],"A"-"A" + mov al,"W" + mov ah,"E" + mov cl,"T" + mov ch,"B" + call findexobject + mov byte ptr [es:bx+12],"S"-"A" + mov byte ptr [es:bx+13],"H"-"A" + mov byte ptr [es:bx+14],"L"-"A" + mov byte ptr [es:bx+15],"D"-"A" + mov card1money,12342 + + ret + + endp + + + + + +Debuggreen proc near + + push ax dx + mov al,0 + mov dx,3c8h + out dx,al + mov dx,3c9h + mov al,0 + out dx,al + mov al,63 + out dx,al + mov al,0 + out dx,al + pop dx ax + ret + + endp + + + + + + + + +Debugred proc near + + push ax dx + mov al,0 + mov dx,3c8h + out dx,al + mov dx,3c9h + mov al,63 + out dx,al + mov al,0 + out dx,al + mov al,0 + out dx,al + pop dx ax + ret + + endp + + + + +Debugblue proc near + + push ax dx + mov al,0 + mov dx,3c8h + out dx,al + mov dx,3c9h + mov al,0 + out dx,al + mov al,0 + out dx,al + mov al,63 + out dx,al + pop dx ax + ret + + endp + + + + + +Debugblack proc near + + push dx ax + mov al,0 + mov dx,3c8h + out dx,al + mov dx,3c9h + mov al,0 + out dx,al + mov al,0 + out dx,al + mov al,0 + out dx,al + pop ax dx + ret + + endp + + + + + + + + + + + +Debug proc near + + push ds dx cx + mov ah,3ch + mov cx,0 + mov dx,seg filenamed + mov ds,dx + mov dx,offset filenamed + int 21h + mov bx,ax + pop cx dx ds + push bx + mov ah,40h + int 21h + pop bx + mov ah,3eh + int 21h + ret + +filenamed db "DREAMWEB.TXT",0 + + endp + + + + + + + + +Shout proc near + + push ax bx cx dx si di es ds + call debugblue + mov cx,50 + call hangon + call debugblack + mov cx,10 + call hangon + pop ds es di si dx cx bx ax + ret + + endp + + +Shoutred proc near + + push ax bx cx dx si di es ds + call debugred + mov cx,4 + call hangon + call debugblack + mov cx,40 + call hangon + pop ds es di si dx cx bx ax + ret + + endp + + + +Shoutgreen proc near + + push ax bx cx dx si di es ds + call debuggreen + mov cx,4 + call hangon + call debugblack + mov cx,40 + call hangon + pop ds es di si dx cx bx ax + ret + + endp + + + + + + + + + +;Checkmemingame proc near + +; cmp charset1,0 +; jz nodebug +; mov bx,60000 +; mov ah,48h +; int 21h +; mov ax,bx +; mov cl,6 +; shr ax,cl +; mov di,offset cs:debugtextig +; call showword + +; mov ax,soundbufferwrite +; ;mov ax,exframepos +; mov di,offset cs:debugtextex +; call showword + +; ;mov ax,extextpos +; ;mov di,offset cs:debugtextex2 +; ;call showword + +; push cs +; pop es +; mov si,offset cs:debugtextig +; mov al,0 +; mov ah,0 +; mov dl,100 +; mov di,204 +; mov bx,14 +; call printdirect +; push cs +; pop es +; mov si,offset cs:debugtextex +; mov al,0 +; mov ah,0 +; mov dl,100 +; mov di,204 +; mov bx,22 +; call printdirect +; push cs +; pop es +; mov si,offset cs:debugtextex2 +; mov al,0 +; mov ah,0 +; mov dl,100 +; mov di,204 +; mov bx,30 +; call printdirect +; mov di,204 +; mov bx,14 +; mov cl,40 +; mov ch,24 +; call multidump +;nodebug: ret + + endp + +debugtextig: db "00000K",0 + +debugtextex: db "00000b",0 + +debugtextex2: db "00000b",0 + + + + + + + if recording + + mov ax,recordpos + mov di,offset cs:debugtextr + call showword + + mov al,0 + call print + dw 4,4,100 +debugtextr: db "00000",0 + + mov si,0 + mov di,0 + mov cl,40 + mov ch,12 + call multidump + + endif + + ret + + endp + + + + + + + + + + + + + + + + + + +;Debugax proc near +; +; push ax +; call showpanel +; pop ax +; mov di,offset cs:debugaxtext +; call showword +; +; mov di,204 +; mov bx,14 +; mov al,0 +; mov ah,0 +; mov dl,100 +; push cs +; pop es +; mov si,offset cs:debugaxtext +; call printdirect +; mov di,204 +; mov bx,14 +; mov cl,40 +; mov ch,24 +; call multidump +; ret +; +;debugaxtext db "00000 ",0 +; +; endp + + + + + + + + endif + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/dreamweb.asm b/devtools/tasmrecover/dreamweb/dreamweb.asm new file mode 100644 index 0000000000..2b98b97b34 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/dreamweb.asm @@ -0,0 +1,6262 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text + + + + + + + + + +;ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ +;³ ³ +;³ DREAMWEB ³ +;³ ³ +;³ ³ +;³ ³ +;³ ³ +;³ Written by Neil Dodwell. Graphics by Dave Dew. ³ +;³ ³ +;³ Started on Friday 28 December 1990 at 1:20 pm ³ +;³ ³ +;³ Copyright 1990/1991 Creative Reality ³ ³ +;³ ³ +;³ ³ +;ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ + + + + + + + + + + + + + + + +;----------------------------------------------------------Assembly options---- + +JUMPS + +playback equ 0 +recording equ 0 +debuglevel1 equ 0 ;memory debug on +debuglevel2 equ 0 ;debug keys on+shouts +demo equ 0 +CD equ 1 +Foreign equ 0 +Spanish equ 0 +German equ 0 + +;----------------------------------------------------------------Code start---- + +DREAMWEBPROG segment para public 'CODE' + + assume cs:DREAMWEBPROG,ss:STACKSPACE + + + + +;------------------------------------------------------------------Includes---- + +include \pc\dreamweb\vars.asm ;variables and equates +include \pc\dreamweb\sprite.asm ;sprite routines +include \pc\dreamweb\vgagrafx.asm ;screen routines for vga +include \pc\dreamweb\vgafades.asm ;fade routines +include \pc\dreamweb\titles.asm ;guess! +include \pc\dreamweb\print.asm ;text printing routines +include \pc\dreamweb\object.asm ;pickup +include \pc\dreamweb\backdrop.asm ;draws floor etc. +include \pc\dreamweb\look.asm ;look command +include \pc\dreamweb\talk.asm ;conversations +include \pc\dreamweb\newplace.asm ;travel +include \pc\dreamweb\monitor.asm ;network machine +include \pc\dreamweb\use.asm ;individual use routines +include \pc\dreamweb\keypad.asm ;accept code with keypad +include \pc\dreamweb\saveload.asm ;in game options +include \pc\dreamweb\sblaster.asm + if debuglevel1 +include \pc\dreamweb\debug.asm + else + if debuglevel2 +include \pc\dreamweb\debug.asm + endif + endif + +;-----------------------------------------------------------------Main loop---- + + +Dreamweb proc near + + call seecommandtail + + call checkbasemem + call soundstartup + call setkeyboardint + call setupemm + call allocatebuffers + call setmouse + call fadedos + call gettime + + call clearbuffers + call clearpalette + call set16colpalette + call readsetdata + if demo + call changeroomnums + endif + mov wongame,0 + + mov dx,offset cs:basicsample + call loadsample + call setsoundoff + + if demo + else + call scanfornames + cmp al,0 + jnz dodecisions + endif + + call setmode + call loadpalfromiff + + call titles + call credits + jmp playgame + +dodecisions: call cls + call setmode + call decide + cmp getback,4 + jz mainloop + + call titles + call credits + +playgame: call clearchanges + call setmode + call loadpalfromiff + mov location,255 + mov roomafterdream,1 + if demo + mov newlocation,5 + else + mov newlocation,35 + endif + mov volume,7 + call loadroom + call clearsprites + call initman + call entrytexts + call entryanims + mov destpos,3 + call initialinv + mov lastflag,32 + call startup1 + mov volumeto,0 + mov volumedirection,-1 + mov commandtype,255 + jmp mainloop + +loadnew: if demo + cmp newlocation,27 + jnz not27 + call fadescreendowns + mov cx,260 + call hangon + call clearbeforeload + jmp playgame +not27: + endif + call clearbeforeload + call loadroom + call clearsprites + call initman + call entrytexts + call entryanims + mov newlocation,255 + call startup + mov commandtype,255 + call worktoscreenm + jmp mainloop + +alreadyloaded: mov newlocation,255 + call clearsprites + call initman + call startup + mov commandtype,255 + +mainloop: call screenupdate + cmp wongame,0 + jnz endofgame + cmp mandead,1 + jz gameover + cmp mandead,2 + jz gameover + cmp watchingtime,0 + jz notwatching + mov al,finaldest + cmp al,manspath + jnz mainloop + dec watchingtime + jnz mainloop + +notwatching: cmp mandead,4 + jz gameover + cmp newlocation,255 + jnz loadnew + jmp mainloop + +gameover: if demo + call fadescreendowns + mov cx,260 + call hangon + call clearbeforeload + jmp playgame + endif + call clearbeforeload + call showgun + call fadescreendown + mov cx,100 + call hangon + jmp dodecisions + +endofgame: call clearbeforeload + call fadescreendowns + mov cx,200 + call hangon + call endgame + jmp quickquit2 + + endp + + + + + endp + + + + if demo + +Changeroomnums proc near + + mov di,offset cs:roomdata+10 + mov cx,50 +changenumloop: mov al,[cs:di] + cmp al,"0" + jnz nochange + mov al,[cs:di+1] + cmp al,"5" + jnz nochange + mov al,"6" + mov ah,"0" + mov [cs:di],ax +nochange: add di,32 + loop changenumloop + ret + + endp + + endif + + + + +Entrytexts proc near + + cmp location,21 + jnz notloc15 + mov al,28 + mov cx,60 + mov dx,11 + mov bl,68 + mov bh,64 + call setuptimeduse + ret +notloc15: cmp location,30 + jnz notloc43 + mov al,27 + mov cx,60 + mov dx,11 + mov bl,68 + mov bh,64 + call setuptimeduse + ret +notloc43: cmp location,23 + jnz notloc23 + mov al,29 + mov cx,60 + mov dx,11 + mov bl,68 + mov bh,64 + call setuptimeduse + ret +notloc23: cmp location,31 + jnz notloc44 + mov al,30 + mov cx,60 + mov dx,11 + mov bl,68 + mov bh,64 + call setuptimeduse + ret +notloc44: cmp location,20 + jnz notsarters2 + mov al,31 + mov cx,60 + mov dx,11 + mov bl,68 + mov bh,64 + call setuptimeduse + ret +notsarters2: cmp location,24 + jnz notedenlob + mov al,32 + mov cx,60 + mov dx,3 + mov bl,68 + mov bh,64 + call setuptimeduse + ret +notedenlob: cmp location,34 + jnz noteden2 + mov al,33 + mov cx,60 + mov dx,3 + mov bl,68 + mov bh,64 + call setuptimeduse + ret +noteden2: ret + + endp + + + + + + + + +Entryanims proc near + + mov reeltowatch,-1 + mov watchmode,-1 + cmp location,33 + jnz notinthebeach + call switchryanoff + mov watchingtime,76*2 + mov reeltowatch,0 + mov endwatchreel,76 + mov watchspeed,1 + mov speedcount,1 + ret +notinthebeach: cmp location,44 + jnz notsparkys + mov al,8 + call resetlocation + mov watchingtime,50*2 + mov reeltowatch,247 + mov endwatchreel,297 + mov watchspeed,1 + mov speedcount,1 + call switchryanoff + ret +notsparkys: cmp location,22 + jnz notinthelift + mov watchingtime,31*2 + mov reeltowatch,0 + mov endwatchreel,30 + mov watchspeed,1 + mov speedcount,1 + call switchryanoff + ret +notinthelift: cmp location,26 + jnz notunderchurch + mov symboltopnum,2 + mov symbolbotnum,1 + ret +notunderchurch: cmp location,45 + jnz notenterdream + mov keeperflag,0 + mov watchingtime,296 + mov reeltowatch,45 + mov endwatchreel,198 + mov watchspeed,1 + mov speedcount,1 + call switchryanoff + ret +notenterdream: cmp reallocation,46 + jnz notcrystal + cmp sartaindead,1 + jnz notcrystal + mov al,0 + call removefreeobject + ret +notcrystal: cmp location,9 + jnz nottopchurch + mov al,2 + call checkifpathison + jz nottopchurch + cmp aidedead,0 + jz nottopchurch + mov al,3 + call checkifpathison + jnz makedoorsopen + mov al,2 + call turnpathon +makedoorsopen: mov al,4 + call removesetobject + mov al,5 + call placesetobject + ret +nottopchurch: cmp location,47 + jnz notdreamcentre + mov al,4 + call placesetobject + mov al,5 + call placesetobject + ret +notdreamcentre: cmp location,38 + jnz notcarpark + mov watchingtime,57*2 + mov reeltowatch,4 + mov endwatchreel,57 + mov watchspeed,1 + mov speedcount,1 + call switchryanoff + ret +notcarpark: cmp location,32 + jnz notalley + mov watchingtime,66*2 + mov reeltowatch,0 + mov endwatchreel,66 + mov watchspeed,1 + mov speedcount,1 + call switchryanoff + ret +notalley: cmp location,24 + jnz notedensagain + mov al,2 + mov ah,roomnum + dec ah + call turnanypathon +notedensagain: ret + + endp + + + + + + + if demo +Initialinv proc near + + mov al,11 + mov ah,5 + call pickupob + mov al,12 + mov ah,6 + call pickupob + mov al,13 + mov ah,7 + call pickupob + mov al,14 + mov ah,8 + call pickupob + mov al,18 + mov ah,0 + call pickupob + mov al,19 + mov ah,1 + call pickupob + mov al,20 + mov ah,9 + call pickupob + mov al,16 + mov ah,2 + call pickupob + + mov al,2 + mov ah,4 + call pickupob + + mov al,29 + mov ah,10 + call pickupob + mov al,33 + mov ah,11 + call pickupob + mov al,44 + mov ah,12 + call pickupob + mov card1money,12342 + ret + + endp + else +Initialinv proc near + + cmp reallocation,24 + jz isedens + ret + +isedens: mov al,11 + mov ah,5 + call pickupob + mov al,12 + mov ah,6 + call pickupob + mov al,13 + mov ah,7 + call pickupob + mov al,14 + mov ah,8 + call pickupob + mov al,18 + mov al,18 + mov ah,0 + call pickupob + mov al,19 + mov ah,1 + call pickupob + mov al,20 + mov ah,9 + call pickupob + mov al,16 + mov ah,2 + call pickupob + + mov watchmode,1 + mov reeltohold,0 + mov endofholdreel,6 + mov watchspeed,1 + mov speedcount,1 + call switchryanoff + ret + + endp + + endif + + + + + + + + + + + +Pickupob proc near + + mov lastinvpos,ah + mov objecttype,2 + mov itemframe,al + mov command,al + call getanyad + call transfertoex + ret + + endp + + + + + + + + + + + + + + + +;---------------------------------------------------------Memory allocation---- + + + + +Setupemm proc near + + cmp soundint,255 + jz noneedforemm + call checkforemm + + mov ah,43h ;allocate handle and 160 pages + mov bx,176 ;was 176 + int 67h + cmp ah,0 + jnz emmerror1 ;if there's an error drop to DOS + mov emmhandle,dx + mov ah,41h ;get the page frame base address + int 67h + cmp ah,0 + jnz emmerror1 + mov emmpageframe,bx + mov ax,bx + mov cl,12 + shr ax,cl + mov emmhardwarepage,al +noneedforemm: ret +emmerror1: mov gameerror,1 + jmp quickquit2 + + endp + + + + + + + + +Removeemm proc near + + cmp soundint,255 + jz noneedtoremove + mov ah,45h + mov dx,emmhandle + int 67h +noneedtoremove: ret + + endp + + + + + +Checkforemm proc near + + ret + + endp + + + + +Checkbasemem proc near + + mov bx,howmuchalloc + cmp bx,9360h + jnc enoughmem + mov gameerror,5 + jmp quickquit +enoughmem: ret + + endp + + + +Allocatebuffers proc near + + mov bx,lengthofextra/16 + call allocatemem + mov extras,ax + + call trysoundalloc + mov bx,lengthofmap/16 + call allocatemem + mov mapdata,ax + + call trysoundalloc + mov bx,lengthofbuffer/16 + call allocatemem + mov buffers,ax + + call trysoundalloc + mov bx,freedatlen/16 + call allocatemem + mov freedat,ax + + call trysoundalloc + mov bx,setdatlen/16 + call allocatemem + mov setdat,ax + + call trysoundalloc + mov bx,lenofmapstore/16 + call allocatemem + mov mapstore,ax + + if recording + mov bx,1028 + call allocatemem + mov recordspace,ax + endif + + if playback + mov bx,1028 + call allocatemem + mov recordspace,ax + endif + + call allocatework + + mov bx,2048/16 + call allocatemem + mov sounddata,ax + + mov bx,2048/16 + call allocatemem + mov sounddata2,ax + ret + + endp + + + + + + + + + + +Clearbuffers proc near + + mov es,buffers + mov cx,lengthofbuffer/2 + mov ax,0 + mov di,0 + rep stosw + + mov es,extras + mov cx,lengthofextra/2 + mov ax,0ffffh + mov di,0 + rep stosw + + mov es,buffers + mov di,initialreelrouts + push cs + pop ds + mov si,offset cs:reelroutines + mov cx,lenofreelrouts + rep movsb + + mov es,buffers + mov di,initialvars + push cs + pop ds + mov si,offset cs:startvars + mov cx,lengthofvars + rep movsb + call clearchanges + ret + + endp + + + + + + +Clearchanges proc near + + mov es,buffers + mov cx,numchanges*2 + mov ax,0ffffh + mov di,listofchanges + rep stosw + mov ds,buffers + mov si,initialreelrouts + push cs + pop es + mov di,offset cs:reelroutines + mov cx,lenofreelrouts + rep movsb + + mov ds,buffers + mov si,initialvars + push cs + pop es + mov di,offset cs:startvars + mov cx,lengthofvars + rep movsb + + mov expos,0 + mov exframepos,0 + mov extextpos,0 + mov es,extras + mov cx,lengthofextra/2 + mov ax,0ffffh + mov di,0 + rep stosw + + push cs + pop es + mov di,offset cs:roomscango + mov al,1 + stosb + stosb + mov al,0 + stosb + mov al,1 + stosb + mov ax,0 + mov cx,6 + rep stosw + ret + + endp + + + + + + + +Clearbeforeload proc near ;deallocates variable buffers + ;and clears out fixed ones + cmp roomloaded,1 + jnz noclear + call clearreels + call clearrest + mov roomloaded,0 +noclear: ret + + endp + + + +;Clearnoreels proc near +; +; cmp roomloaded,1 +; jnz noclear2 +; call clearrest +; mov roomloaded,0 +;noclear2: ret +; +; endp + + + + + + +Clearreels proc near + + mov es,reel1 + call deallocatemem + mov es,reel2 + call deallocatemem + mov es,reel3 + call deallocatemem + ret + + endp + + + +Clearrest proc near + + mov es,mapdata + mov cx,maplen/2 + mov ax,0 + mov di,map + rep stosw + + mov es,backdrop + call deallocatemem + mov es,setframes + call deallocatemem + mov es,reels + call deallocatemem + mov es,people + call deallocatemem + mov es,setdesc + call deallocatemem + mov es,blockdesc + call deallocatemem + mov es,roomdesc + call deallocatemem + mov es,freeframes + call deallocatemem + mov es,freedesc + call deallocatemem + ret + + endp + + + + + + +Deallocatemem proc near + + mov ah,49h + int 21h + jc deallerror + ret +deallerror: mov gameerror,4 + jmp quickquit2 + ret + + endp + + + + + + + + +Allocatemem proc near + + add bx,2 + mov ah,48h + int 21h + jc memerror + ret + +memerror: mov gameerror,3 + jmp quickquit2 + + endp + + + + +Seecommandtail proc near + + mov soundbaseadd,220h + mov soundint,5 + mov sounddmachannel,1 + mov brightness,0 + + mov bx,2 + mov ax,[es:bx] + mov dx,es + sub ax,dx + mov howmuchalloc,ax + + mov bx,02ch + mov ax,[es:bx] + push es bx + + mov es,ax + mov bx,0 +findblaster: mov ax,[es:bx] + cmp ax,0 + jz endofenvironment + cmp al,"B" + jnz notblast + cmp ah,"L" + jnz notblast + cmp byte ptr [es:bx+2],"A" + jnz notblast + cmp byte ptr [es:bx+3],"S" + jnz notblast + cmp byte ptr [es:bx+4],"T" + jnz notblast + cmp byte ptr [es:bx+5],"E" + jnz notblast + cmp byte ptr [es:bx+6],"R" + jnz notblast + add bx,7 + call parseblaster + jmp endofenvironment +notblast: inc bx + jmp findblaster + +endofenvironment: pop bx es + mov bx,81h + call parseblaster + ret + + endp + + + +Parseblaster proc near + +lookattail: mov al,[es:bx] + cmp al,0 + jz endtail + cmp al,13 + jz endtail + cmp al,"i" + jz issoundint + cmp al,"I" + jz issoundint + cmp al,"b" + jz isbright + cmp al,"B" + jz isbright + cmp al,"a" + jz isbaseadd + cmp al,"A" + jz isbaseadd + cmp al,"n" + jz isnosound + cmp al,"N" + jz isnosound + cmp al,"d" + jz isdma + cmp al,"D" + jz isdma + inc bx + loop lookattail + ret + +issoundint: mov al,[es:bx+1] + sub al,"0" + mov soundint,al + inc bx + jmp lookattail +isdma: mov al,[es:bx+1] + sub al,"0" + mov sounddmachannel,al + inc bx + jmp lookattail +isbaseadd: push cx + mov al,[es:bx+2] + sub al,"0" + mov ah,0 + mov cl,4 + shl ax,cl + add ax,200h + mov soundbaseadd,ax + pop cx + inc bx + jmp lookattail +isbright: mov brightness,1 + inc bx + jmp lookattail +isnosound: mov soundint,255 + inc bx + jmp lookattail +endtail: ret + + endp + + + + +;-------------------------------------------------------High level routines---- + +Startup proc near + + mov currentkey,0 + mov mainmode,0 + call createpanel + mov newobs,1 + call drawfloor + call showicon + call getunderzoom + call spriteupdate + call printsprites + call undertextline + call reelsonscreen + call atmospheres + ret + + endp + + + + +Startup1 proc near + + + call clearpalette + mov throughdoor,0 + mov currentkey,"0" + mov mainmode,0 + call createpanel + mov newobs,1 + call drawfloor + + call showicon + call getunderzoom + call spriteupdate + call printsprites + call undertextline + call reelsonscreen + call atmospheres + call worktoscreen + call fadescreenup + ret + + endp + + + + + + + + +;--------------------------------------------------Scroll location routines---- + + + + + +Screenupdate proc near + + call newplace + call mainscreen + call animpointer + call showpointer + cmp watchingtime,0 + jnz iswatchingmode + cmp newlocation,255 + jnz finishearly +iswatchingmode: call vsync + call readmouse1 + call dumppointer + call dumptextline + call delpointer + call autolook + call spriteupdate + call watchcount + call zoom + call showpointer + cmp wongame,0 + jnz finishearly + + call vsync + call readmouse2 + call dumppointer + call dumpzoom + call delpointer + call deleverything + call printsprites + call reelsonscreen + call afternewroom + call showpointer + + call vsync + call readmouse3 + call dumppointer + call dumpmap + call dumptimedtext + call delpointer + call showpointer + + call vsync + call readmouse4 + call dumppointer + call dumpwatch + call delpointer + +finishearly: ret + + endp + + + + + + + + + + + + + + + +Watchreel proc near + + cmp reeltowatch,-1 + jz notplayingreel + mov al,manspath + cmp al,finaldest + jnz waitstopwalk + mov al,turntoface + cmp al,facing + jz notwatchpath +waitstopwalk: ret + +notwatchpath: dec speedcount + cmp speedcount,-1 + jnz showwatchreel + mov al,watchspeed + mov speedcount,al + mov ax,reeltowatch + cmp ax,endwatchreel + jnz ismorereel + cmp watchingtime,0 + jnz showwatchreel + mov reeltowatch,-1 + mov watchmode,-1 + cmp reeltohold,-1 + jz nomorereel + mov watchmode,1 + jmp notplayingreel +ismorereel: inc reeltowatch +showwatchreel: mov ax,reeltowatch + mov reelpointer,ax + call plotreel + mov ax,reelpointer + mov reeltowatch,ax + call checkforshake +nomorereel: ret + + +notplayingreel: cmp watchmode,1 + jnz notholdingreel + mov ax,reeltohold + mov reelpointer,ax + call plotreel + ret + +notholdingreel: cmp watchmode,2 + jnz notreleasehold + dec speedcount + cmp speedcount,-1 + jnz notlastspeed2 + mov al,watchspeed + mov speedcount,al + inc reeltohold +notlastspeed2: mov ax,reeltohold + cmp ax,endofholdreel + jnz ismorereel2 + mov reeltohold,-1 + mov watchmode,-1 + mov al,destafterhold + mov destination,al + mov finaldest,al + call autosetwalk + ret +ismorereel2: mov ax,reeltohold + mov reelpointer,ax + call plotreel + ret + +notreleasehold: ret + + endp + + + + + +Checkforshake proc near + + cmp reallocation,26 + jnz notstartshake + cmp ax,104 + jnz notstartshake + mov shakecounter,-1 +notstartshake: ret + + endp + + + + + +Watchcount proc near + + cmp watchon,0 + jz nowatchworn + inc timercount + cmp timercount,9 + jz flashdots + cmp timercount,18 + jz uptime +nowatchworn: ret + +flashdots: mov ax,91*3+21 + mov di,268+4 + mov bx,21 + mov ds,charset1 + call showframe + jmp finishwatch + +uptime: mov timercount,0 + add secondcount,1 + cmp secondcount,60 + jnz finishtime + mov secondcount,0 + inc minutecount + cmp minutecount,60 + jnz finishtime + mov minutecount,0 + inc hourcount + cmp hourcount,24 + jnz finishtime + mov hourcount,0 + +finishtime: call showtime +finishwatch: mov watchdump,1 + ret + + endp + + + +Showtime proc near + + cmp watchon,0 + jz nowatch + + mov al,secondcount + mov cl,0 + call twodigitnum + push ax + mov al,ah + mov ah,0 + add ax,91*3+10 + mov ds,charset1 + mov di,282+5 + mov bx,21 + call showframe + pop ax + mov ah,0 + add ax,91*3+10 + mov ds,charset1 + mov di,282+9 + mov bx,21 + call showframe + + mov al,minutecount + mov cl,0 + call twodigitnum + push ax + mov al,ah + mov ah,0 + add ax,91*3 + mov ds,charset1 + mov di,270+5 + mov bx,21 + call showframe + pop ax + mov ah,0 + add ax,91*3 + mov ds,charset1 + mov di,270+11 + mov bx,21 + call showframe + + mov al,hourcount + mov cl,0 + call twodigitnum + push ax + mov al,ah + mov ah,0 + add ax,91*3 + mov ds,charset1 + mov di,256+5 + mov bx,21 + call showframe + pop ax + mov ah,0 + add ax,91*3 + mov ds,charset1 + mov di,256+11 + mov bx,21 + call showframe + + mov ax,91*3+20 + mov ds,charset1 + mov di,267+5 + mov bx,21 + call showframe +nowatch: ret + + + endp + + + + +Dumpwatch proc near + + cmp watchdump,1 + jnz nodumpwatch + mov di,256 + mov bx,21 + mov cl,40 + mov ch,12 + call multidump + mov watchdump,0 +nodumpwatch: ret + + endp + + + + +Showbyte proc near + + mov dl,al + shr dl,1 + shr dl,1 + shr dl,1 + shr dl,1 + call onedigit + mov [es:di],dl + mov dl,al + and dl,15 + call onedigit + mov [es:di+1],dl + add di,3 + ret + + endp + + +Onedigit proc near + + cmp dl,10 + jnc morethan10 + add dl,"0" + ret +morethan10: sub dl,10 + add dl,"A" + ret + + endp + + + + + +Twodigitnum proc near + + mov ah,cl + dec ah +numloop1: inc ah + sub al,10 + jnc numloop1 + add al,10 + add al,cl + ret + + endp + + + + + +Showword proc near + + mov ch,0 + mov bx,10000 + mov cl,47 +word1: inc cl + sub ax,bx + jnc word1 + add ax,bx + call convnum + mov [cs:di],cl + mov bx,1000 + mov cl,47 +word2: inc cl + sub ax,bx + jnc word2 + add ax,bx + call convnum + mov [cs:di+1],cl + mov bx,100 + mov cl,47 +word3: inc cl + sub ax,bx + jnc word3 + add ax,bx + call convnum + mov [cs:di+2],cl + mov bx,10 + mov cl,47 +word4: inc cl + sub ax,bx + jnc word4 + add ax,bx + call convnum + mov [cs:di+3],cl + add al,48 + mov cl,al + call convnum + mov [cs:di+4],cl + ret + + endp + + + + +Convnum proc near + + cmp ch,0 + jnz noconvnum + cmp cl,"0" + jnz notzeronum + mov cl,32 + jmp noconvnum +notzeronum: mov ch,1 +noconvnum: ret + + endp + + + + + + + + +;---------------------------------------------Handling of pointer on screen---- + +Mainscreen proc near + + mov inmaparea,0 + mov bx,offset cs:mainlist + cmp watchon,1 + jz checkmain + mov bx,offset cs:mainlist2 +checkmain: call checkcoords + cmp walkandexam,0 + jz finishmain + call walkandexamine +finishmain: ret + +mainlist: dw 44,70,32,46,look + dw 0,50,0,180,inventory + dw 226,244,10,26,zoomonoff + dw 226,244,26,40,saveload + dw 240,260,100,124,madmanrun + dw 0,320,0,200,identifyob + dw 0ffffh + +mainlist2: dw 44,70,32,46,look + dw 0,50,0,180,inventory + dw 226+48,244+48,10,26,zoomonoff + dw 226+48,244+48,26,40,saveload + dw 240,260,100,124,madmanrun + dw 0,320,0,200,identifyob + dw 0ffffh + + endp + + + + + + +Madmanrun proc near + + cmp location,14 + jnz identifyob + cmp mapx,22 + jnz identifyob + cmp pointermode,2 + jnz identifyob + cmp madmanflag,0 + jnz identifyob + + cmp commandtype,211 + jz alreadyrun + mov commandtype,211 + mov al,52 + call commandonly +alreadyrun: cmp mousebutton,1 + jnz norun + mov ax,mousebutton + cmp ax,oldbutton + jz norun + mov lastweapon,8 +norun: ret + + endp + + + + + + +Checkcoords proc near + cmp newlocation,255 ;objects keep enumerated even in loading state, fixme + jz loop048 + ret + +loop048: mov ax,[cs:bx] + cmp ax,0ffffh + jz nonefound + push bx + cmp mousex,ax + jl over045 + mov ax,[cs:bx+2] + cmp mousex,ax + jge over045 + mov ax,[cs:bx+4] + cmp mousey,ax + jl over045 + mov ax,[cs:bx+6] + cmp mousey,ax + jge over045 + mov ax,[cs:bx+8] + call ax +finished: pop ax + ret +over045: pop bx + add bx,10 + jmp loop048 +nonefound: ret + + endp + + + + + +;-------------------------------------------Printing of icons during scroll---- + + + + + +Identifyob proc near + + cmp watchingtime,0 + jnz blank + + mov ax,mousex + sub ax,mapadx + cmp ax,22*8 + jc notover1 + call blank + ret + +notover1: mov bx,mousey + sub bx,mapady + cmp bx,20*8 + jc notover2 + call blank + ret + +notover2: mov inmaparea,1 + mov ah,bl + push ax + call findpathofpoint + mov pointerspath,dl + pop ax + push ax + call findfirstpath + mov pointerfirstpath,al + pop ax + + call checkifex + jnz finishidentify + call checkiffree + jnz finishidentify + call checkifperson + jnz finishidentify + call checkifset + jnz finishidentify + + mov ax,mousex + sub ax,mapadx + mov cl,al + mov ax,mousey + sub ax,mapady + mov ch,al + call checkone + cmp al,0 + jz nothingund + ;cmp watchingtime,0 + ;jnz nothingund + cmp mandead,1 + jz nothingund + mov ah,3 + call obname +finishidentify: ret + +nothingund: call blank + ret + + endp + + + + + + + + +Checkifperson proc near + + mov es,buffers + mov bx,peoplelist + mov cx,12 +identifyreel: push cx + + cmp byte ptr [es:bx+4],255 + jz notareelid + + push es bx ax + mov ax,[es:bx+0] + mov reelpointer,ax + call getreelstart + cmp [es:si+2],0ffffh + jnz notblankpers + add si,5 +notblankpers: mov cx,[es:si+2] ;x,y of reel slot + mov ax,[es:si+0] ;frame number + push cx + call getreelframeax + pop cx + add cl,[es:bx+4] + add ch,[es:bx+5] + mov dx,cx + add dl,[es:bx+0] + add dh,[es:bx+1] + pop ax bx es + + cmp al,cl + jc notareelid + cmp ah,ch + jc notareelid + cmp al,dl + jnc notareelid + cmp ah,dh + jnc notareelid + + pop cx + mov ax,[es:bx+2] + mov persondata,ax + mov al,[es:bx+4] + mov ah,5 + call obname + mov al,0 + cmp al,1 + ret + +notareelid: pop cx + add bx,5 + dec cx + jnz identifyreel + ret + + endp + + + + + + + + +Checkifset proc near + + mov es,buffers + mov bx,setlist+(127*5) + mov cx,127 +identifyset: cmp byte ptr [es:bx+4],255 + jz notasetid + cmp al,[es:bx] + jc notasetid + cmp al,[es:bx+2] + jnc notasetid + cmp ah,[es:bx+1] + jc notasetid + cmp ah,[es:bx+3] + jnc notasetid + call pixelcheckset + jz notasetid + call isitdescribed + jz notasetid + mov al,[es:bx+4] + mov ah,1 + call obname + mov al,0 + cmp al,1 + ret +notasetid: sub bx,5 + dec cx + cmp cx,-1 + jnz identifyset + ret + + endp + + + + + + + + + + +Checkifex proc near + + mov es,buffers + mov bx,exlist+(99*5) + mov cx,99 +identifyex: cmp byte ptr [es:bx+4],255 + jz notanexid + cmp al,[es:bx] + jc notanexid + cmp al,[es:bx+2] + jnc notanexid + cmp ah,[es:bx+1] + jc notanexid + cmp ah,[es:bx+3] + jnc notanexid + mov al,[es:bx+4] + mov ah,4 + call obname + mov al,1 + cmp al,0 + ret +notanexid: sub bx,5 + dec cx + cmp cx,-1 + jnz identifyex + ret + + endp + + + + + + +Checkiffree proc near + + mov es,buffers + mov bx,freelist+(79*5) + mov cx,79 +identifyfree: cmp byte ptr [es:bx+4],255 + jz notafreeid + cmp al,[es:bx] + jc notafreeid + cmp al,[es:bx+2] + jnc notafreeid + cmp ah,[es:bx+1] + jc notafreeid + cmp ah,[es:bx+3] + jnc notafreeid + mov al,[es:bx+4] + mov ah,2 + call obname + mov al,0 + cmp al,1 + ret +notafreeid: sub bx,5 + dec cx + cmp cx,-1 + jnz identifyfree + ret + + endp + + + + + + +Isitdescribed proc near + + push ax cx es bx + mov al,[es:bx+4] ;get object number + mov ah,0 + add ax,ax + mov bx,ax + mov es,setdesc + add bx,settextdat + mov ax,[es:bx] + add ax,settext + mov bx,ax + mov dl,[es:bx] + pop bx es cx ax + cmp dl,0 + ret + + endp + + + + + + + + +;Getcurrentpath proc near ;routine finds out which path +; ;block the pointer is in. +; push ax ;used to see if an object is +; call findpathofpoint ;close or not +; pop ax +; mov pointerspath,dl +; ret +; +; endp + + + + + +Findpathofpoint proc near + + push ax + mov bx,pathdata + mov es,reels + mov al,roomnum + mov ah,0 + mov cx,144 + mul cx + add bx,ax + pop cx + + mov dl,0 +pathloop: mov al,[es:bx+6] + cmp al,255 + jnz flunkedit + mov ax,[es:bx+2] + cmp ax,0ffffh + jz flunkedit + cmp cl,al + jc flunkedit + cmp ch,ah + jc flunkedit + mov ax,[es:bx+4] + cmp cl,al + jnc flunkedit + cmp ch,ah + jnc flunkedit + jmp gotvalidpath +flunkedit: add bx,8 + inc dl + cmp dl,12 + jnz pathloop + mov dl,255 +gotvalidpath: ret + + endp + + + + + +Findfirstpath proc near ;similar to last routine, but it + ;searches each path to see if + push ax ;pointer is within it, regardless + mov bx,pathdata ;of whether the path is on or off + mov es,reels ;it returns the on or off state in + mov al,roomnum ;al (255=on 0=off) 0 if no path + mov ah,0 + mov cx,144 + mul cx + add bx,ax + pop cx + + mov dl,0 +fpathloop: mov ax,[es:bx+2] + cmp ax,0ffffh + jz nofirst + cmp cl,al + jc nofirst + cmp ch,ah + jc nofirst + mov ax,[es:bx+4] + cmp cl,al + jnc nofirst + cmp ch,ah + jnc nofirst + jmp gotfirst +nofirst: add bx,8 + inc dl + cmp dl,12 + jnz fpathloop + mov al,0 + ret +gotfirst: mov al,[es:bx+6] + ret + + endp + + + + + + + + +Turnpathon proc near ;turns path on permanently + + push ax ax + mov cl,255 + mov ch,roomnum + add ch,100 + call findormake + pop ax + call getroomspaths + pop ax + cmp al,255 + jz nopathon + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,255 + mov [es:bx+6],al +nopathon: ret + + endp + + + + + + + +Turnpathoff proc near ;turns path on permanently + + push ax ax + mov cl,0 + mov ch,roomnum + add ch,100 + call findormake + pop ax + call getroomspaths + pop ax + cmp al,255 + jz nopathoff + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,0 + mov [es:bx+6],al +nopathoff: ret + + endp + + + + + + + + + + + + + + + +Turnanypathon proc near + + push ax ax + mov cl,255 + mov ch,ah + add ch,100 + call findormake + pop ax + mov al,ah + mov ah,0 + mov cx,144 + mul cx + mov es,reels + mov bx,pathdata + add bx,ax + pop ax + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,255 + mov [es:bx+6],al + ret + + endp + + + + + + +Turnanypathoff proc near + + push ax ax + mov cl,0 + mov ch,ah + add ch,100 + call findormake + pop ax + mov al,ah + mov ah,0 + mov cx,144 + mul cx + mov es,reels + mov bx,pathdata + add bx,ax + pop ax + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,0 + mov [es:bx+6],al + ret + + endp + + + + + +Checkifpathison proc near + + push ax + call getroomspaths + pop ax + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,[es:bx+6] + cmp al,255 + ret + + endp + + + + + +Afternewroom proc near + + cmp nowinnewroom,0 + jz notnew + mov timecount,0 + call createpanel + mov commandtype,0 + call findroominloc + + cmp ryanon,1 + jz ryansoff + + mov al,ryanx + add al,12 + mov ah,ryany + add ah,12 + call findpathofpoint + mov manspath,dl + call findxyfrompath + mov resetmanxy,1 + +ryansoff: mov newobs,1 + call drawfloor + mov lookcounter,160 + mov nowinnewroom,0 + + call showicon + call spriteupdate + call printsprites + call undertextline + call reelsonscreen + call mainscreen + call getunderzoom + call zoom + call worktoscreenm + call walkintoroom + call reminders + call atmospheres +notnew: ret + + endp + + + + + + +Atmospheres proc near + + mov cl,mapx + mov ch,mapy + mov bx,offset cs:atmospherelist +nextatmos: mov al,[cs:bx] + cmp al,255 + jz nomoreatmos + cmp al,reallocation + jnz wrongatmos + mov ax,[cs:bx+1] + cmp ax,cx + jnz wrongatmos + mov ax,[cs:bx+3] + cmp al,ch0playing + jz playingalready + cmp location,45 + jnz notweb + cmp reeltowatch,45 + jz wrongatmos +notweb: call playchannel0 + cmp reallocation,2 + cmp mapy,0 + jz fullvol + jnz notlouisvol + cmp mapy,10 + jnz notlouisvol + cmp mapx,22 + jnz notlouisvol + mov volume,5 +notlouisvol: if cd + cmp reallocation,14 + jnz notmad1 + cmp mapx,33 + jz ismad2 + cmp mapx,22 + jnz notmad1 + mov volume,5 + ret +ismad2: mov volume,0 + ret +notmad1: endif +playingalready: cmp reallocation,2 + jnz notlouisvol2 + cmp mapx,22 + jz louisvol + cmp mapx,11 + jnz notlouisvol2 +fullvol: mov volume,0 +notlouisvol2: ret +louisvol: mov volume,5 + ret +wrongatmos: add bx,5 + jmp nextatmos +nomoreatmos: call cancelch0 + ret + +atmospherelist: db 0,33,10,15,255 + db 0,22,10,15,255 + db 0,22,0,15,255 + db 0,11,0,15,255 + db 0,11,10,15,255 + db 0,0,10,15,255 + + db 1,44,10,6,255 ;location,map x,y,sound,repeat + db 1,44,0,13,255 + + db 2,33,0,6,255 + db 2,22,0,5,255 + db 2,22,10,16,255 + db 2,11,10,16,255 + + db 3,44,0,15,255 + db 3,33,10,6,255 + db 3,33,0,5,255 + + db 4,11,30,6,255 + db 4,22,30,5,255 + db 4,22,20,13,255 + + db 10,33,30,6,255 + db 10,22,30,6,255 + + db 9,22,10,6,255 + db 9,22,20,16,255 + db 9,22,30,16,255 + db 9,22,40,16,255 + db 9,22,50,16,255 + + db 6,11,30,6,255 + db 6,0,10,15,255 + db 6,0,20,15,255 + db 6,11,20,15,255 + db 6,22,20,15,255 + + db 7,11,20,6,255 + db 7,0,20,6,255 + db 7,0,30,6,255 + + db 55,44,0,5,255 + db 55,44,10,5,255 + + db 5,22,30,6,255 + if demo + db 5,22,20,16,255 + db 5,22,10,16,255 + else + db 5,22,20,15,255 + db 5,22,10,15,255 + endif + + db 24,22,0,15,255 + db 24,33,0,15,255 + db 24,44,0,15,255 + db 24,33,10,15,255 + + db 8,0,10,6,255 + db 8,11,10,6,255 + db 8,22,10,6,255 + db 8,33,10,6,255 + db 8,33,20,6,255 + db 8,33,30,6,255 + db 8,33,40,6,255 + db 8,22,40,6,255 + db 8,11,40,6,255 + + db 11,11,20,12,255 + db 11,11,30,12,255 + db 11,22,20,12,255 + db 11,22,30,12,255 + + db 12,22,20,12,255 + db 13,22,20,12,255 + db 13,33,20,12,255 + + db 14,44,20,12,255 + db 14,33,0,12,255 + db 14,33,10,12,255 + db 14,33,20,12,255 + db 14,33,30,12,255 + db 14,33,40,12,255 + db 14,22,0,16,255 + + db 19,0,0,12,255 + + db 20,0,20,16,255 + db 20,0,30,16,255 + db 20,11,30,16,255 + db 20,0,40,16,255 + db 20,11,40,16,255 + + if demo + db 21,11,10,16,255 + db 21,11,20,16,255 + db 21,0,20,16,255 + db 21,22,20,16,255 + db 21,33,20,16,255 + db 21,44,20,16,255 + db 21,44,10,16,255 + else + db 21,11,10,15,255 + db 21,11,20,15,255 + db 21,0,20,15,255 + db 21,22,20,15,255 + db 21,33,20,15,255 + db 21,44,20,15,255 + db 21,44,10,15,255 + endif + + db 22,22,10,16,255 + db 22,22,20,16,255 + + db 23,22,30,13,255 + db 23,22,40,13,255 + db 23,33,40,13,255 + db 23,11,40,13,255 + db 23,0,40,13,255 + db 23,0,50,13,255 + + db 25,11,40,16,255 + db 25,11,50,16,255 + db 25,0,50,16,255 + + db 27,11,20,16,255 + db 27,11,30,16,255 + + db 29,11,10,16,255 + + db 45,22,30,12,255 + db 45,22,40,12,255 + db 45,22,50,12,255 + + db 46,22,40,12,255 + db 46,11,50,12,255 + db 46,22,50,12,255 + db 46,33,50,12,255 + + db 47,0,0,12,255 + + db 26,22,20,16,255 + db 26,33,10,16,255 + db 26,33,20,16,255 + db 26,33,30,16,255 + db 26,44,30,16,255 + db 26,22,30,16,255 + db 26,11,30,16,255 + db 26,11,20,16,255 + db 26,0,20,16,255 + db 26,11,40,16,255 + db 26,0,40,16,255 + db 26,22,40,16,255 + db 26,11,50,16,255 + + db 28,0,30,15,255 + db 28,0,20,15,255 + db 28,0,40,15,255 + db 28,11,30,15,255 + db 28,11,20,15,255 + db 28,22,30,15,255 + db 28,22,20,15,255 + + db 255 + + endp + + + + + + +Walkintoroom proc near + + cmp location,14 + jnz notlair + cmp mapx,22 + jnz notlair + mov destination,1 + mov finaldest,1 + call autosetwalk +notlair: ret + + endp + + + + + + + + + + + + +Afterintroroom proc near + + cmp nowinnewroom,0 + jz notnewintro + call clearwork + call findroominloc + mov newobs,1 + call drawfloor + call reelsonscreen + call spriteupdate + call printsprites + call worktoscreen + mov nowinnewroom,0 +notnewintro: ret + + endp + + + + + + + + + + + +Obname proc near + + cmp reasseschanges,0 + jz notnewpath + mov reasseschanges,0 + jmp diff + +notnewpath: cmp ah,commandtype + jz notdiffob + jmp diff +notdiffob: cmp al,command + jnz diff + cmp walkandexam,1 + jz walkandexamine + cmp mousebutton,0 + jz noobselect + cmp commandtype,3 + jnz isntblock + cmp lastflag,2 + jc noobselect +isntblock: mov bl,manspath + cmp bl,pointerspath + jnz wantstowalk + cmp commandtype,3 + jz wantstowalk + call finishedwalking + jnz noobselect + cmp commandtype,5 + jz wantstotalk + cmp watchingtime,0 + jnz noobselect + call examineob + ret +wantstotalk: cmp watchingtime,0 + jnz noobselect + call talk + ret +walkandexamine: call finishedwalking + jnz noobselect + mov al,walkexamtype + mov commandtype,al + mov al,walkexamnum + mov command,al + mov walkandexam,0 + cmp commandtype,5 + jz noobselect + call examineob + ret +wantstowalk: call setwalk + mov reasseschanges,1 +noobselect: ret + + +diff: mov command,al + mov commandtype,ah +diff2: cmp linepointer,254 + jnz middleofwalk + cmp watchingtime,0 + jnz middleofwalk + mov al,facing + cmp al,turntoface + jnz middleofwalk + cmp commandtype,3 + jnz notblock + mov bl,manspath + cmp bl,pointerspath + jnz dontcheck + mov cl,ryanx ;look under feet to see if + add cl,12 ;any flags are there + mov ch,ryany + add ch,12 + call checkone + cmp cl,2 + jc isblock +dontcheck: call getflagunderp + cmp lastflag,2 + jc isblock + cmp lastflag,128 + jnc isblock + jmp toofaraway ; only here for turning on doorstep +notblock: mov bl,manspath + cmp bl,pointerspath + jnz toofaraway + cmp commandtype,3 + jz isblock + cmp commandtype,5 + jz isaperson + call examineobtext + ret +middleofwalk: call blocknametext + ret +isblock: call blocknametext + ret +isaperson: call personnametext + ret +toofaraway: call walktotext + ret + + endp + + + + + + + +Finishedwalking proc near + + cmp linepointer,254 + jnz iswalking + mov al,facing + cmp al,turntoface +iswalking: ret + + endp + + + + + + + +Examineobtext proc near + + mov bl,command + mov bh,commandtype + mov al,1 + call commandwithob + ret + + endp + + + + + +Commandwithob proc near + + push ax + push ax bx cx dx es ds si di + call deltextline + pop di si ds es dx cx bx ax + + push bx + mov ah,0 + add ax,ax + mov bx,ax + mov es,commandtext + mov ax,[es:bx] + add ax,textstart + mov si,ax + + mov di,textaddressx + mov bx,textaddressy + mov dl,textlen + mov al,0 + mov ah,0 + call printdirect + + pop ax + mov di,offset cs:commandline + call copyname + pop ax + + mov di,lastxpos + cmp al,0 + jz noadd + add di,5 +noadd: mov bx,textaddressy + push cs + pop es + mov si,offset cs:commandline + mov dl,textlen + mov al,0 + mov ah,0 + call printdirect + mov newtextline,1 + ret + +commandline: db "OBJECT NAME ONE ",0 + + endp + + + + +Commandonly proc near + + push ax bx cx dx es ds si di + call deltextline + pop di si ds es dx cx bx ax + + mov ah,0 + add ax,ax + mov bx,ax + mov es,commandtext + mov ax,[es:bx] + add ax,textstart + mov si,ax + + mov di,textaddressx + mov bx,textaddressy + mov dl,textlen + mov al,0 + mov ah,0 + call printdirect + mov newtextline,1 + ret + + endp + + + + + +Printmessage proc near + + push dx bx di + mov ah,0 + add ax,ax + mov bx,ax + mov es,commandtext + mov ax,[es:bx] + add ax,textstart + mov si,ax + pop di bx dx + mov al,0 + mov ah,0 + call printdirect + ret + + endp + + + +Printmessage2 proc near + + push dx bx di + push ax + mov ah,0 + add ax,ax + mov bx,ax + mov es,commandtext + mov ax,[es:bx] + add ax,textstart + mov si,ax + pop ax + +searchmess: push ax + call findnextcolon + pop ax + dec ah + jnz searchmess + + pop di bx dx + mov al,0 + mov ah,0 + call printdirect + ret + + endp + + + + + + + + + +Blocknametext proc near + + mov bl,command + mov bh,commandtype + mov al,0 + call commandwithob + ret + + endp + + + + +Personnametext proc near + + mov bl,command + and bl,127 + mov bh,commandtype + mov al,2 + call commandwithob + ret + + endp + + + + + + + +Walktotext proc near + + mov bl,command + mov bh,commandtype + mov al,3 + call commandwithob + ret + + endp + + + + + +Getflagunderp proc near + + mov cx,mousex + sub cx,mapadx + mov ax,mousey + sub ax,mapady + mov ch,al + call checkone + mov lastflag,cl + mov lastflagex,ch + ret + + endp + + + + + +Setwalk proc near + + cmp linepointer,254 + jnz alreadywalking + mov al,pointerspath + cmp al,manspath + jz cantwalk2 + cmp watchmode,1 + jz holdingreel + cmp watchmode,2 + jz cantwalk + mov destination,al + mov finaldest,al + cmp mousebutton,2 + jnz notwalkandexam + cmp commandtype,3 + jz notwalkandexam + mov walkandexam,1 + mov al,commandtype + mov walkexamtype,al + mov al,command + mov walkexamnum,al +notwalkandexam: call autosetwalk +cantwalk: ret +cantwalk2: call facerightway + ret +alreadywalking: mov al,pointerspath + mov finaldest,al + ret + +holdingreel: mov destafterhold,al + mov watchmode,2 + ret + + endp + + + + + + + +Autosetwalk proc near + + mov al,manspath + cmp finaldest,al + jnz notsamealready + ret +notsamealready: call getroomspaths + call checkdest + push bx + mov al,manspath + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,[es:bx] + mov ah,0 + sub ax,12 + mov linestartx,ax + mov al,[es:bx+1] + mov ah,0 + sub ax,12 + mov linestarty,ax + pop bx + + mov al,destination + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,[es:bx] + mov ah,0 + sub ax,12 + mov lineendx,ax + mov al,[es:bx+1] + mov ah,0 + sub ax,12 + mov lineendy,ax + call bresenhams + + cmp linedirection,0 + jz normalline + mov al,linelength + dec al + mov linepointer,al + mov linedirection,1 + ret + +normalline: mov linepointer,0 + ret + + endp + + + + + + + + +Checkdest proc near + + push bx + add bx,12*8 + mov ah,manspath + mov cl,4 + shl ah,cl + mov al,destination + + mov cl,24 + mov ch,destination +checkdestloop: mov dh,[es:bx] + and dh,11110000b + mov dl,[es:bx] + and dl,00001111b + cmp ax,dx + jnz nextcheck + mov al,[es:bx+1] + and al,15 + mov destination,al + pop bx + ret +nextcheck: mov dl,[es:bx] + and dl,11110000b + shr dl,1 + shr dl,1 + shr dl,1 + shr dl,1 + mov dh,[es:bx] + and dh,00001111b + shl dh,1 + shl dh,1 + shl dh,1 + shl dh,1 + cmp ax,dx + jnz nextcheck2 + mov ch,[es:bx+1] + and ch,15 +nextcheck2: add bx,2 + dec cl + jnz checkdestloop + mov destination,ch + pop bx + ret + + endp + + + + + + + + + + + + + + +Bresenhams proc near + + call workoutframes + + mov dx,seg linedata + mov es,dx + mov di,offset es:linedata + mov si,1 + mov linedirection,0 + + mov cx,lineendx + sub cx,linestartx + jz vertline + jns line1 + + neg cx + mov bx,lineendx + xchg bx,linestartx + mov lineendx,bx + + mov bx,lineendy + xchg bx,linestarty + mov lineendy,bx + mov linedirection,1 + +line1: mov bx,lineendy + sub bx,linestarty + jz horizline + jns line3 + + neg bx + neg si + +line3: push si + mov lineroutine,0 ; means lo slope + cmp bx,cx + jle line4 + mov lineroutine,1 ; means hi slope + xchg bx,cx + +line4: shl bx,1 + mov increment1,bx + sub bx,cx + mov si,bx + sub bx,cx + mov increment2,bx + + mov ax,linestartx + mov bx,linestarty + mov ah,bl + inc cx + pop bx + cmp lineroutine,1 + jz hislope + jmp loslope + +vertline: mov ax,linestarty + mov bx,lineendy + mov cx,bx + sub cx,ax + jge line31 + + neg cx + mov ax,bx + mov linedirection,1 + +line31: inc cx + mov bx,linestartx + xchg ax,bx + mov ah,bl + mov bx,si +line32: stosw + add ah,bl + loop line32 + jmp lineexit + + +horizline: mov ax,linestartx + mov bx,linestarty + mov ah,bl + inc cx +horizloop: stosw + inc al + loop horizloop + jmp lineexit + + +loslope: +loloop: stosw + inc al + or si,si + jns line12 + add si,increment1 + loop loloop + jmp lineexit + +line12: add si,increment2 + add ah,bl + loop loloop + jmp lineexit + + + +hislope: +hiloop: stosw + add ah,bl + or si,si + jns line23 + add si,increment1 + loop hiloop + jmp lineexit + +line23: add si,increment2 + inc al + loop hiloop + +lineexit: sub di,offset es:linedata + mov ax,di + shr ax,1 + mov linelength,al + ret + + endp + + + + + + + +Workoutframes proc near + + mov bx,linestartx + add bx,32 + mov ax,lineendx + add ax,32 + sub bx,ax + jnc notneg1 + neg bx +notneg1: mov cx,linestarty + add cx,32 + mov ax,lineendy + add ax,32 + sub cx,ax + jnc notneg2 + neg cx +notneg2: cmp bx,cx + jnc tendstohoriz + mov dl,2 + mov ax,cx + shr ax,1 + cmp bx,ax + jc gotquad + mov dl,1 + jmp gotquad +tendstohoriz: mov dl,0 + mov ax,bx + shr ax,1 + cmp cx,ax + jc gotquad + mov dl,1 + jmp gotquad + +gotquad: mov bx,linestartx + add bx,32 + mov ax,lineendx + add ax,32 + sub bx,ax + jc isinright +isinleft: mov cx,linestarty + add cx,32 + mov ax,lineendy + add ax,32 + sub cx,ax + jnc topleft + cmp dl,1 + jz noswap1 + xor dl,2 +noswap1: add dl,4 + jmp success +topleft: add dl,6 + jmp success + +isinright: mov cx,linestarty + add cx,32 + mov ax,lineendy + add ax,32 + sub cx,ax + jnc botright + add dl,2 + jmp success +botright: cmp dl,1 + jz noswap2 + xor dl,2 +noswap2: + +success: and dl,7 + mov turntoface,dl + mov turndirection,0 + ret + + endp + + + + + + + + + + + + + + + + + + +;Multiply8 proc near +; +; mov ah,0 +; mov cx,8 +; mul cx +; ret +; +; endp + + + + + + +Getroomspaths proc near + + mov al,roomnum + mov ah,0 + mov cx,144 + mul cx + mov es,reels + mov bx,pathdata + add bx,ax + ret + + endp + + + + + + + + + + + + + + + + +Copyname proc near + + push di + call findobname + pop di + push cs + pop es + +copytext: mov cx,28 +make: lodsb + cmp al,":" + jz finishmakename + cmp al,0 + jz finishmakename + stosb + loop make + +finishmakename: inc cx + mov al,0 + stosb + ret + mov al,255 + rep stosb + ret + + endp + + + + + + + + + +Findobname proc near + + push ax + mov ah,0 + add ax,ax + mov bx,ax + pop ax + + cmp ah,5 + jnz notpersonname + + push ax + and al,127 + mov ah,0 + mov bx,64*2 + mul bx + mov si,ax + mov ds,people + add si,persontxtdat + mov cx,persontext + mov ax,[si] + add ax,cx + mov si,ax + pop ax + ret + +notpersonname: cmp ah,4 + jnz notextraname + mov ds,extras + add bx,extextdat + mov ax,[bx] + add ax,extext + mov si,ax + ret + +notextraname: cmp ah,2 + jnz notfreename + mov ds,freedesc + add bx,freetextdat + mov ax,[bx] + add ax,freetext + mov si,ax + ret + +notfreename: cmp ah,1 + jnz notsetname + mov ds,setdesc + add bx,settextdat + mov ax,[bx] + add ax,settext + mov si,ax + ret + +notsetname: mov ds,blockdesc + add bx,blocktextdat + mov ax,[bx] + add ax,blocktext + mov si,ax + ret + + endp + + + + + + + + + + + + + +;-------------------------------------------Printing of non scrolling icons---- + +Showicon proc near + + cmp reallocation,50 + jnc isdream1 + call showpanel + call showman + call roomname + call panelicons1 + call zoomicon + ret + +isdream1: mov ds,tempsprites + mov di,72 + mov bx,2 + mov al,45 + mov ah,0 + call showframe + mov ds,tempsprites + mov di,72+47 + mov bx,2 + mov al,46 + mov ah,0 + call showframe + mov ds,tempsprites + mov di,69-10 + mov bx,21 + mov al,49 + mov ah,0 + call showframe + + mov ds,tempsprites + mov di,160+88 + mov bx,2 + mov al,45 + mov ah,4 + call showframe + mov ds,tempsprites + mov di,160+43 + mov bx,2 + mov al,46 + mov ah,4 + call showframe + mov ds,tempsprites + mov di,160+101 + mov bx,21 + mov al,49 + mov ah,4 + call showframe + call middlepanel + ret + + endp + + + + + +Middlepanel proc near + + mov ds,tempsprites + mov di,72+47+20 + mov bx,0 + mov al,48 + mov ah,0 + call showframe + mov ds,tempsprites + mov di,72+19 + mov bx,21 + mov al,47 + mov ah,0 + call showframe + mov ds,tempsprites + mov di,160+23 + mov bx,0 + mov al,48 + mov ah,4 + call showframe + mov ds,tempsprites + mov di,160+71 + mov bx,21 + mov al,47 + mov ah,4 + call showframe + ret + + endp + + + + + + + + + + +Showman proc near + + mov ds,icons1 + mov di,0 + mov bx,0 + mov al,0 + mov ah,0 + call showframe + mov ds,icons1 + mov di,0 + mov bx,114 + mov al,1 + mov ah,0 + call showframe + + cmp shadeson,0 + jz notverycool + + mov ds,icons1 + mov di,28 + mov bx,25 + mov al,2 + mov ah,0 + call showframe +notverycool: ret + + endp + + + + + + + + + + + + + + + + + + + +Showpanel proc near + + mov ds,icons1 + mov di,72 + mov bx,0 + mov al,19 + mov ah,0 + call showframe + mov ds,icons1 + mov di,192 + mov bx,0 + mov al,19 + mov ah,0 + call showframe + ret + + endp + + + + + + + + + + + + + + + + + + + + + + +Roomname proc near + + mov di,88 + mov bx,18 + mov al,53 + mov dl,240 + call printmessage + + mov bl,roomnum + cmp bl,32 + jc notover32 + sub bl,32 + +notover32: mov bh,0 + add bx,bx + mov es,roomdesc + add bx,intextdat + mov ax,[es:bx] + add ax,intext + mov si,ax + + mov linespacing,7 + mov di,88 + mov bx,25 + mov dl,120 + cmp watchon,1 + jz gotpl + mov dl,160 +gotpl: mov al,0 + mov ah,0 + call printdirect + mov linespacing,10 + + call usecharset1 + ret + + endp + + + + + + +Usecharset1 proc near + + mov ax,charset1 + mov currentset,ax + ret + + endp + + + + + + + + + + + +Usetempcharset proc near + + mov ax,tempcharset + mov currentset,ax + ret + + endp + + + + + +Showexit proc near + + mov ds,icons1 + mov di,274 + mov bx,154 + mov al,11 + mov ah,0 + call showframe + ret + + endp + + + + +Panelicons1 proc near + + mov di,0 + cmp watchon,1 + jz watchison + mov di,48 +watchison: push di + mov ds,icons2 + add di,204 + mov bx,4 + mov al,2 + mov ah,0 + call showframe + pop di + push di + cmp zoomon,1 + jz zoomisoff + mov ds,icons1 + add di,228 + mov bx,8 + mov al,5 + mov ah,0 + call showframe +zoomisoff: pop di + call showwatch + ret + + endp + + + + + + + + + + + + +Showwatch proc near + + cmp watchon,0 + jz nowristwatch + mov ds,icons1 + mov di,250 + mov bx,1 + mov al,6 + mov ah,0 + call showframe + call showtime +nowristwatch: ret + + endp + + +Gettime proc near + + mov ah,2ch + int 21h + mov secondcount,dh + mov minutecount,cl + mov hourcount,ch + ret + + endp + + + + + +Zoomicon proc near + + cmp zoomon,0 + jz nozoom1 + mov ds,icons1 + mov di,zoomx + mov bx,zoomy-1 + mov al,8 + mov ah,0 + call showframe +nozoom1: ret + + endp + + + + + + +Showblink proc near + + cmp manisoffscreen,1 + jz finblink1 + inc blinkcount + cmp shadeson,0 + jnz finblink1 + cmp reallocation,50 + jnc eyesshut + mov al,blinkcount + cmp al,3 + jnz finblink1 + mov blinkcount,0 + mov al,blinkframe + inc al + mov blinkframe,al + cmp al,6 + jc nomorethan6 + mov al,6 +nomorethan6: mov ah,0 + mov bx,offset cs:blinktab + add bx,ax + + mov al,[cs:bx] + mov ds,icons1 + mov di,44 + mov bx,32 + mov ah,0 + call showframe +finblink1: ret + +eyesshut: ;mov al,32 + ;mov ds,icons1 + ;mov di,44 + ;mov bx,32 + ;mov ah,0 + ;call showframe + ret + +blinktab: db 16,18,18,17,16,16,16 + + endp + + + + + + +Dumpblink proc near + + cmp shadeson,0 + jnz nodumpeye + cmp blinkcount,0 + jnz nodumpeye + mov al,blinkframe + cmp al,6 + jnc nodumpeye + push ds + mov di,44 + mov bx,32 + mov cl,16 + mov ch,12 + call multidump + pop ds +nodumpeye: ret + + endp + + + + + + + + + + + + + + + + + + +Worktoscreenm proc near + + call animpointer + call readmouse + call showpointer + call vsync + call worktoscreen + call delpointer + ret + + endp + + + + + + + + + + + + + +;-------------------------------------------------------------Blank routine---- + + + + +Blank proc near + + cmp commandtype,199 + jz alreadyblnk + mov commandtype,199 + mov al,0 + call commandonly +alreadyblnk: ret + + endp + + + + + + + + + + + + + + + + + + + + + + +;---------------------------------------------------------Standard routines---- + + + + + + + + + + + + + +Allpointer proc near + + call readmouse + call showpointer + call dumppointer + ret + + endp + + + + + + + +Hangonp proc near + + push cx + add cx,cx + pop ax + add cx,ax + mov maintimer,0 + mov al,pointerframe + mov ah,pickup + push ax + mov pointermode,3 + mov pickup,0 + push cx + mov commandtype,255 + call readmouse + call animpointer + call showpointer + call vsync + call dumppointer + pop cx + +hangloop: push cx + call delpointer + call readmouse + call animpointer + call showpointer + call vsync + call dumppointer + pop cx + mov ax,mousebutton + cmp ax,0 + jz notpressed + cmp ax,oldbutton + jnz getoutofit +notpressed: loop hangloop + +getoutofit: call delpointer + pop ax + mov pointerframe,al + mov pickup,ah + mov pointermode,0 + ret + + endp + + + + + +Hangonw proc near + +hangloopw: push cx + call delpointer + call readmouse + call animpointer + call showpointer + call vsync + call dumppointer + pop cx + loop hangloopw + ret + + endp + + + + +Hangoncurs proc near + +monloop1: push cx + call printcurs + call vsync + call delcurs + pop cx + loop monloop1 + ret + + endp + + + + + + + + +Getunderzoom proc near + + mov di,zoomx+5 + mov bx,zoomy+4 + mov ds,buffers + mov si,zoomspace + mov cl,46 + mov ch,40 + call multiget + ret + + endp + + + + + +Dumpzoom proc near + + cmp zoomon,1 + jnz notzoomon + mov di,zoomx+5 + mov bx,zoomy+4 + mov cl,46 + mov ch,40 + call multidump +notzoomon: ret + + endp + + + + + + + +Putunderzoom proc near + + mov di,zoomx+5 + mov bx,zoomy+4 + mov ds,buffers + mov si,zoomspace + mov cl,46 + mov ch,40 + call multiput + ret + + endp + + + + + +Crosshair proc near + + cmp commandtype,3 + jz nocross + cmp commandtype,10 + jnc nocross + + mov es,workspace + mov ds,icons1 + mov di,zoomx+24 + mov bx,zoomy+19 + mov al,9 + mov ah,0 + call showframe + ret + +nocross: mov es,workspace + mov ds,icons1 + mov di,zoomx+24 + mov bx,zoomy+19 + mov al,29 + mov ah,0 + call showframe + ret + + endp + + + + + + +Showpointer proc near + + call showblink + mov di,mousex + mov oldpointerx,di + mov bx,mousey + mov oldpointery,bx + cmp pickup,1 + jz itsanobject + + push bx di + mov ds,icons1 + mov al,pointerframe + add al,20 + mov ah,0 + add ax,ax + mov si,ax + add ax,ax + add si,ax + mov cx,[si] + cmp cl,12 + jnc notsmallx + mov cl,12 +notsmallx: cmp ch,12 + jnc notsmally + mov ch,12 +notsmally: mov pointerxs,cl + mov pointerys,ch + push ds + mov ds,buffers + mov si,pointerback + call multiget + pop ds di bx + push di bx + mov al,pointerframe + add al,20 + mov ah,0 + call showframe + pop bx di + ret + +itsanobject: mov al,itemframe + mov ds,extras + cmp objecttype,4 + jz itsfrominv + mov ds,freeframes +itsfrominv: mov cl,al + add al,al + add al,cl + inc al + mov ah,0 + + push ax + add ax,ax + mov si,ax + add ax,ax + add si,ax + mov ax,2080 + mov cx,[si] + cmp cl,12 + jnc notsmallx2 + mov cl,12 +notsmallx2: cmp ch,12 + jnc notsmally2 + mov ch,12 +notsmally2: mov pointerxs,cl + mov pointerys,ch + pop ax + + push di bx + push ax bx di ds + mov al,cl + mov ah,0 + shr ax,1 + sub oldpointerx,ax + sub di,ax + mov al,ch + shr ax,1 + sub oldpointery,ax + sub bx,ax + mov ds,buffers + mov si,pointerback + call multiget + pop ds di bx ax + mov ah,128 + call showframe + pop bx di + mov ds,icons1 + mov al,3 + mov ah,128 + call showframe + ret + + endp + + + + + + + +Delpointer proc near + + mov ax,oldpointerx + cmp ax,0ffffh + jz nevershown + mov delherex,ax + mov ax,oldpointery + mov delherey,ax + mov cl,pointerxs + mov delxs,cl + mov ch,pointerys + mov delys,ch + mov ds,buffers + mov si,pointerback + mov di,delherex + mov bx,delherey + call multiput +nevershown: ret + + endp + + + + + + + + + +Dumppointer proc near + + call dumpblink + mov cl,delxs + mov ch,delys + mov di,delherex + mov bx,delherey + call multidump + + mov bx,oldpointery + mov di,oldpointerx + cmp di,delherex + jnz difffound + cmp bx,delherey + jz notboth +difffound: mov cl,pointerxs + mov ch,pointerys + call multidump +notboth: ret + + endp + + + + + + + + + + + +Undertextline proc near + + mov di,textaddressx + mov bx,textaddressy + if foreign + sub bx,3 + endif + mov ds,buffers + mov si,textunder + mov cl,undertextsizex + mov ch,undertextsizey + call multiget + ret + + endp + + + + + + + + +Deltextline proc near + + mov di,textaddressx + mov bx,textaddressy + if foreign + sub bx,3 + endif + mov ds,buffers + mov si,textunder + mov cl,undertextsizex + mov ch,undertextsizey + call multiput + ret + + endp + + + + + +Dumptextline proc near + + cmp newtextline,1 + jnz nodumptextline + mov newtextline,0 + mov di,textaddressx + mov bx,textaddressy + if foreign + sub bx,3 + endif + mov cl,undertextsizex + mov ch,undertextsizey + call multidump +nodumptextline: ret + + endp + + + + + + + + + + + + + + + + + +Animpointer proc near + + cmp pointermode,2 + jz combathand + cmp pointermode,3 + jz mousehand + + cmp watchingtime,0 + jz notwatchpoint + mov pointerframe,11 + ret +notwatchpoint: mov pointerframe,0 + cmp inmaparea,0 + jz gothand + cmp pointerfirstpath,0 + jz gothand +arrow: call getflagunderp + cmp cl,2 + jc gothand + cmp cl,128 + jnc gothand + mov pointerframe,3 + test cl,4 + jnz gothand + mov pointerframe,4 + test cl,16 + jnz gothand + mov pointerframe,5 + test cl,2 + jnz gothand + mov pointerframe,6 + test cl,8 + jnz gothand + mov pointerframe,8 +gothand: ret + +mousehand: cmp pointerspeed,0 + jz rightspeed3 + dec pointerspeed + jmp finflashmouse +rightspeed3: mov pointerspeed,5 + inc pointercount + cmp pointercount,16 + jnz finflashmouse + mov pointercount,0 +finflashmouse: mov al,pointercount + mov ah,0 + mov bx,offset cs:flashmousetab + add bx,ax + mov al,[cs:bx] + mov pointerframe,al + ret + +combathand: mov pointerframe,0 + cmp reallocation,14 + jnz notarrow + cmp commandtype,211 + jnz notarrow + mov pointerframe,5 +notarrow: ret + +flashmousetab: db 1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2 + + endp + + + + +;------------------------------------------------Mouse and keyboard-readers---- + +Setmouse proc near + + if recording + mov recordpos,-8 + mov dx,seg recname + mov ds,dx + mov dx,offset recname + mov cx,0 + mov ah,3ch + mov al,2 + int 21h + mov rechandle,ax + endif + + if playback + mov dx,seg recname + mov ds,dx + mov dx,offset recname + mov ah,3dh + mov al,2 + int 21h + mov rechandle,ax + call loadrec + endif + + mov oldpointerx,0ffffh + + mov ax,0 + int 33h + mov ax,8 + mov cx,15 + mov dx,184 + int 33h + mov ax,7 + mov cx,15 + mov dx,298*2 + int 33h + ret + + endp + + + + + +Readmouse proc near + + mov ax,mousebutton + mov oldbutton,ax + mov ax,mousex + mov oldx,ax + mov ax,mousey + mov oldy,ax + call mousecall + mov mousex,cx + mov mousey,dx + mov mousebutton,bx + ret + + endp + + + + + + + +Mousecall proc near + + if playback + call playmouse + ret + endif + + mov ax,3 + int 33h + shr cx,1 + cmp cx,298 + jc notxover + mov cx,298 +notxover: cmp cx,15 + jnc notxover2 + mov cx,15 +notxover2: cmp dx,184 + jc notyover + mov dx,184 +notyover: cmp dx,15 + jnc notyover2 + mov dx,15 +notyover2: + if recording + call recmouse + endif + ret + + endp + + + + + + + if playback + +Playmouse proc near + + mov es,recordspace + mov di,recordpos + cmp word ptr [es:di+6],0 + jnz isthisplay + add di,8 + add recordpos,8 + cmp di,16384 + jnz isthisplay + call loadrec +isthisplay: mov cx,[es:di] + mov dx,[es:di+2] + mov bx,[es:di+4] + dec word ptr [es:di+6] + ret + + endp + + endif + + if recording + +Recmouse proc near + + mov es,recordspace + mov di,recordpos + cmp di,-8 + jz diffrec + cmp [es:di],cx + jnz diffrec + cmp [es:di+2],dx + jnz diffrec + cmp [es:di+4],bx + jnz diffrec + inc word ptr [es:di+6] + cmp word ptr [es:di+5],0ffffh + jz diffrec + ret +diffrec: add recordpos,8 + add di,8 + cmp di,16384 + jnz notsaverec + push cx dx bx + call saverec + pop bx dx cx +notsaverec: mov [es:di],cx + mov [es:di+2],dx + mov [es:di+4],bx + mov word ptr [es:di+6],1 + ret + + endp + + + + + +Saverec proc near + + mov bx,rechandle + mov ds,recordspace + mov dx,0 + mov cx,recordpos + add cx,8 + mov ah,40h + int 21h + mov di,0 + mov recordpos,0 + ret + + endp + + + + + + +Loadrec proc near + + mov bx,rechandle + mov ds,recordspace + mov dx,0 + mov cx,16384+8 + mov ah,3fh + int 21h + mov di,0 + mov recordpos,0 + ret + + endp + + + endif + + + + + + + +Readmouse1 proc near + + mov ax,mousex + mov oldx,ax + mov ax,mousey + mov oldy,ax + call mousecall + mov mousex,cx + mov mousey,dx + mov mousebutton1,bx + ret + + endp + + + +Readmouse2 proc near + + mov ax,mousex + mov oldx,ax + mov ax,mousey + mov oldy,ax + call mousecall + mov mousex,cx + mov mousey,dx + mov mousebutton2,bx + ret + + endp + + +Readmouse3 proc near + + mov ax,mousex + mov oldx,ax + mov ax,mousey + mov oldy,ax + call mousecall + mov mousex,cx + mov mousey,dx + mov mousebutton3,bx + ret + + endp + + + + + + +Readmouse4 proc near + + mov ax,mousebutton + mov oldbutton,ax + mov ax,mousex + mov oldx,ax + mov ax,mousey + mov oldy,ax + call mousecall + mov mousex,cx + mov mousey,dx + mov ax,mousebutton1 + or ax,mousebutton2 + or ax,mousebutton3 + or bx,ax + mov mousebutton,bx + ret + + endp + + + + + +Readkey proc near + + mov bx,bufferout + cmp bx,bufferin + jz nokey + inc bx + and bx,15 + mov bufferout,bx + mov di,offset cs:keybuffer + add di,bx + mov al,[cs:di] + mov currentkey,al + ret +nokey: mov currentkey,0 + ret + + + endp + +keybuffer: db 16 dup (0) + + + +Convertkey proc near + + and al,127 + mov ah,0 + mov di,offset cs:keyconverttab + add di,ax + mov al,[cs:di] + ret + +keyconverttab: db 0,0,"1","2","3","4","5","6","7","8","9","0","-",0,8,0 + db "Q","W","E","R","T","Y","U","I","O","P",0,0,13,0,"A","S" + db "D","F","G","H","J","K","L",0,0,0,0,0,"Z","X","C","V","B","N","M" + db 0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + endp + + + + +;-------------------------------------------------------------Miscellaneous---- + +Randomnum1 proc near + + push ds es di bx cx + call randomnumber + pop cx bx di es ds + ret + + endp + + + + + +Randomnum2 proc near + + push ds es di bx ax + call randomnumber + mov cl,al + pop ax bx di es ds + ret + + endp + + + + + +Randomnumber proc near + + mov al,seed + and al,48h + add al,38h + sal al,1 + sal al,1 + rcl seed+2,1 + rcl seed+1,1 + rcl seed+0,1 + mov al,seed + and al,48h + add al,38h + sal al,1 + sal al,1 + rcl seed+2,1 + rcl seed+1,1 + rcl seed+0,1 + mov al,seed + and al,48h + add al,38h + sal al,1 + sal al,1 + rcl seed+2,1 + rcl seed+1,1 + rcl seed+0,1 + mov al,seed + and al,48h + add al,38h + sal al,1 + sal al,1 + rcl seed+2,1 + rcl seed+1,1 + rcl seed+0,1 + mov al,seed + and al,48h + add al,38h + sal al,1 + sal al,1 + rcl seed+2,1 + rcl seed+1,1 + rcl seed+0,1 + mov al,seed + and al,48h + add al,38h + sal al,1 + sal al,1 + rcl seed+2,1 + rcl seed+1,1 + rcl seed+0,1 + mov al,seed + and al,48h + add al,38h + sal al,1 + sal al,1 + rcl seed+2,1 + rcl seed+1,1 + rcl seed+0,1 + mov al,seed + and al,48h + add al,38h + sal al,1 + sal al,1 + rcl seed+2,1 + rcl seed+1,1 + rcl seed+0,1 + + mov al,seed + ret + + endp + + + + + + +Hangon proc near + +hangonloop: push cx + call vsync + pop cx + loop hangonloop + ret + + endp + + + + + +;-------------------------------------------------------------Disc handling---- + + +Loadtraveltext proc near + + mov dx,offset cs:traveltextname + call standardload + mov traveltext,ax + ret + + endp + + + + + + +Loadintotemp proc near + + push cs + pop ds + call standardload + mov tempgraphics,ax + ret + + endp + + + + + + +Loadintotemp2 proc near + + push cs + pop ds + call standardload + mov tempgraphics2,ax + ret + + endp + + + + +Loadintotemp3 proc near + + push cs + pop ds + call standardload + mov tempgraphics3,ax + ret + + endp + + + +Loadtempcharset proc near + + call standardload + mov tempcharset,ax + ret + + endp + + + + + + +Standardload proc near + + call openfile + call readheader + mov bx,[es:di] + push bx + mov cl,4 + shr bx,cl + call allocatemem + mov ds,ax + pop cx + push ax + mov dx,0 + call readfromfile + call closefile + pop ax + ret + + endp + + + + + + +Loadtemptext proc near + + call standardload + mov textfile1,ax + ret + + endp + + + + + + + +Loadroom proc near + + mov roomloaded,1 + mov timecount,0 + mov maintimer,0 + mov mapoffsetx,104 + mov mapoffsety,38 + mov textaddressx,13 + mov textaddressy,182 + mov textlen,240 + mov al,newlocation + mov location,al + call getroomdata + call startloading + call loadroomssample + call switchryanon + call drawflags + call getdimension + ret + + endp + + + + +Loadroomssample proc near + + mov al,roomssample + cmp al,255 + jz loadedalready + cmp al,currentsample + jz loadedalready + mov currentsample,al + mov al,currentsample + mov cl,"0" + call twodigitnum + mov di,offset cs:samplename + xchg al,ah + mov [cs:di+10],ax + mov dx,di + call loadsecondsample +loadedalready: ret + + endp + + + + + +Getridofreels proc near + + cmp roomloaded,0 + jz dontgetrid + mov es,reel1 + call deallocatemem + mov es,reel2 + call deallocatemem + mov es,reel3 + call deallocatemem +dontgetrid: ret + + endp + + + + + +Getridofall proc near + + mov es,backdrop + call deallocatemem + mov es,setframes + call deallocatemem + mov es,reel1 + call deallocatemem + mov es,reel2 + call deallocatemem + mov es,reel3 + call deallocatemem + mov es,reels + call deallocatemem + mov es,people + call deallocatemem + mov es,setdesc + call deallocatemem + mov es,blockdesc + call deallocatemem + mov es,roomdesc + call deallocatemem + mov es,freeframes + call deallocatemem + mov es,freedesc + call deallocatemem + ret + + endp + + + + + +Restorereels proc near + + cmp roomloaded,0 + jz dontrestore + mov al,reallocation + call getroomdata + mov dx,bx + call openfile + call readheader + + call dontloadseg + call dontloadseg + call dontloadseg + call dontloadseg + + call allocateload + mov reel1,ax + mov ds,ax + mov dx,0 + call loadseg + call allocateload + mov reel2,ax + mov ds,ax + mov dx,0 + call loadseg + call allocateload + mov reel3,ax + mov ds,ax + mov dx,0 + call loadseg + call closefile +dontrestore: ret + + endp + + + + + + + +Restoreall proc near + + mov al,location + call getroomdata + mov dx,bx + call openfile + call readheader + + call allocateload + mov ds,ax + mov backdrop,ax + mov dx,flags + call loadseg + + mov ds,workspace ;mapdata + mov dx,map + mov cx,132*66 ;maplen + mov al,0 + call fillspace + call loadseg + call sortoutmap + + call allocateload + mov setframes,ax + mov ds,ax + mov dx,framedata + call loadseg + + ;mov ds,setdat + ;mov dx,0 + ;mov cx,setdatlen + ;mov al,255 + ;call fillspace + call dontloadseg + + call allocateload + mov reel1,ax + mov ds,ax + mov dx,0 + ;call bloc + ;BIG FIXME: undefined bloc, replaced with loadseg. dunno! + call loadseg + call allocateload + mov reel2,ax + mov ds,ax + mov dx,0 + call loadseg + call allocateload + mov reel3,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov reels,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov people,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov setdesc,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov blockdesc,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov roomdesc,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov freeframes,ax + mov ds,ax + mov dx,0 + call loadseg + + ;mov ds,freedat + ;mov dx,0 + ;mov cx,freedatlen + ;mov al,255 + ;call fillspace + call dontloadseg + + call allocateload + mov freedesc,ax + mov ds,ax + mov dx,freetextdat + call loadseg + + call closefile + + call setallchanges + ret + + endp + + + +Sortoutmap proc near + + push es di + mov ds,workspace + mov si,0 + mov es,mapdata + mov di,0 + + mov cx,maplength +blimey: push cx si + mov cx,mapwidth + rep movsb + pop si cx + add si,132 + loop blimey + pop di es + ret + + endp + + + + +Startloading proc near + + mov combatcount,0 + mov al,[cs:bx+13] + mov roomssample,al + mov al,[cs:bx+15] + mov mapx,al + mov al,[cs:bx+16] + mov mapy,al + + mov al,[cs:bx+20] ; start path pos + mov liftflag,al + mov al,[cs:bx+21] ; start path pos + mov manspath,al + mov destination,al + mov finaldest,al + mov al,[cs:bx+22] + mov facing,al + mov turntoface,al + mov al,[cs:bx+23] + mov counttoopen,al + mov al,[cs:bx+24] + mov liftpath,al + mov al,[cs:bx+25] + mov doorpath,al + mov lastweapon,-1 + mov al,[cs:bx+27] + push ax + + mov al,[cs:bx+31] + mov ah,reallocation + mov reallocation,al + + mov dx,bx + call openfile + call readheader + + call allocateload + mov ds,ax + mov backdrop,ax + mov dx,flags + call loadseg + + mov ds,workspace ;mapdata + mov dx,map + mov cx,132*66 ;maplen + mov al,0 + call fillspace + call loadseg + call sortoutmap + + call allocateload + mov setframes,ax + mov ds,ax + mov dx,framedata + call loadseg + + mov ds,setdat + mov dx,0 + mov cx,setdatlen + mov al,255 + call fillspace + call loadseg + + call allocateload + mov reel1,ax + mov ds,ax + mov dx,0 + call loadseg + call allocateload + mov reel2,ax + mov ds,ax + mov dx,0 + call loadseg + call allocateload + mov reel3,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov reels,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov people,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov setdesc,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov blockdesc,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov roomdesc,ax + mov ds,ax + mov dx,0 + call loadseg + + call allocateload + mov freeframes,ax + mov ds,ax + mov dx,0 + call loadseg + + mov ds,freedat + mov dx,0 + mov cx,freedatlen + mov al,255 + call fillspace + call loadseg + + call allocateload + mov freedesc,ax + mov ds,ax + mov dx,freetextdat + call loadseg + + call closefile + + + call findroominloc + call deletetaken + call setallchanges + call autoappear + mov al,newlocation + call getroomdata + mov lastweapon,-1 + mov mandead,0 + mov lookcounter,160 + mov newlocation,255 + mov linepointer,254 + pop ax + cmp al,255 + jz dontwalkin + mov manspath,al + push bx + call autosetwalk + pop bx +dontwalkin: call findxyfrompath + ret + + endp + + + + + + + + + + +Disablepath proc near ;needs al,ah map x,y cl=path + + push cx + xchg al,ah + mov cx,-6 +looky2: add cx,6 + sub al,10 + jnc looky2 + mov al,ah + dec cx +lookx2: inc cx + sub al,11 + jnc lookx2 + mov al,cl + mov ah,0 + mov cx,144 + mul cx + mov es,reels + mov bx,pathdata + add bx,ax + pop ax + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,0 + mov [es:bx+6],al + ret + + endp + + + + + + + + +Findxyfrompath proc near ;path number was found from + ;room data. Fill ryanxy from + call getroomspaths ;the pathdata. + mov al,manspath + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov ax,[es:bx] + sub al,12 + sub ah,12 + mov ryanx,al + mov ryany,ah + ret + + endp + + + + + +Findroominloc proc near + + mov al,mapy + mov cx,-6 +looky: add cx,6 + sub al,10 + jnc looky + mov al,mapx + dec cx +lookx: inc cx + sub al,11 + jnc lookx + mov roomnum,cl + ret + + endp + + + + + + +Getroomdata proc near + + mov ah,0 + mov cx,32 + mul cx + mov bx,offset cs:roomdata + add bx,ax + ret + + endp + + + + + + + + + + + + + +Readheader proc near + + push cs + pop ds + mov dx,offset cs:fileheader + mov cx,headerlen + call readfromfile + push cs + pop es + mov di,offset cs:filedata + ret + + endp + + + + + + + + +Dontloadseg proc neqr + + mov ax,[es:di] + add di,2 + push bx di es + mov cx,0 + mov dx,ax + mov al,1 + mov ah,42h + int 21h + pop es di bx + ret + + endp + + + + + + +Allocateload proc near + + push es di + mov bx,[es:di] + mov cl,4 + shr bx,cl + call allocatemem + pop di es + ret + + endp + + + + +Fillspace proc near + + push es ds dx di bx + mov di,dx + push ds + pop es + rep stosb + pop bx di dx ds es + ret + + endp + + + + + + + +Getridoftemp proc near + + mov es,tempgraphics + call deallocatemem + ret + + endp + + + + + +Getridoftemptext proc near + + mov es,textfile1 + call deallocatemem + ret + + endp + + + + + +Getridoftemp2 proc near + + mov es,tempgraphics2 + call deallocatemem + ret + + endp + + + +Getridoftemp3 proc near + + mov es,tempgraphics3 + call deallocatemem + ret + + endp + + + +Getridoftempcharset proc near + + mov es,tempcharset + call deallocatemem + ret + + endp + + + +Getridoftempsp proc near + + mov es,tempsprites + call deallocatemem + ret + + endp + + + + + + + + + + + + + + + + + + + + + + + +Readsetdata proc near + + mov dx,offset cs:characterset1 + call standardload + mov charset1,ax + + mov dx,offset cs:icongraphics0 + call standardload + mov icons1,ax + + mov dx,offset cs:icongraphics1 + call standardload + mov icons2,ax + + mov dx,offset cs:spritename1 + call standardload + mov mainsprites,ax + + mov dx,offset cs:puzzletextname + call standardload + mov puzzletext,ax + + mov dx,offset cs:commandtextname + call standardload + mov commandtext,ax + + mov ax,charset1 + mov currentset,ax + + cmp soundint,255 + jz novolumeload + mov dx,offset cs:volumetabname + call openfile + mov cx,2048-256 + mov ds,soundbuffer + mov dx,16384 + call readfromfile + call closefile +novolumeload: ret + + endp + + + + + + + + + + + +Createfile proc near + + mov ah,3ch + mov cx,0 + int 21h + mov bx,ax + ret + + endp + + + + + + + +Openfile proc near + + if cd + call makename + endif + push cs + pop ds + mov ah,3dh + mov al,2 + push dx + int 21h + pop dx + jc fileerror + mov handle,ax + ret +fileerror: mov gameerror,8 + jmp quickquit2 + + endp + + + if cd +Openfilefromc proc near + + push cs + pop ds + mov ah,3dh + mov al,2 + push dx + int 21h + pop dx + mov handle,ax + ret + + endp + endif + + + if cd +Makename proc near + + if demo + ret + endif + mov si,dx + mov di,offset cs:place +transfer: mov al,[cs:si] + mov [cs:di],al + inc si + inc di + cmp al,0 + jnz transfer + mov dx,offset cs:id + ret +id: db "D:\" +place: db 30 dup (0) + + endp + endif + + + + + +Openfilenocheck proc near + + if cd + call makename + endif + push cs + pop ds + mov ah,3dh + mov al,2 + int 21h + mov handle,ax + ret + + endp + + + +Openforsave proc near + + mov cx,0 + mov ah,3ch + mov al,2 + int 21h + mov handle,ax + ret + + endp + + + +Closefile proc near + + mov bx,handle + mov ah,3eh + int 21h + ret + + endp + + + + +Readfromfile proc near + + mov bx,handle + mov ah,3fh + int 21h + ret + + endp + + + + +Setkeyboardint proc near + + mov ah,35h + mov al,9 + int 21h + mov oldint9seg,es ; Save es:bx to temp memory + mov oldint9add,bx + push cs + pop ds + mov dx,offset cs:keyboardread + mov ah,25h + mov al,9 + int 21h ; Set to new + ret + + endp + + + + +Resetkeyboard proc near + + cmp oldint9add,-1 + jz noreset + mov dx,oldint9add ;Restore old interupt vector + mov ax,oldint9seg ;for keys + mov ds,ax + mov ah,25h + mov al,9 + int 21h +noreset: ret + + endp + + + + + + + + + + + + + + + + + + + + + + +Keyboardread proc near + + push ax dx di ds es + in al,60h + cmp al,lasthardkey + jz same + mov lasthardkey,al + cmp al,128 + jnc same + mov dx,bufferin + inc dx + and dx,15 + cmp dx,bufferout + jz same ;buffer is full + mov bufferin,dx + call convertkey + mov di,offset cs:keybuffer + mov dx,bufferin + add di,dx + mov [cs:di],al +same: in al,61h + mov ah,al + or al,80h ; Mask for Akn + out 61h,al ; Set Akn. + and al,7fh + out 61h,al + cli + mov al,20h ; 8259 end of interrupt + out 20h,al + pop es ds di dx ax + iret + + endp + + + +;------------------------------------------------------Text and tables data---- + + + +Fileheader db "DREAMWEB DATA FILE " + db "COPYRIGHT 1992 " + db "CREATIVE REALITY" +Filedata dw 20 dup (0) +Extradata db 6 dup (0) +Headerlen equ $-Fileheader + + +Roomdata db "DREAMWEB.R00",0 ;Ryan's apartment + db 5,255,33,10 + db 255,255,255,0 + db 1,6,2,255,3,255,255,255,255,255,0 + + db "DREAMWEB.R01",0 + db 1,255,44,10 + db 255,255,255,0 + db 7,2,255,255,255,255,6,255,255,255,1 + + db "DREAMWEB.R02",0 + db 2,255,33,0 + db 255,255,255,0 + db 1,0,255,255,1,255,3,255,255,255,2 + + db "DREAMWEB.R03",0 + db 5,255,33,10 + db 255,255,255,0 + db 2,2,0,2,4,255,0,255,255,255,3 + + db "DREAMWEB.R04",0 + db 23,255,11,30 + db 255,255,255,0 + db 1,4,0,5,255,255,3,255,255,255,4 + + db "DREAMWEB.R05",0 + if demo + db 22,255,22,30 + else + db 5,255,22,30 + endif + db 255,255,255,0 + db 1,2,0,4,255,255,3,255,255,255,5 + + db "DREAMWEB.R06",0 + db 5,255,11,30 + db 255,255,255,0 + db 1,0,0,1,2,255,0,255,255,255,6 + + db "DREAMWEB.R07",0 + db 255,255,0,20 + db 255,255,255,0 + db 2,2,255,255,255,255,0,255,255,255,7 + + db "DREAMWEB.R08",0 + db 8,255,0,10 + db 255,255,255,0 + db 1,2,255,255,255,255,0,11,40,0,8 + + db "DREAMWEB.R09",0 + db 9,255,22,10 + db 255,255,255,0 + db 4,6,255,255,255,255,0,255,255,255,9 + + db "DREAMWEB.R10",0 + db 10,255,33,30 + db 255,255,255,0 + db 2,0,255,255,2,2,4,22,30,255,10 ;22,30,0 switches + ;off path 0 in skip + db "DREAMWEB.R11",0 + db 11,255,11,20 + db 255,255,255,0 + db 0,4,255,255,255,255,255,255,255,255,11 + + db "DREAMWEB.R12",0 + db 12,255,22,20 + db 255,255,255,0 + db 1,4,255,255,255,255,255,255,255,255,12 + + db "DREAMWEB.R13",0 + db 12,255,22,20 + db 255,255,255,0 + db 1,4,255,255,255,255,255,255,255,255,13 + + db "DREAMWEB.R14",0 + db 14,255,44,20 + db 255,255,255,0 + db 0,6,255,255,255,255,255,255,255,255,14 + + db 32 dup (0) + db 32 dup (0) + db 32 dup (0) + db 32 dup (0) + + db "DREAMWEB.R19",0 + db 19,255,0,0 + db 255,255,255,0 + db 0,4,255,255,255,255,255,255,255,255,19 + + db "DREAMWEB.R20",0 + db 22,255,0,20 + db 255,255,255,0 + db 1,4,2,15,255,255,255,255,255,255,20 + + db "DREAMWEB.R21",0 + if demo + db 22,255,11,10 + else + db 5,255,11,10 + endif + db 255,255,255,0 + db 1,4,2,15,1,255,255,255,255,255,21 + + db "DREAMWEB.R22",0 + db 22,255,22,10 + db 255,255,255,0 + db 0,4,255,255,1,255,255,255,255,255,22 + + db "DREAMWEB.R23",0 + db 23,255,22,30 + db 255,255,255,0 + db 1,4,2,15,3,255,255,255,255,255,23 + + db "DREAMWEB.R24",0 + db 5,255,44,0 + db 255,255,255,0 + db 1,6,2,15,255,255,255,255,255,255,24 + + db "DREAMWEB.R25",0 + db 22,255,11,40 + db 255,255,255,0 + db 1,0,255,255,255,255,255,255,255,255,25 + + db "DREAMWEB.R26",0 + db 9,255,22,20 + db 255,255,255,0 + db 4,2,255,255,255,255,255,255,255,255,26 + + db "DREAMWEB.R27",0 + db 22,255,11,20 + db 255,255,255,0 + db 0,6,255,255,255,255,255,255,255,255,27 + + db "DREAMWEB.R28",0 + db 5,255,11,30 + db 255,255,255,0 + db 0,0,255,255,2,255,255,255,255,255,28 + + db "DREAMWEB.R29",0 + db 22,255,11,10 + db 255,255,255,0 + db 0,2,255,255,255,255,255,255,255,255,29 + + + + db "DREAMWEB.R05",0 ;Duplicate of hotel lobby, + if demo + db 22,255,22,10 ;but emerging from the lift. + else + db 5,255,22,10 + endif + db 255,255,255,0 + db 1,4,1,15,255,255,255,255,255,255,5 + + db "DREAMWEB.R04",0 ;Duplicate of pool hall lobby, + db 23,255,22,20 ;but emerging from the lift. + db 255,255,255,0 + db 1,4,2,15,255,255,255,255,255,255,4 + + db "DREAMWEB.R10",0 ;entering alley via skip + db 10,255,22,30 + db 255,255,255,0 + db 3,6,255,255,255,255,255,255,255,255,10 + + db "DREAMWEB.R12",0 ;on the beach, getting up. + db 12,255,22,20 + db 255,255,255,0 + db 0,2,255,255,255,255,255,255,255,255,12 + + db "DREAMWEB.R03",0 ;Duplicate of Eden's lobby + db 5,255,44,0 ;but emerging from the lift + db 255,255,255,0 + db 1,6,2,255,4,255,255,255,255,255,3 + + db "DREAMWEB.R24",0 ;Duplicate of Eden's flat + db 5,255,22,0 ;but starting on the bed + db 255,255,255,0 + db 3,6,0,255,255,255,255,33,0,3,24 ; 33,0,3 turns off + ; path for lift + db "DREAMWEB.R22",0 ;Duplicate + db 22,255,22,20 ;of hotel but in pool room + db 255,255,255,0 + db 1,4,255,255,255,255,255,255,255,255,22 + + db "DREAMWEB.R22",0 ;Duplicate + db 22,255,22,20 ;of hotel but in pool room + db 255,255,255,0 ;coming out of bedroom + db 0,2,255,255,255,255,255,255,255,255,22 + + db "DREAMWEB.R11",0 ;Duplicate + db 11,255,22,30 ;of carpark but getting + db 255,255,255,0 ;up off the floor + db 0,0,255,255,255,255,255,255,255,255,11 + + db "DREAMWEB.R28",0 + db 5,255,11,20 + db 255,255,255,0 + db 0,6,255,255,2,255,255,255,255,255,28 + + db "DREAMWEB.R21",0 + if demo + db 22,255,11,10 + else + db 5,255,11,10 + endif + db 255,255,255,0 + db 1,4,2,15,1,255,255,255,255,255,21 + + db "DREAMWEB.R26",0 + db 9,255,0,40 + db 255,255,255,0 + db 0,0,255,255,255,255,255,255,255,255,26 + + db "DREAMWEB.R19",0 + db 19,255,0,0 + db 255,255,255,0 + db 2,2,255,255,255,255,255,255,255,255,19 + + db "DREAMWEB.R08",0 ;leaving tvstudio into street + db 8,255,11,40 + db 255,255,255,0 + db 0,4,255,255,255,255,255,255,255,255,8 + + db "DREAMWEB.R01",0 + db 1,255,44,10 + db 255,255,255,0 + db 3,6,255,255,255,255,255,255,255,255,1 + + + + db "DREAMWEB.R45",0 ;Dream room + db 35,255,22,30 + db 255,255,255,0 + db 0,6,255,255,255,255,255,255,255,255,45 + + db "DREAMWEB.R46",0 ;Dream room + db 35,255,22,40 + db 255,255,255,0 + db 0,4,255,255,255,255,255,255,255,255,46 + + db "DREAMWEB.R47",0 ;Dream room + db 35,255,0,0 + db 255,255,255,0 + db 0,0,255,255,255,255,255,255,255,255,47 + + db "DREAMWEB.R45",0 ;Dream room + db 35,255,22,30 + db 255,255,255,0 + db 4,0,255,255,255,255,255,255,255,255,45 + + db "DREAMWEB.R46",0 ;Dream room + db 35,255,22,50 + db 255,255,255,0 + db 0,4,255,255,255,255,255,255,255,255,46 + + + + db "DREAMWEB.R50",0 ; Intro sequence one + db 35,255,22,30 + db 255,255,255,0 + db 0,0,255,255,255,255,255,255,255,255,50 + + db "DREAMWEB.R51",0 ; Intro sequence two + db 35,255,11,30 + db 255,255,255,0 + db 0,0,255,255,255,255,255,255,255,255,51 + + db "DREAMWEB.R52",0 ; Intro sequence three + db 35,255,22,30 + db 255,255,255,0 + db 0,0,255,255,255,255,255,255,255,255,52 + + db "DREAMWEB.R53",0 ; Intro sequence four + db 35,255,33,0 + db 255,255,255,0 + db 0,0,255,255,255,255,255,255,255,255,53 + + db "DREAMWEB.R54",0 ; Intro sequence five - wasteland + db 35,255,0,0 + db 255,255,255,0 + db 0,0,255,255,255,255,255,255,255,255,54 + + db "DREAMWEB.R55",0 ; End sequence + db 14,255,44,0 + db 255,255,255,0 + db 0,0,255,255,255,255,255,255,255,255,55 + + +Madeuproomdat db 32 dup (0) + +Roomscango db 1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0 + +Roompics db 5,0,3,2,4,1,10,9,8,6,11,4,7,7,0 + +Oplist db 3 dup (0) + +Inputline db 128 dup (0) + +linedata dw 200 dup (0ffffh) + +presslist db 6 dup (255) + +savenames db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + db 2,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 + + + +savefiles db "DREAMWEB.D00",0 + db "DREAMWEB.D01",0 + db "DREAMWEB.D02",0 + db "DREAMWEB.D03",0 + db "DREAMWEB.D04",0 + db "DREAMWEB.D05",0 + db "DREAMWEB.D06",0 + +Recname db "DREAMWEB.DEM",0 + + +;-------------------------------------------------------End of code segment---- + +DREAMWEBPROG ends + + + + +;---------------------------------------------------------------Stack space----s + +STACKSPACE segment para stack 'STACK' + +stak db 256 dup (?) + +STACKSPACE ends + + + +;-----------------------------------------------------------End of all code---- + + end Dreamweb + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/keypad.asm b/devtools/tasmrecover/dreamweb/keypad.asm new file mode 100644 index 0000000000..9ddce697f2 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/keypad.asm @@ -0,0 +1,1758 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +Entercode proc near + + mov keypadax,ax + mov keypadcx,cx + call getridofreels + call loadkeypad + call createpanel + call showicon + call showouterpad + call showkeypad + call readmouse + call showpointer + call worktoscreen + call delpointer + mov presspointer,0 + mov getback,0 + +keypadloop: call delpointer + call readmouse + call showkeypad + call showpointer + cmp presscount,0 + jz nopresses + dec presscount + jmp afterpress +nopresses: mov pressed,255 + mov graphicpress,255 + call vsync + +afterpress: call dumppointer + call dumpkeypad + call dumptextline + mov bx,offset cs:keypadlist + call checkcoords + cmp getback,1 + jz numberright + + cmp lightcount,1 + jnz notendkey + cmp lockstatus,0 + jz numberright + jmp keypadloop + +notendkey: cmp presscount,40 + jnz keypadloop + call addtopresslist + cmp pressed,11 + jnz keypadloop + mov ax,keypadax + mov cx,keypadcx + call isitright + jnz incorrect + mov lockstatus,0 + mov al,11 + call playchannel1 + mov lightcount,120 + mov presspointer,0 + jmp keypadloop +incorrect: mov al,11 + call playchannel1 + mov lightcount,120 + mov presspointer,0 + jmp keypadloop + +numberright: mov manisoffscreen,0 + call getridoftemp + call restorereels + call redrawmainscrn + call worktoscreenm + ret + +keypadlist: dw keypadx+9,keypadx+30,keypady+9,keypady+22,buttonone + dw keypadx+31,keypadx+52,keypady+9,keypady+22,buttontwo + dw keypadx+53,keypadx+74,keypady+9,keypady+22,buttonthree + dw keypadx+9,keypadx+30,keypady+23,keypady+40,buttonfour + dw keypadx+31,keypadx+52,keypady+23,keypady+40,buttonfive + dw keypadx+53,keypadx+74,keypady+23,keypady+40,buttonsix + dw keypadx+9,keypadx+30,keypady+41,keypady+58,buttonseven + dw keypadx+31,keypadx+52,keypady+41,keypady+58,buttoneight + dw keypadx+53,keypadx+74,keypady+41,keypady+58,buttonnine + dw keypadx+9,keypadx+30,keypady+59,keypady+73,buttonnought + dw keypadx+31,keypadx+74,keypady+59,keypady+73,buttonenter + dw keypadx+72,keypadx+86,keypady+80,keypady+94,quitkey + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + + + + +Loadkeypad proc near + + mov dx,offset cs:extragraphics1 + call loadintotemp + ret + + endp + + + + +Quitkey proc near + + cmp commandtype,222 + jz alreadyqk + mov commandtype,222 + mov al,4 + call commandonly +alreadyqk: mov ax,mousebutton + cmp ax,oldbutton + jz notqk + and ax,1 + jnz doqk +notqk: ret + +doqk: mov getback,1 + ret + + endp + + + + + + + + + + + + + + + + + + +Addtopresslist proc near + + cmp presspointer,5 + jz nomorekeys + mov al,pressed + cmp al,10 + jnz not10 + mov al,0 +not10: mov bx,presspointer + mov dx,seg presslist + mov es,dx + add bx,offset es:presslist + mov [es:bx],al + inc presspointer +nomorekeys: ret + + endp + + + + +Buttonone proc near + + mov cl,1 + call buttonpress + ret + + endp + + +Buttontwo proc near + + mov cl,2 + call buttonpress + ret + + endp + + + +Buttonthree proc near + + mov cl,3 + call buttonpress + ret + + endp + + + +Buttonfour proc near + + mov cl,4 + call buttonpress + ret + + endp + + +Buttonfive proc near + + mov cl,5 + call buttonpress + ret + + endp + + + +Buttonsix proc near + + mov cl,6 + call buttonpress + ret + + endp + + +Buttonseven proc near + + mov cl,7 + call buttonpress + ret + + endp + + +Buttoneight proc near + + mov cl,8 + call buttonpress + ret + + endp + +Buttonnine proc near + + mov cl,9 + call buttonpress + ret + + endp + + + +Buttonnought proc near + + mov cl,10 + call buttonpress + ret + + endp + + + + + + +Buttonenter proc near + + mov cl,11 + call buttonpress + ret + + endp + + + +Buttonpress proc near + + mov ch,cl + add ch,100 + cmp commandtype,ch + jz alreadyb + mov commandtype,ch + mov al,cl + add al,4 + push cx + call commandonly + pop cx +alreadyb: mov ax,mousebutton + cmp ax,oldbutton + jz notb + and ax,1 + jnz dob +notb: ret + +dob: mov pressed,cl + add cl,21 + mov graphicpress,cl + mov presscount,40 + cmp cl,32 + jz nonoise + mov al,10 + call playchannel1 +nonoise: ret + + endp + + + + + + + + + + + + + + +Showouterpad proc near + + mov di,keypadx-3 + mov bx,keypady-4 + mov ds,tempgraphics + mov al,1 + mov ah,0 + call showframe + mov di,keypadx+74 + mov bx,keypady+76 + mov ds,tempgraphics + mov al,37 + mov ah,0 + call showframe + ret + + endp + + + + + + + + + + +Showkeypad proc near + + mov al,22 + mov di,keypadx+9 + mov bx,keypady+5 + call singlekey + mov al,23 + mov di,keypadx+31 + mov bx,keypady+5 + call singlekey + mov al,24 + mov di,keypadx+53 + mov bx,keypady+5 + call singlekey + + mov al,25 + mov di,keypadx+9 + mov bx,keypady+23 + call singlekey + mov al,26 + mov di,keypadx+31 + mov bx,keypady+23 + call singlekey + mov al,27 + mov di,keypadx+53 + mov bx,keypady+23 + call singlekey + + mov al,28 + mov di,keypadx+9 + mov bx,keypady+41 + call singlekey + mov al,29 + mov di,keypadx+31 + mov bx,keypady+41 + call singlekey + mov al,30 + mov di,keypadx+53 + mov bx,keypady+41 + call singlekey + + mov al,31 + mov di,keypadx+9 + mov bx,keypady+59 + call singlekey + mov al,32 + mov di,keypadx+31 + mov bx,keypady+59 + call singlekey + + cmp lightcount,0 + jz notenter + dec lightcount + mov al,36 + mov bx,keypady-1+63 + cmp lockstatus,0 + jnz changelight + mov al,41 + mov bx,keypady+4+63 +changelight: cmp lightcount,60 + jc gotlight + cmp lightcount,100 + jnc gotlight + dec al +gotlight: mov ds,tempgraphics + mov ah,0 + mov di,keypadx+60 + call showframe + +notenter: ret + + endp + + + + + +Singlekey proc near + + cmp graphicpress,al + jnz gotkey + add al,11 + cmp presscount,8 + jnc gotkey + sub al,11 +; cmp presscount,10 +; jnc gotkey +; sub al,11 +gotkey: mov ds,tempgraphics + sub al,20 + mov ah,0 + call showframe + ret + + endp + + + + + + + + + +Dumpkeypad proc near + + mov di,keypadx-3 + mov bx,keypady-4 + mov cl,120 + mov ch,90 + call multidump + ret + + endp + + + + + +;--------------------------------- + + + + +Usemenu proc near + + call getridofreels + call loadmenu + call createpanel + call showpanel + call showicon + mov newobs,0 + call drawfloor + call printsprites + + mov al,4 + mov ah,0 + mov di,menux-48 + mov bx,menuy-4 + mov ds,tempgraphics2 + call showframe + call getundermenu + mov al,5 + mov ah,0 + mov di,menux+54 + mov bx,menuy+72 + mov ds,tempgraphics2 + call showframe + + + call worktoscreenm + mov getback,0 + +menuloop: call delpointer + call putundermenu + call showmenu + call readmouse + call showpointer + call vsync + call dumppointer + call dumpmenu + call dumptextline + mov bx,offset cs:menulist + call checkcoords + cmp getback,1 + jnz menuloop + + mov manisoffscreen,0 + call redrawmainscrn + call getridoftemp + call getridoftemp2 + call restorereels + call worktoscreenm + ret + +menulist: dw menux+54,menux+68,menuy+72,menuy+88,quitkey + dw 0,320,0,200,blank + dw 0ffffh + + ret + + endp + + + + + + + +Dumpmenu proc near + + mov di,menux + mov bx,menuy + mov cl,48 + mov ch,48 + call multidump + ret + + endp + + + + + + +Getundermenu proc near + + mov di,menux + mov bx,menuy + mov cl,48 + mov ch,48 + mov ds,buffers + mov si,undertimedtext + call multiget + ret + + endp + + + + + + + + +Putundermenu proc near + + mov di,menux + mov bx,menuy + mov cl,48 + mov ch,48 + mov ds,buffers + mov si,undertimedtext + call multiput + ret + + endp + + + +Showoutermenu proc near + + mov al,40 + mov ah,0 + mov di,menux-34 + mov bx,menuy-40 + mov ds,tempgraphics + call showframe + mov al,41 + mov ah,0 + mov di,menux+64-34 + mov bx,menuy-40 + mov ds,tempgraphics + call showframe + mov al,42 + mov ah,0 + mov di,menux-26 + mov bx,menuy+57-40 + mov ds,tempgraphics + call showframe + mov al,43 + mov ah,0 + mov di,menux+64-26 + mov bx,menuy+57-40 + mov ds,tempgraphics + call showframe + ret + + endp + + + + + + + + +Showmenu proc near + + inc menucount + cmp menucount,37*2 + jnz menuframeok + mov menucount,0 +menuframeok: mov al,menucount + shr al,1 + mov ah,0 + mov di,menux + mov bx,menuy + mov ds,tempgraphics + call showframe + ret + + endp + + + +Loadmenu proc near + + mov dx,offset cs:spritename3 + call loadintotemp + mov dx,offset cs:mongraphics2 + call loadintotemp2 + ret + + endp + + + + + + + + + + + + + + + + +Viewfolder proc near + + mov manisoffscreen,1 + call getridofall + call loadfolder + mov folderpage,0 + call showfolder + call worktoscreenm + mov getback,0 + +folderloop: call delpointer + call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + mov bx,offset cs:folderlist + call checkcoords + cmp getback,0 + jz folderloop + + mov manisoffscreen,0 + call getridoftemp + call getridoftemp2 + call getridoftemp3 + call getridoftempcharset + call restoreall + call redrawmainscrn + call worktoscreenm + ret + +folderlist: dw 280,320,160,200,quitkey + dw 143,300,6,194,nextfolder + dw 0,143,6,194,lastfolder + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + +Nextfolder proc near + + cmp folderpage,12 + jnz cannextf + call blank + ret +cannextf: cmp commandtype,201 + jz alreadynextf + mov commandtype,201 + mov al,16 + call commandonly +alreadynextf: mov ax,mousebutton + cmp ax,oldbutton + jz notnextf + cmp ax,1 + jz donextf +notnextf: ret +donextf: inc folderpage + call folderhints + call delpointer + call showfolder + mov mousebutton,0 + mov bx,offset cs:folderlist + call checkcoords + call worktoscreenm + ret + + endp + + + + +Folderhints proc near + + cmp folderpage,5 + jnz notaideadd + cmp aidedead,1 + jz notaideadd + mov al,13 + call getlocation + cmp al,1 + jz notaideadd + mov al,13 + call setlocation + call showfolder + mov al,30 + call findtext1 + mov di,0 + mov bx,86 + mov dl,141 + mov ah,16 + call printdirect + call worktoscreenm + mov cx,200 + call hangonp + ret + +notaideadd: cmp folderpage,9 + jnz notaristoadd + mov al,7 + call getlocation + cmp al,1 + jz notaristoadd + mov al,7 + call setlocation + call showfolder + mov al,31 + call findtext1 + mov di,0 + mov bx,86 + mov dl,141 + mov ah,16 + call printdirect + call worktoscreenm + mov cx,200 + call hangonp +notaristoadd: ret + + endp + + + +Lastfolder proc near + + cmp folderpage,0 + jnz canlastf + call blank + ret +canlastf: cmp commandtype,202 + jz alreadylastf + mov commandtype,202 + mov al,17 + call commandonly +alreadylastf: cmp folderpage,0 + jz notlastf + mov ax,mousebutton + cmp ax,oldbutton + jz notlastf + cmp ax,1 + jz dolastf +notlastf: ret +dolastf: dec folderpage + call delpointer + call showfolder + mov mousebutton,0 + mov bx,offset cs:folderlist + call checkcoords + call worktoscreenm + ret + + endp + + + +Loadfolder proc near + + mov dx,offset cs:foldergraphic1 + call loadintotemp + mov dx,offset cs:foldergraphic2 + call loadintotemp2 + mov dx,offset cs:foldergraphic3 + call loadintotemp3 + mov dx,offset cs:characterset3 + call loadtempcharset + mov dx,offset cs:foldertext + call loadtemptext + ret + + endp + + + + +Showfolder proc near + + mov commandtype,255 + cmp folderpage,0 + jz closedfolder + call usetempcharset + call createpanel2 + mov ds,tempgraphics + mov di,0 + mov bx,0 + mov al,0 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,143 + mov bx,0 + mov al,1 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,0 + mov bx,92 + mov al,2 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,143 + mov bx,92 + mov al,3 + mov ah,0 + call showframe + call folderexit + + cmp folderpage,1 + jz noleftpage + call showleftpage +noleftpage: cmp folderpage,12 + jz norightpage + call showrightpage +norightpage: call usecharset1 + call undertextline + ret + +closedfolder: call createpanel2 + mov ds,tempgraphics3 + mov di,143-28 + mov bx,0 + mov al,0 + mov ah,0 + call showframe + mov ds,tempgraphics3 + mov di,143-28 + mov bx,92 + mov al,1 + mov ah,0 + call showframe + call folderexit + call undertextline + ret + + endp + + + + + + + + +Folderexit proc near + + mov ds,tempgraphics2 + mov di,296 + mov bx,178 + mov al,6 + mov ah,0 + call showframe + ret + + endp + + + + + +Showleftpage proc near + + mov ds,tempgraphics2 + mov di,0 + mov bx,12 + mov al,3 + mov ah,0 + call showframe + + mov bx,12+5 + mov cx,9 +leftpageloop: push cx bx + mov ds,tempgraphics2 + mov di,0 + mov al,4 + mov ah,0 + call showframe + pop bx cx + add bx,16 + loop leftpageloop + + mov ds,tempgraphics2 + mov di,0 + mov al,5 + mov ah,0 + call showframe + + mov linespacing,8 + mov charshift,91 + mov kerning,1 + mov bl,folderpage + dec bl + dec bl + add bl,bl + mov bh,0 + add bx,bx + mov es,textfile1 + mov si,[es:bx] + add si,66*2 + mov di,2 + mov bx,48 + mov dl,140 + mov cx,2 +twolotsleft: push cx +contleftpage: call printdirect + add bx,linespacing + cmp al,0 + jnz contleftpage + pop cx + loop twolotsleft + + mov kerning,0 + mov charshift,0 + mov linespacing,10 + + mov es,workspace + mov ds,workspace + mov di,(48*320)+2 + mov si,(48*320)+2+130 + mov cx,120 +flipfolder: push cx di si + mov cx,65 +flipfolderline: mov al,[es:di] + mov ah,[es:si] + mov [es:di],ah + mov [es:si],al + dec si + inc di + loop flipfolderline + pop si di cx + add si,320 + add di,320 + loop flipfolder + ret + + endp + + + +Showrightpage proc near + + mov ds,tempgraphics2 + mov di,143 + mov bx,12 + mov al,0 + mov ah,0 + call showframe + + mov bx,12+37 + mov cx,7 +rightpageloop: push cx bx + mov ds,tempgraphics2 + mov di,143 + mov al,1 + mov ah,0 + call showframe + pop bx cx + add bx,16 + loop rightpageloop + + mov ds,tempgraphics2 + mov di,143 + mov al,2 + mov ah,0 + call showframe + + mov linespacing,8 + mov kerning,1 + mov bl,folderpage + dec bl + add bl,bl + mov bh,0 + add bx,bx + mov es,textfile1 + mov si,[es:bx] + add si,66*2 + mov di,152 + mov bx,48 + mov dl,140 + mov cx,2 +twolotsright: push cx +contrightpage: call printdirect + add bx,linespacing + cmp al,0 + jnz contrightpage + pop cx + loop twolotsright + + mov kerning,0 + mov linespacing,10 + ret + + endp + + + + + + + + + +Entersymbol proc near + + mov manisoffscreen,1 + call getridofreels + mov dx,offset cs:symbolgraphic + call loadintotemp + mov symboltopx,24 + mov symboltopdir,0 + mov symbolbotx,24 + mov symbolbotdir,0 + call redrawmainscrn + call showsymbol + call undertextline + call worktoscreenm + mov getback,0 + +symbolloop: call delpointer + call updatesymboltop + call updatesymbolbot + call showsymbol + call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + call dumpsymbol + mov bx,offset cs:symbollist + call checkcoords + cmp getback,0 + jz symbolloop + + cmp symbolbotnum,3 + jnz symbolwrong + cmp symboltopnum,5 + jnz symbolwrong + mov al,43 + call removesetobject + mov al,46 + call placesetobject + mov ah,roomnum + add ah,12 + mov al,0 + call turnanypathon + mov manisoffscreen,0 + call redrawmainscrn + call getridoftemp + call restorereels + call worktoscreenm + mov al,13 + call playchannel1 + ret + +symbolwrong: mov al,46 + call removesetobject + mov al,43 + call placesetobject + mov ah,roomnum + add ah,12 + mov al,0 + call turnanypathoff + mov manisoffscreen,0 + call redrawmainscrn + call getridoftemp + call restorereels + call worktoscreenm + ret + +symbollist: dw symbolx+40,symbolx+64,symboly+2,symboly+16,quitsymbol + dw symbolx,symbolx+52,symboly+20,symboly+50,settopleft + dw symbolx+52,symbolx+104,symboly+20,symboly+50,settopright + dw symbolx,symbolx+52,symboly+50,symboly+80,setbotleft + dw symbolx+52,symbolx+104,symboly+50,symboly+80,setbotright + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + + + + + + + + + + + + +Quitsymbol proc near + + cmp symboltopx,24 + jnz blank + cmp symbolbotx,24 + jnz blank + cmp commandtype,222 + jz alreadyqs + mov commandtype,222 + mov al,18 + call commandonly +alreadyqs: mov ax,mousebutton + cmp ax,oldbutton + jz notqs + and ax,1 + jnz doqs +notqs: ret + +doqs: mov getback,1 + ret + + endp + + + + +Settopleft proc near + + cmp symboltopdir,0 + jnz blank + cmp commandtype,210 + jz alreadytopl + mov commandtype,210 + mov al,19 + call commandonly +alreadytopl: cmp mousebutton,0 + jz notopleft + mov symboltopdir,-1 +notopleft: ret + + endp + + + +Settopright proc near + + cmp symboltopdir,0 + jnz blank + cmp commandtype,211 + jz alreadytopr + mov commandtype,211 + mov al,20 + call commandonly +alreadytopr: cmp mousebutton,0 + jz notopright + mov symboltopdir,1 +notopright: ret + + endp + + + + +Setbotleft proc near + + cmp symbolbotdir,0 + jnz blank + cmp commandtype,212 + jz alreadybotl + mov commandtype,212 + mov al,21 + call commandonly +alreadybotl: cmp mousebutton,0 + jz nobotleft + mov symbolbotdir,-1 +nobotleft: ret + + endp + + + +Setbotright proc near + + cmp symbolbotdir,0 + jnz blank + cmp commandtype,213 + jz alreadybotr + mov commandtype,213 + mov al,22 + call commandonly +alreadybotr: cmp mousebutton,0 + jz nobotright + mov symbolbotdir,1 +nobotright: ret + + endp + + + + + + + +Dumpsymbol proc near + + mov newtextline,0 + mov di,symbolx + mov bx,symboly+20 + mov cl,104 + mov ch,60 + call multidump + ret + + endp + + + + +Showsymbol proc near + + mov al,12 + mov ah,0 + mov di,symbolx + mov bx,symboly + mov ds,tempgraphics + call showframe + + mov al,symboltopx + mov ah,0 + mov di,ax + add di,symbolx-44 + mov al,symboltopnum + mov bx,symboly+20 + mov ds,tempgraphics + mov ah,32 + push ax di bx ds + call showframe + pop ds bx di ax + call nextsymbol + add di,49 + push ax di bx ds + call showframe + pop ds bx di ax + call nextsymbol + add di,49 + call showframe + + mov al,symbolbotx + mov ah,0 + mov di,ax + add di,symbolx-44 + mov al,symbolbotnum + add al,6 + mov bx,symboly+49 + mov ds,tempgraphics + mov ah,32 + push ax di bx ds + call showframe + pop ds bx di ax + call nextsymbol + add di,49 + push ax di bx ds + call showframe + pop ds bx di ax + call nextsymbol + add di,49 + call showframe + ret + + endp + + + + + + +Nextsymbol proc near + + inc al + cmp al,6 + jz topwrap + cmp al,12 + jz botwrap + ret +topwrap: mov al,0 + ret +botwrap: mov al,6 + ret + + endp + + + +Updatesymboltop proc near + + cmp symboltopdir,0 + jz topfinished + cmp symboltopdir,-1 + jz backwards + + inc symboltopx + cmp symboltopx,49 + jnz notwrapfor + mov symboltopx,0 + dec symboltopnum + cmp symboltopnum,-1 + jnz topfinished + mov symboltopnum,5 + ret +notwrapfor: cmp symboltopx,24 + jnz topfinished + mov symboltopdir,0 + ret + +backwards: dec symboltopx + cmp symboltopx,-1 + jnz notwrapback + mov symboltopx,48 + inc symboltopnum + cmp symboltopnum,6 + jnz topfinished + mov symboltopnum,0 + ret +notwrapback: cmp symboltopx,24 + jnz topfinished + mov symboltopdir,0 +topfinished: ret + + endp + + + +Updatesymbolbot proc near + + cmp symbolbotdir,0 + jz botfinished + cmp symbolbotdir,-1 + jz backwardsbot + + inc symbolbotx + cmp symbolbotx,49 + jnz notwrapforb + mov symbolbotx,0 + dec symbolbotnum + cmp symbolbotnum,-1 + jnz botfinished + mov symbolbotnum,5 + ret +notwrapforb: cmp symbolbotx,24 + jnz botfinished + mov symbolbotdir,0 + ret + +backwardsbot: dec symbolbotx + cmp symbolbotx,-1 + jnz notwrapbackb + mov symbolbotx,48 + inc symbolbotnum + cmp symbolbotnum,6 + jnz botfinished + mov symbolbotnum,0 + ret +notwrapbackb: cmp symbolbotx,24 + jnz botfinished + mov symbolbotdir,0 +botfinished: ret + + endp + + + + + + + + + + +Dumpsymbox proc near + + cmp dumpx,-1 + jz nodumpsym + mov di,dumpx + mov bx,dumpy + mov cl,30 + mov ch,77;30 + call multidump + mov dumpx,-1 +nodumpsym: ret + + endp + + + + + + + +Usediary proc near + + call getridofreels + mov dx,offset cs:diarygraphic + call loadintotemp + mov dx,offset cs:diarytext + call loadtemptext + + mov dx,offset cs:characterset3 + call loadtempcharset + call createpanel + call showicon + call showdiary + call undertextline + call showdiarypage + call readmouse + call showpointer + call worktoscreen + call delpointer + mov getback,0 + +diaryloop: call delpointer + call readmouse + call showdiarykeys + call showpointer + call vsync + call dumppointer + call dumpdiarykeys + call dumptextline + mov bx,offset cs:diarylist + call checkcoords + cmp getback,0 + jz diaryloop + + call getridoftemp + call getridoftemptext + call getridoftempcharset + call restorereels + mov manisoffscreen,0 + call redrawmainscrn + call worktoscreenm + ret + +diarylist: dw diaryx+94,diaryx+110,diaryy+97,diaryy+113,diarykeyn + dw diaryx+151,diaryx+167,diaryy+71,diaryy+87,diarykeyp + dw diaryx+176,diaryx+192,diaryy+108,diaryy+124,quitkey + dw 0,320,0,200,blank + dw 0ffffh + + ret + + endp + + + + + + + +Showdiary proc near + + mov al,1 + mov ah,0 + mov di,diaryx + mov bx,diaryy+37 + mov ds,tempgraphics + call showframe + mov al,2 + mov ah,0 + mov di,diaryx+176 + mov bx,diaryy+108 + mov ds,tempgraphics + call showframe + ret + + endp + + + + +Showdiarykeys proc near + + cmp presscount,0 + jz nokeyatall + dec presscount + cmp presscount,0 + jz nokeyatall + cmp pressed,"N" + jnz nokeyn + mov al,3 + cmp presscount,1 + jz gotkeyn + mov al,4 +gotkeyn: mov ah,0 + mov di,diaryx+94 + mov bx,diaryy+97 + mov ds,tempgraphics + call showframe + cmp presscount,1 + jnz notshown + call showdiarypage +notshown: ret + +nokeyn: mov al,5 + cmp presscount,1 + jz gotkeyp + mov al,6 +gotkeyp: mov ah,0 + mov di,diaryx+151 + mov bx,diaryy+71 + mov ds,tempgraphics + call showframe + cmp presscount,1 + jnz notshowp + call showdiarypage +notshowp: ret + +nokeyatall: ret + + endp + + + + + + +Dumpdiarykeys proc near + + cmp presscount,1 + jnz notdumpdiary + cmp sartaindead,1 + jz notsartadd + cmp diarypage,5 + jnz notsartadd + cmp diarypage,5 + jnz notsartadd + mov al,6 + call getlocation + cmp al,1 + jz notsartadd + mov al,6 + call setlocation + + call delpointer + mov al,12 + call findtext1 + mov di,70 ;diaryx+48 + mov bx,106 ;diaryy+16 + mov dl,241 + mov ah,16 + call printdirect + + call worktoscreenm + mov cx,200 + call hangonp + call createpanel + call showicon + call showdiary + call showdiarypage + call worktoscreenm + call showpointer + ret + +notsartadd: mov di,diaryx+48 + mov bx,diaryy+15 + mov cl,200 + mov ch,16 + call multidump +notdumpdiary: mov di,diaryx+94 + mov bx,diaryy+97 + mov cl,16 + mov ch,16 + call multidump + mov di,diaryx+151 + mov bx,diaryy+71 + mov cl,16 + mov ch,16 + call multidump + ret + + endp + + + +Diarykeyp proc near + + cmp commandtype,214 + jz alreadykeyp + mov commandtype,214 + mov al,23 + call commandonly +alreadykeyp: cmp mousebutton,0 + jz notkeyp + mov ax,oldbutton + cmp ax,mousebutton + jz notkeyp + cmp presscount,0 + jnz notkeyp + mov al,16 + call playchannel1 + mov presscount,12 + mov pressed,"P" + dec diarypage + cmp diarypage,-1 + jnz notkeyp + mov diarypage,11 +notkeyp: ret + + endp + + + +Diarykeyn proc near + + cmp commandtype,213 + jz alreadykeyn + mov commandtype,213 + mov al,23 + call commandonly +alreadykeyn: cmp mousebutton,0 + jz notkeyn + mov ax,oldbutton + cmp ax,mousebutton + jz notkeyn + cmp presscount,0 + jnz notkeyn + mov al,16 + call playchannel1 + mov presscount,12 + mov pressed,"N" + inc diarypage + cmp diarypage,12 + jnz notkeyn + mov diarypage,0 +notkeyn: ret + + endp + + + + + + +Showdiarypage proc near + + mov al,0 + mov ah,0 + mov di,diaryx + mov bx,diaryy + mov ds,tempgraphics + call showframe + + mov al,diarypage + call findtext1 + + mov kerning,1 + call usetempcharset + mov di,diaryx+48 + mov bx,diaryy+16 + mov dl,240 + mov ah,16 + mov charshift,91+91 + call printdirect + + mov di,diaryx+129 + mov bx,diaryy+16 + mov dl,240 + mov ah,16 + call printdirect + + mov di,diaryx+48 + mov bx,diaryy+23 + mov dl,240 + mov ah,16 + call printdirect + + mov kerning,0 + mov charshift,0 + call usecharset1 + ret + + endp + + + + + +Findtext1 proc near + + mov ah,0 + mov si,ax + add si,si + mov es,textfile1 + mov ax,[es:si] + add ax,textstart + mov si,ax + ret + + endp + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/look.asm b/devtools/tasmrecover/dreamweb/look.asm new file mode 100644 index 0000000000..11ee24beb6 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/look.asm @@ -0,0 +1,167 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +;---------------------------------------------------------------Look-routine---- + +Autolook proc near + + mov ax,mousex + cmp ax,oldx + jnz diffmouse + mov ax,mousey + cmp ax,oldy + jnz diffmouse + + dec lookcounter + cmp lookcounter,0 + jnz noautolook + cmp watchingtime,0 + jnz noautolook + call dolook +noautolook: ret + +diffmouse: mov lookcounter,1000 + ret + + endp + + + + +Look proc near + + cmp watchingtime,0 + jnz blank + cmp pointermode,2 + jz blank + + cmp commandtype,241 + jz alreadylook + mov commandtype,241 + mov al,25 + call commandonly +alreadylook: cmp mousebutton,1 + jnz nolook + mov ax,mousebutton + cmp ax,oldbutton + jz nolook + call dolook +nolook: ret + + endp + + + + + +Dolook proc near + + call createpanel + call showicon + call undertextline + call worktoscreenm + + mov commandtype,255 + call dumptextline + + mov bl,roomnum + and bl,31 + mov bh,0 + add bx,bx + + mov es,roomdesc + add bx,intextdat + + mov si,[es:bx] + add si,intext + + call findnextcolon + + mov di,66 + cmp reallocation,50 + jc notdream3 + mov di,40 +notdream3: mov bx,80 + mov dl,241 + call printslow + + cmp al,1 + jz afterlook + mov cx,400 + call hangonp + +afterlook: mov pointermode,0 + mov commandtype,0 + call redrawmainscrn + call worktoscreenm + ret + + endp + + + + + + +Redrawmainscrn proc near + + mov timecount,0 + call createpanel + mov newobs,0 + call drawfloor + call printsprites + call reelsonscreen + call showicon + call getunderzoom + call undertextline + call readmouse + mov commandtype,255 + ret + + endp + + + + + + + + + + + + + + + +Getback1 proc near + + cmp pickup,0 + jz notgotobject + call blank + ret + +notgotobject: cmp commandtype,202 + jz alreadyget + mov commandtype,202 + mov al,26 + call commandonly +alreadyget: mov ax,mousebutton + cmp ax,oldbutton + jz nogetback + and ax,1 + jnz dogetback +nogetback: ret + +dogetback: mov getback,1 + mov pickup,0 + ret + + endp + + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/monitor.asm b/devtools/tasmrecover/dreamweb/monitor.asm new file mode 100644 index 0000000000..65b68cb94c --- /dev/null +++ b/devtools/tasmrecover/dreamweb/monitor.asm @@ -0,0 +1,1496 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +Usemon proc near + + mov lasttrigger,0 + + push cs ;start off with no file name + pop es + mov di,offset cs:currentfile+1 + mov cx,12 + mov al,32 + rep stosb + push cs ;start off with no file name + pop es + mov di,offset cs:operand1+1 + mov cx,12 + mov al,32 + rep stosb + + push cs ;clear all keys + pop es + mov di,offset cs:keys + mov byte ptr [es:di],1 + add di,26 + mov cx,3 +keyloop: mov byte ptr [es:di],0 + add di,26 + loop keyloop + + call createpanel + call showpanel + call showicon + call drawfloor + call getridofall ;reels + + mov dx,offset cs:mongraphicname + call loadintotemp + call loadpersonal + call loadnews + call loadcart + mov dx,offset cs:characterset2 + call loadtempcharset + + call printoutermon + call initialmoncols + call printlogo + call worktoscreen + call turnonpower + call fadeupyellows + call fadeupmonfirst + + mov monadx,76 + mov monady,141 + mov al,1 + call monmessage + mov cx,120 + call hangoncurs + mov al,2 + call monmessage + mov cx,60 + call randomaccess + mov al,3 + call monmessage + mov cx,100 + call hangoncurs + call printlogo + call scrollmonitor + mov bufferin,0 + mov bufferout,0 + +moreinput: mov di,monadx + mov bx,monady + push di bx + call input + pop bx di + mov monadx,di + mov monady,bx + call execcommand + cmp al,0 + jz moreinput + +endmon: call getridoftemp + call getridoftempcharset + mov es,textfile1 + call deallocatemem + mov es,textfile2 + call deallocatemem + mov es,textfile3 + call deallocatemem + mov getback,1 + mov al,26 + call playchannel1 + mov manisoffscreen,0 + call restoreall ;reels + call redrawmainscrn + call worktoscreenm + ret + + endp + + + + + + +Printoutermon proc near + + mov di,40 + mov bx,32 + mov ds,tempgraphics + mov al,1 + mov ah,0 + call showframe + mov di,264 + mov bx,32 + mov ds,tempgraphics + mov al,2 + mov ah,0 + call showframe + mov di,40 + mov bx,12 + mov ds,tempgraphics + mov al,3 + mov ah,0 + call showframe + mov di,40 + mov bx,164 + mov ds,tempgraphics + mov al,4 + mov ah,0 + call showframe + ret + + endp + + + + + + + +Loadpersonal proc near + + mov al,location + mov dx,offset cs:monitorfile1 + cmp al,0 + jz foundpersonal + cmp al,42 + jz foundpersonal + mov dx,offset cs:monitorfile2 + cmp al,2 + jz foundpersonal + +foundpersonal: call openfile + call readheader + mov bx,[es:di] + push bx + mov cl,4 + shr bx,cl + call allocatemem + mov textfile1,ax + mov ds,ax + pop cx + mov dx,0 + call readfromfile + call closefile + ret + + endp + + + + +Loadnews proc near ;textfile2 holds information + ;accessable by anyone + mov al,newsitem + mov dx,offset cs:monitorfile10 + cmp al,0 + jz foundnews + mov dx,offset cs:monitorfile11 + cmp al,1 + jz foundnews + mov dx,offset cs:monitorfile12 + cmp al,2 + jz foundnews + mov dx,offset cs:monitorfile13 +foundnews: call openfile + call readheader + mov bx,[es:di] + push bx + mov cl,4 + shr bx,cl + call allocatemem + mov textfile2,ax + mov ds,ax + pop cx + mov dx,0 + call readfromfile + call closefile + ret + + endp + + + + + + +Loadcart proc near + + call lookininterface + + mov dx,offset cs:monitorfile20 + cmp al,0 + jz gotcart + mov dx,offset cs:monitorfile21 + cmp al,1 + jz gotcart + mov dx,offset cs:monitorfile22 + cmp al,2 + jz gotcart + mov dx,offset cs:monitorfile23 + cmp al,3 + jz gotcart + mov dx,offset cs:monitorfile24 +gotcart: call openfile + call readheader + mov bx,[es:di] + push bx + mov cl,4 + shr bx,cl + call allocatemem + mov textfile3,ax + mov ds,ax + pop cx + mov dx,0 + call readfromfile + call closefile + ret + + endp + + + + + + +Lookininterface proc near + + mov al,"I" + mov ah,"N" + mov cl,"T" + mov ch,"F" + call findsetobject ;this bit searches set obs + ;until the interface is found + ;al holds object number + mov ah,1 ;ah holds type, 1=set object + call checkinside ;this searches for any extra + ;object inside the interface.. + cmp cl,numexobjects + jz emptyinterface + mov al,[es:bx+15] ;get the last letter of ID code + inc al + ret +emptyinterface: mov al,0 + ret + + endp + + + + + + + +Turnonpower proc near + + mov cx,3 +powerloop: push cx + call powerlighton + mov cx,30 + call hangon + call powerlightoff + mov cx,30 + call hangon + pop cx + loop powerloop + call powerlighton + ret + + endp + + + + + +Randomaccess proc near + +accessloop: push cx + call vsync + call vsync + call randomnum1 + and al,15 + cmp al,10 + jc off + call accesslighton + jmp chosenaccess +off: call accesslightoff +chosenaccess: pop cx + loop accessloop + call accesslightoff + ret + + endp + + + +Powerlighton proc near + + mov di,257+4 + mov bx,182 + mov ds,tempgraphics + mov al,6 + mov ah,0 + push di bx + call showframe + pop bx di + mov cl,12 + mov ch,8 + call multidump + ret + + endp + + + + +Powerlightoff proc near + + mov di,257+4 + mov bx,182 + mov ds,tempgraphics + mov al,5 + mov ah,0 + push di bx + call showframe + pop bx di + mov cl,12 + mov ch,8 + call multidump + ret + + endp + + + + +Accesslighton proc near + + mov di,74 + mov bx,182 + mov ds,tempgraphics + mov al,8 + mov ah,0 + push di bx + call showframe + pop bx di + mov cl,12 + mov ch,8 + call multidump + ret + + endp + + + + +Accesslightoff proc near + + mov di,74 + mov bx,182 + mov ds,tempgraphics + mov al,7 + mov ah,0 + push di bx + call showframe + pop bx di + mov cl,12 + mov ch,8 + call multidump + ret + + endp + + + + + +Locklighton proc near + + mov di,56 + mov bx,182 + mov ds,tempgraphics + mov al,10 + mov ah,0 + push di bx + call showframe + pop bx di + mov cl,12 + mov ch,8 + call multidump + ret + + endp + + + + +Locklightoff proc near + + mov di,56 + mov bx,182 + mov ds,tempgraphics + mov al,9 + mov ah,0 + push di bx + call showframe + pop bx di + mov cl,12 + mov ch,8 + call multidump + ret + + endp + + + + + + + + + + +Input proc near + + push cs + pop es + mov di,offset cs:inputline + mov cx,64 + mov al,0 + rep stosb + + mov curpos,0 + mov al,">" + mov di,monadx + mov bx,monady + mov ds,tempcharset + mov ah,0 + call printchar + mov di,monadx + mov bx,monady + mov cl,6 + mov ch,8 + call multidump + add monadx,6 + mov ax,monadx + mov curslocx,ax + mov ax,monady + mov curslocy,ax + +waitkey: call printcurs + call vsync + call delcurs + call readkey + mov al,currentkey + cmp al,0 + jz waitkey + cmp al,13 + jz endofinput + cmp al,8 + jnz notdel + cmp curpos,0 + jz waitkey + call delchar + jmp waitkey +notdel: cmp curpos,28 + jz waitkey + cmp currentkey,32 + jnz notleadingspace + cmp curpos,0 + jz waitkey +notleadingspace: call makecaps + push cs + pop es + mov si,curpos + add si,si + add si,offset cs:inputline + mov [es:si],al + + cmp al,"Z"+1 + jnc waitkey + + push ax es si + mov di,monadx + mov bx,monady + mov ds,mapstore + mov ax,curpos + xchg al,ah + mov si,ax + mov cl,8 + mov ch,8 + call multiget + pop si es ax + + push es si + mov di,monadx + mov bx,monady + mov ds,tempcharset + mov ah,0 + call printchar + pop si es + ;dec cx + mov [es:si+1],cl + mov ch,0 + add monadx,cx + inc curpos + add curslocx,cx + jmp waitkey + +endofinput: ret + + endp + + + + + + + + +Makecaps proc near + + cmp al,"a" + jc notupperc + sub al,32 +notupperc: ret + + endp + + + + + + + + + +Delchar proc near + + dec curpos + mov si,curpos + add si,si + push cs + pop es + add si,offset cs:inputline + mov byte ptr [es:si],0 + mov al,[es:si+1] + mov ah,0 + sub monadx,ax + sub curslocx,ax + mov di,monadx + mov bx,monady + mov ds,mapstore + mov ax,curpos + xchg al,ah + mov si,ax + mov cl,8 + mov ch,8 + call multiput + mov di,monadx + mov bx,monady + mov cl,al + mov ch,8 + call multidump + ret + + endp + + + + + + + +Execcommand proc near + + push cs + pop es + mov bx,offset cs:comlist + push cs + pop ds + mov si,offset cs:inputline + mov al,[si] + cmp al,0 + jnz notblankinp + call scrollmonitor + ret + +notblankinp: mov cl,0 +comloop: push bx si +comloop2: mov al,[si] + add si,2 + mov ah,[es:bx] + inc bx + cmp ah,32 + jz foundcom + cmp al,ah + jz comloop2 + pop si bx + add bx,10 + inc cl + cmp cl,6 + jnz comloop + call neterror + mov al,0 + ret +foundcom: pop si bx + cmp cl,1 + jz testcom + cmp cl,2 + jz directory + cmp cl,3 + jz accesscom + cmp cl,4 + jz signoncom + cmp cl,5 + jz keyscom + jmp quitcom + +directory: call dircom + mov al,0 + ret + +signoncom: call signon + mov al,0 + ret + +accesscom: call read + mov al,0 + ret + +keyscom: call showkeys + mov al,0 + ret + +testcom: mov al,6 + call monmessage + mov al,0 + ret + +quitcom: mov al,1 + ret + +comlist: db "EXIT " + db "HELP " + db "LIST " + db "READ " + db "LOGON " + db "KEYS " + +keys: db 1,0,"PUBLIC PUBLIC ",0 + db 0,0,"BLACKDRAGON RYAN ",0 + db 0,0,"HENDRIX LOUIS ",0 + db 0,0,"SEPTIMUS BECKETT ",0 + db 255,255 + +operand1: db " ",0 +rootdir: db 34,"ROOT ",0 +currentfile db 34," ",0 + + endp + + + + + + + +Neterror proc near + + mov al,5 + call monmessage + call scrollmonitor + ret + + endp + + + + + + + + + +Dircom proc near + + mov cx,30 + call randomaccess + call parser + cmp byte ptr [es:di+1],0 + jz dirroot + call dirfile + ret + +dirroot: mov logonum,0 + push cs + pop ds + mov si,offset cs:rootdir + inc si + push cs + pop es + mov di,offset cs:currentfile + inc di + mov cx,12 + rep movsb + call monitorlogo + call scrollmonitor + + mov al,9 + call monmessage + + mov es,textfile1 + call searchforfiles + mov es,textfile2 + call searchforfiles + mov es,textfile3 + call searchforfiles + + call scrollmonitor + ret + + endp + + + + + + +Searchforfiles proc near + + mov bx,textstart +directloop1: mov al,[es:bx] + inc bx + cmp al,"*" + jz endofdir + cmp al,34 + jnz directloop1 + call monprint + jmp directloop1 +endofdir: ret + + endp + + + + + + + + + + + + +Signon proc near + + call parser + inc di + push cs + pop ds + mov si,offset cs:keys + mov cx,4 +signonloop: push cx si di + add si,14 + mov cx,11 +signonloop2: lodsb + cmp al,32 + jz foundsign + call makecaps + mov ah,[es:di] + inc di + cmp al,ah + jnz nomatch + loop signonloop2 +nomatch: pop di si cx + add si,26 + loop signonloop + mov al,13 + call monmessage + ret + +foundsign: pop di si cx ;ds:si contains ad of key matched + mov bx,si + push ds + pop es ;now ds:si is in es:bx + + cmp byte ptr [es:bx],0 + jz notyetassigned + + mov al,17 + call monmessage + ret + +notyetassigned: push es bx + call scrollmonitor + mov al,15 + call monmessage + mov di,monadx + mov bx,monady + push di bx + call input + pop bx di + mov monadx,di + mov monady,bx + pop bx es + push es bx + + add bx,2 + push cs + pop ds + mov si,offset cs:inputline +checkpass: lodsw + mov ah,[es:bx] + inc bx + ;cmp al,0 + cmp ah,32 + jz passpassed + cmp al,ah + jz checkpass +passerror: pop bx es + call scrollmonitor + mov al,16 + call monmessage + ret + +passpassed: mov al,14 + call monmessage + pop bx es + push es bx + add bx,14 + call monprint + call scrollmonitor + pop bx es + mov byte ptr [es:bx],1 + ret + + endp + + + + + + + +Showkeys proc near + + mov cx,10 + call randomaccess + call scrollmonitor + mov al,18 + call monmessage + + push cs + pop es + mov bx,offset cs:keys + mov cx,4 +keysloop: push cx bx + cmp byte ptr [es:bx],0 + jz notheld + add bx,14 + call monprint +notheld: pop bx cx + add bx,26 + loop keysloop + call scrollmonitor + ret + + endp + + + + + + + + + + + +Read proc near + + mov cx,40 + call randomaccess + call parser + cmp byte ptr [es:di+1],0 + jnz okcom + call neterror + ret +okcom: push cs + pop es + mov di,offset cs:currentfile + mov ax,textfile1 + mov monsource,ax + mov ds,ax + mov si,textstart + call searchforstring + cmp al,0 + jz foundfile2 + mov ax,textfile2 + mov monsource,ax + mov ds,ax + mov si,textstart + call searchforstring + cmp al,0 + jz foundfile2 + mov ax,textfile3 + mov monsource,ax + mov ds,ax + mov si,textstart + call searchforstring + cmp al,0 + jz foundfile2 + mov al,7 + call monmessage + ret +foundfile2: call getkeyandlogo + cmp al,0 + jz keyok1 + ret +keyok1: push cs + pop es + mov di,offset cs:operand1 + mov ds,monsource + call searchforstring + cmp al,0 + jz findtopictext + mov al,oldlogonum + mov logonum,al + mov al,11 + call monmessage + ret + +findtopictext: inc bx + push es bx + call monitorlogo + call scrollmonitor + pop bx es +moretopic: call monprint + mov al,[es:bx] + cmp al,34 + jz endoftopic + cmp al,"=" + jz endoftopic + cmp al,"*" + jz endoftopic + push es bx + call processtrigger + mov cx,24 + call randomaccess + pop bx es + jmp moretopic + +endoftopic: call scrollmonitor + ret + + endp + + + + + + + + + +Dirfile proc near + + mov al,34 + mov [es:di],al + push es di ;save start point held in es:di + mov ds,textfile1 + mov si,textstart + call searchforstring + cmp al,0 + jz foundfile + pop di es + push es di + mov ds,textfile2 + mov si,textstart + call searchforstring + cmp al,0 + jz foundfile + pop di es + push es di + mov ds,textfile3 + mov si,textstart + call searchforstring + cmp al,0 + jz foundfile + + pop di es + mov al,7 + call monmessage + ret + +foundfile: pop ax ax ;discard old values of es:di + call getkeyandlogo + cmp al,0 + jz keyok2 + ret + +keyok2: push es bx + push cs + pop ds + mov si,offset cs:operand1+1 + push cs + pop es + mov di,offset cs:currentfile+1 + mov cx,12 + rep movsb + call monitorlogo + call scrollmonitor + mov al,10 + call monmessage + pop bx es + + +directloop2: mov al,[es:bx] + inc bx + cmp al,34 + jz endofdir2 + cmp al,"*" + jz endofdir2 + cmp al,"=" + jnz directloop2 + call monprint + jmp directloop2 + +endofdir2: call scrollmonitor + ret + + endp + + + + + + +Getkeyandlogo proc near + + inc bx + mov al,[es:bx] + sub al,48 + mov newlogonum,al + add bx,2 + mov al,[es:bx] + sub al,48 + mov keynum,al + inc bx + push es bx + mov al,keynum + mov ah,0 + mov cx,26 + mul cx + push cs + pop es + mov bx,offset cs:keys + add bx,ax + mov al,[es:bx] + cmp al,1 + jz keyok + push bx es + mov al,12 + call monmessage + pop es bx + add bx,14 + call monprint + call scrollmonitor + pop bx es + mov al,1 + ret + +keyok: pop bx es + mov al,newlogonum + mov logonum,al + mov al,0 + ret + + endp + + + + + + + + + +Searchforstring proc near ;finds string at es:di in + ;text at ds:si + + mov dl,[es:di] ;needs to know first character + ;if it's an equals then we must + ;stop at the next quotation mark + mov cx,di ;need to remember starting point + +restartlook: mov di,cx + mov bx,si + + mov dh,0 ;dh holds count of brackets + ;brackets are either " or = +keeplooking: lodsb + call makecaps + cmp al,"*" + jz notfound + cmp dl,"=" + jnz nofindingtopic ;are we looking for a topic? + cmp al,34 ;if YES, check we haven't reached + jz notfound ;the end of this file. +nofindingtopic: mov ah,[es:di] + cmp al,dl ;all searches bracketed by same thing + jnz notbracket + inc dh + cmp dh,2 + jz complete +notbracket: cmp al,ah + jnz restartlook + inc di + jmp keeplooking +complete: push ds ;es:bx returns found string + pop es + mov al,0 + mov bx,si + ret +notfound: mov al,1 + ret + + endp + + + + + + +Parser proc near + + push cs + pop es + mov di,offset cs:operand1 + mov cx,13 + mov al,0 + rep stosb + + mov di,offset cs:operand1 + mov al,"=" + stosb + + push cs + pop ds + mov si,offset cs:inputline + +notspace1: lodsw + cmp al,32 + jz stillspace1 + cmp al,0 + jnz notspace1 + jmp finishpars + +stillspace1: lodsw + cmp al,32 + jz stillspace1 + +copyin1: stosb + lodsw + cmp al,0 + jz finishpars + cmp al,32 + jnz copyin1 + +finishpars: mov di,offset cs:operand1 + ret + + endp + + + + + + +Scrollmonitor proc near + + push ax bx cx dx di si es ds + + call printlogo + mov di,monadx + mov bx,monady + call printundermon + mov ax,monady + call worktoscreen + mov al,25 + call playchannel1 + + pop ds es si di dx cx bx ax + ret + + endp + + + + + + + + + + + + + + +Lockmon proc near + + cmp lasthardkey,57 + jnz notlock + call locklighton +lockloop: cmp lasthardkey,57 + jz lockloop + call locklightoff +notlock: ret + + endp + + + + + +Monitorlogo proc near + + mov al,logonum + cmp al,oldlogonum + jz notnewlogo + mov oldlogonum,al + ;call fadedownmon + call printlogo + call printundermon + call worktoscreen + call printlogo + ;call fadeupmon + call printlogo + mov al,26 + call playchannel1 + mov cx,20 + call randomaccess + ret +notnewlogo: call printlogo + ret + + endp + + + + + + + + +Printlogo proc near + + mov di,56 + mov bx,32 + mov ds,tempgraphics + mov al,0 + mov ah,0 + call showframe + call showcurrentfile + ret + + endp + + + + + + +Showcurrentfile proc near + + mov di,178 ;99 + mov bx,37 + mov si,offset cs:currentfile+1 +curfileloop: mov al,[cs:si] + cmp al,0 + jz finishfile + inc si + push si + if foreign + call modifychar + endif + mov ds,tempcharset + mov ah,0 + call printchar + pop si + jmp curfileloop +finishfile: ret + + endp + + + + + + + + + +Monmessage proc near + + mov es,textfile1 + mov bx,textstart + mov cl,al + mov ch,0 +monmessageloop: mov al,[es:bx] + inc bx + cmp al,"+" + jnz monmessageloop + loop monmessageloop + call monprint + ret + + endp + + + + + + +Processtrigger proc near + + cmp lasttrigger,"1" + jnz notfirsttrigger + mov al,8 + call setlocation + mov al,45 + call triggermessage + ret + +notfirsttrigger: cmp lasttrigger,"2" + jnz notsecondtrigger + mov al,9 + call setlocation + mov al,55 + call triggermessage + ret + +notsecondtrigger: cmp lasttrigger,"3" + jnz notthirdtrigger + mov al,2 + call setlocation + mov al,59 + call triggermessage + +notthirdtrigger: ret + + endp + + + + +Triggermessage proc near + + push ax + mov di,174 + mov bx,153 + mov cl,200 + mov ch,63 + mov ds,mapstore + mov si,0 + call multiget + pop ax + call findpuztext + mov di,174 + mov bx,156 + mov dl,141 + mov ah,16 + call printdirect + mov cx,140 + call hangon + call worktoscreen + mov cx,340 + call hangon + mov di,174 + mov bx,153 + mov cl,200 + mov ch,63 + mov ds,mapstore + mov si,0 + call multiput + call worktoscreen + mov lasttrigger,0 + ret + + endp + + + + + + +Printcurs proc near + + push si di ds dx bx es + mov di,curslocx + mov bx,curslocy + mov cl,6 + mov ch,8 + if foreign + sub bx,3 + mov ch,11 + endif + mov ds,buffers + mov si,textunder + push di bx + call multiget + pop bx di + + push bx di + inc maintimer + mov ax,maintimer + and al,16 + jnz flashcurs + mov al,"/" + sub al,32 + mov ah,0 + mov ds,tempcharset + call showframe + +flashcurs: pop di bx + sub di,6 + mov cl,12 + if foreign + mov ch,11 + else + mov ch,8 + endif + call multidump + + pop es bx dx ds di si + ret + + endp + + + + + + +Delcurs proc near + + push es bx di ds dx si + mov di,curslocx + mov bx,curslocy + mov cl,6 + mov ch,8 + if foreign + sub bx,3 + mov ch,11 + endif + push di bx cx + mov ds,buffers + mov si,textunder + call multiput + pop cx bx di + call multidump +finishcurdel: + pop si dx ds di bx es + ret + + endp + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/newplace.asm b/devtools/tasmrecover/dreamweb/newplace.asm new file mode 100644 index 0000000000..8a1e97367c --- /dev/null +++ b/devtools/tasmrecover/dreamweb/newplace.asm @@ -0,0 +1,581 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +;----------------------------------------------------Choosing a new location---- + +Newplace proc near + + cmp needtotravel,1 + jz istravel + cmp autolocation,-1 + jnz isautoloc + ret + +isautoloc: mov al,autolocation + mov newlocation,al + mov autolocation,-1 + ret + +istravel: mov needtotravel,0 + call selectlocation + ret + + endp + + + + +Selectlocation proc near + + mov inmaparea,0 + call clearbeforeload + mov getback,0 + mov pointerframe,22 + + call readcitypic + call showcity + call getridoftemp + call readdesticon + call loadtraveltext + call showpanel + call showman + call showarrows + call showexit + call locationpic + call undertextline + mov commandtype,255 + call readmouse + mov pointerframe,0 + call showpointer + call worktoscreen + mov al,9 + mov ah,255 + call playchannel0 + mov newlocation,255 + +select: call delpointer + call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + cmp getback,1 + jz quittravel + mov bx,offset cs:destlist + call checkcoords + cmp newlocation,255 + jz select + mov al,newlocation + cmp al,location + jz quittravel + + call getridoftemp + call getridoftemp2 + call getridoftemp3 + mov es,traveltext + call deallocatemem + ret + +quittravel: mov al,reallocation ; was just location + mov newlocation,al + mov getback,0 + call getridoftemp + call getridoftemp2 + call getridoftemp3 + mov es,traveltext + call deallocatemem + ret + +destlist: dw 238,258,4,44,nextdest + dw 104,124,4,44,lastdest + dw 280,308,4,44,lookatplace + dw 104,216,138,192,destselect + dw 273,320,157,198,getback1 + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + +Showcity proc near + + call clearwork + mov ds,tempgraphics + mov di,57 + mov bx,32 + mov al,0 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,120+57 + mov bx,32 + mov al,1 + mov ah,0 + call showframe + ret + + endp + + + + + +Lookatplace proc near + + cmp commandtype,224 + jz alreadyinfo + mov commandtype,224 + mov al,27 + call commandonly +alreadyinfo: mov ax,mousebutton + and ax,1 + jz noinfo + cmp ax,oldbutton + jz noinfo + + mov bl,destpos + cmp bl,15 + jnc noinfo + + push bx + call delpointer + call deltextline + call getundercentre + mov ds,tempgraphics3 + mov al,0 + mov ah,0 + mov di,60 + mov bx,72 + call showframe + mov al,4 + mov ah,0 + mov di,60 + mov bx,72+55 + call showframe + if foreign + mov al,4 + mov ah,0 + mov di,60 + mov bx,72+55+21 + call showframe + endif + pop bx + + mov bh,0 + add bx,bx + mov es,traveltext + mov si,[es:bx] + add si,textstart + call findnextcolon + + mov di,63 + if foreign + mov bx,84+4 + else + mov bx,84 + endif + mov dl,191 + mov al,0 + mov ah,0 + call printdirect + call worktoscreenm + + mov cx,500 + call hangonp + +afterinfo: mov pointermode,0 + mov pointerframe,0 + call putundercentre + call worktoscreenm + +noinfo: ret + + endp + + + + +Getundercentre proc near + + mov di,58 + mov bx,72 + mov ds,mapstore + mov si,0 + mov cl,254 + mov ch,110 + call multiget + ret + + endp + + + + + + + + + + +Putundercentre proc near + + mov di,58 + mov bx,72 + mov ds,mapstore + mov si,0 + mov cl,254 + mov ch,110 + call multiput + ret + + endp + + + + + + + +Locationpic proc near + + call getdestinfo + mov al,[es:si] + push es si + mov di,0 + cmp al,6 + jnc secondlot + mov ds,tempgraphics + add al,4 + jmp gotgraphic +secondlot: sub al,6 + mov ds,tempgraphics2 +gotgraphic: add di,104 + mov bx,138+14 + mov ah,0 + call showframe + pop si es + mov al,destpos + cmp al,reallocation + jnz notinthisone + mov al,3 + mov di,104 + mov bx,140+14 + mov ds,tempgraphics + mov ah,0 + call showframe +notinthisone: mov bl,destpos + mov bh,0 + add bx,bx + mov es,traveltext + mov si,[es:bx] + add si,textstart + mov di,50 + mov bx,20 + mov dl,241 + mov al,0 + mov ah,0 + call printdirect + ret + + endp + + + + +Getdestinfo proc near + + mov al,destpos + mov ah,0 + push ax + mov dx,seg roomscango + mov es,dx + mov si,offset es:roomscango + add si,ax + mov cl,[es:si] + pop ax + push cx + mov dx,seg roompics + mov es,dx + mov si,offset es:roompics + add si,ax + pop ax + ret + + endp + + + + + + +Showarrows proc near + + mov di,116-12 + mov bx,16 + mov ds,tempgraphics + mov al,0 + mov ah,0 + call showframe + mov di,226+12 + mov bx,16 + mov ds,tempgraphics + mov al,1 + mov ah,0 + call showframe + mov di,280 + mov bx,14 + mov ds,tempgraphics + mov al,2 + mov ah,0 + call showframe + ret + + endp + + + + + + + + + +Nextdest proc near + +duok: cmp commandtype,218 + jz alreadydu + mov commandtype,218 + mov al,28 + call commandonly +alreadydu: mov ax,mousebutton + and ax,1 + jz nodu + cmp ax,oldbutton + jz nodu + +searchdestup: inc destpos + cmp destpos,15 + jnz notlastdest + mov destpos,0 +notlastdest: call getdestinfo + cmp al,0 + jz searchdestup + + mov newtextline,1 + call deltextline + call delpointer + call showpanel + call showman + call showarrows + call locationpic + call undertextline + call readmouse + call showpointer + call worktoscreen + call delpointer +nodu: ret + + endp + + + + + + + +Lastdest proc near + +ddok: cmp commandtype,219 + jz alreadydd + mov commandtype,219 + mov al,29 + call commandonly +alreadydd: mov ax,mousebutton + and ax,1 + jz nodd + cmp ax,oldbutton + jz nodd + +searchdestdown: dec destpos + cmp destpos,-1 + jnz notfirstdest + mov destpos,15 +notfirstdest: call getdestinfo + cmp al,0 + jz searchdestdown + + mov newtextline,1 + call deltextline + call delpointer + call showpanel + call showman + call showarrows + call locationpic + call undertextline + call readmouse + call showpointer + call worktoscreen + call delpointer +nodd: ret + + endp + + + + + + + + +Destselect proc near + + cmp commandtype,222 + jz alreadytrav + mov commandtype,222 + mov al,30 + call commandonly +alreadytrav: mov ax,mousebutton + and ax,1 + jz notrav + cmp ax,oldbutton + jz notrav + + call getdestinfo + mov al,destpos + mov newlocation,al +notrav: ret + + endp + + + + + + + + + + + + + + + + + + + +Getlocation proc near + + mov ah,0 + mov bx,ax + mov dx,seg roomscango + mov es,dx + add bx,offset es:roomscango + mov al,[es:bx] + ret + + endp + + +Setlocation proc near ;makes a location accessable + + mov ah,0 + mov bx,ax + mov dx,seg roomscango + mov es,dx + add bx,offset es:roomscango + mov byte ptr [es:bx],1 + ret + + endp + + + + +Resetlocation proc near ;makes a location inaccessable + + push ax + cmp al,5 + jnz notdelhotel + call purgealocation + mov al,21 + call purgealocation + mov al,22 + call purgealocation + mov al,27 + call purgealocation + jmp clearedlocations + +notdelhotel: cmp al,8 + jnz notdeltvstud + call purgealocation + mov al,28 + call purgealocation + jmp clearedlocations + +notdeltvstud: cmp al,6 + jnz notdelsarters + call purgealocation + mov al,20 + call purgealocation + mov al,25 + call purgealocation + jmp clearedlocations + +notdelsarters: cmp al,13 + jnz notdelboathouse + call purgealocation + mov al,29 + call purgealocation + jmp clearedlocations + +notdelboathouse: + +clearedlocations: pop ax + mov ah,0 + mov bx,ax + mov dx,seg roomscango + mov es,dx + add bx,offset es:roomscango + mov byte ptr [es:bx],0 + ret + + endp + + + + +Readdesticon proc near + + mov dx,offset cs:travelgraphic1 + call loadintotemp + + mov dx,offset cs:travelgraphic2 + call loadintotemp2 + + mov dx,offset cs:icongraphics8 + call loadintotemp3 + ret + + endp + + + + +Readcitypic proc near + + mov dx,offset cs:cityname + call loadintotemp + ret + + endp + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/object.asm b/devtools/tasmrecover/dreamweb/object.asm new file mode 100644 index 0000000000..19265bb4ac --- /dev/null +++ b/devtools/tasmrecover/dreamweb/object.asm @@ -0,0 +1,2608 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +;---------------------------------------------------------Inventory printer---- + +Fillryan proc near + ; cx=what to search for + mov es,buffers + mov di,ryaninvlist + call findallryan + mov si,ryaninvlist + mov al,ryanpage + mov ah,0 + mov cx,20 + mul cx + add si,ax + + mov di,inventx + mov bx,inventy + + mov cx,2 +ryanloop2: push cx di bx + mov cx,5 +ryanloop1: push cx di bx + mov ax,[es:si] + add si,2 + push si es + call obtoinv + pop es si + pop bx di cx + add di,itempicsize + loop ryanloop1 + pop bx di cx + add bx,itempicsize + loop ryanloop2 + + call showryanpage + ret + + endp + + + + + + + + + + + +Fillopen proc near + + call deltextline + + call getopenedsize ;find out how many slots + cmp ah,4 ;ah=slots, al=size holdable + jc lessthanapage + mov ah,4 +lessthanapage: mov al,1 + + push ax + mov es,buffers + mov di,openinvlist + call findallopen + mov si,openinvlist + mov di,inventx + mov bx,inventy+96 + pop cx + +openloop1: push cx di bx + mov ax,[es:si] + add si,2 + push si es + cmp ch,cl + jc nextopenslot + call obtoinv +nextopenslot: pop es si + pop bx di cx + add di,itempicsize + inc cl + cmp cl,5 + jnz openloop1 + + call undertextline + ret + + endp + + + + + + + + + + + + + + + + +Findallryan proc near + + push di + mov cx,30 + mov ax,0ffffh + rep stosw + pop di + + mov cl,4 + mov ds,extras + mov bx,exdata + mov ch,0 +findryanloop: cmp [bx+2],cl + jnz notinryaninv + cmp byte ptr [bx+3],255 + jnz notinryaninv + mov al,[bx+4] + mov ah,0 + push di + add di,ax + add di,ax + mov al,ch + mov ah,4 ;means it is an exchanged object ie:not free or set + stosw + pop di +notinryaninv: add bx,16 + inc ch + cmp ch,numexobjects + jnz findryanloop + ret + + endp + + + + + + + +Findallopen proc near + + push di + mov cx,16 + mov ax,0ffffh + rep stosw + pop di + + mov cl,openedob + mov dl,openedtype + mov ds,extras + mov bx,exdata + mov ch,0 +findopen1: cmp [bx+3],cl + jnz findopen2 + cmp [bx+2],dl + jnz findopen2 + cmp openedtype,4 + jz noloccheck + mov al,[bx+5] + cmp al,reallocation + jnz findopen2 +noloccheck: mov al,[bx+4] + mov ah,0 + push di + add di,ax + add di,ax + mov al,ch + mov ah,4 + stosw + pop di +findopen2: add bx,16 + inc ch + cmp ch,numexobjects + jnz findopen1 + + mov cl,openedob + mov dl,openedtype + push dx + mov ds,freedat + pop dx + mov bx,0 + mov ch,0 +findopen1a: cmp [bx+3],cl + jnz findopen2a + cmp [bx+2],dl + jnz findopen2a + mov al,[bx+4] + mov ah,0 + push di + add di,ax + add di,ax + mov al,ch + mov ah,2 ; means it's in a free ob + stosw + pop di +findopen2a: add bx,16 + inc ch + cmp ch,80 + jnz findopen1a + ret + + endp + + + + + + +Obtoinv proc near + + push bx es si ax + + push ax di bx + mov ds,icons1 + sub di,2 + sub bx,1 + mov al,10 + mov ah,0 + call showframe + pop bx di ax + cmp al,255 + jz finishfill + + push bx di ax + mov ds,extras + cmp ah,4 + jz isanextra + mov ds,freeframes +isanextra: mov cl,al + add al,al + add al,cl + inc al + mov ah,128 + add bx,19 + add di,18 + call showframe + pop ax di bx + + push bx + call getanyaddir + call isitworn + pop bx + jnz finishfill + mov ds,icons1 ;Print wearing logo + sub di,3 + sub bx,2 + mov al,7 + mov ah,0 + call showframe + +finishfill: pop ax si es bx + ret + + endp + + + + + +Isitworn proc near ;zero if yes + + mov al,[es:bx+12] + cmp al,"W"-"A" + jnz notworn + mov al,[es:bx+13] + cmp al,"E"-"A" +notworn: ret + + endp + + + +Makeworn proc near + + mov byte ptr [es:bx+12],"W"-"A" + mov byte ptr [es:bx+13],"E"-"A" + ret + + endp + + + + + + +;-------------------------------------------------------Examining an object---- + +Examineob proc near + + mov pointermode,0 + mov timecount,0 + +examineagain: mov inmaparea,0 + mov examagain,0 + mov openedob,255 + mov openedtype,255 + mov invopen,0 + mov al,commandtype + mov objecttype,al + mov itemframe,0 + mov pointerframe,0 + + call createpanel + call showpanel + call showman + call showexit + call obicons + call obpicture + call describeob + call undertextline + + mov commandtype,255 + call readmouse + call showpointer + call worktoscreen + call delpointer + +waitexam: ;call delpointer + call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + call delpointer + + mov getback,0 + mov bx,offset cs:examlist + cmp invopen,0 + jz notuseinv + mov bx,offset cs:invlist1 + cmp invopen,1 + jz notuseinv + mov bx,offset cs:withlist1 +notuseinv: call checkcoords + cmp examagain,0 + jz norex + jmp examineagain +norex: cmp getback,0 + jz waitexam + + mov pickup,0 + cmp watchingtime,0 + jnz iswatching + cmp newlocation,255 + jnz justgetback + +iswatching: call makemainscreen + mov invopen,0 + mov openedob,255 + ret + +justgetback: mov invopen,0 + mov openedob,255 + ret + +examlist: dw 273,320,157,198,getbackfromob + dw 260,300,0,44,useobject + dw 210,254,0,44,selectopenob + dw 144,176,64,96,setpickup + dw 0,50,50,200,examinventory + dw 0,320,0,200,blank + dw 0ffffh + +invlist1: dw 273,320,157,198,getbackfromob + dw 255,294,0,24,dropobject + dw inventx+167,inventx+167+(18*3),inventy-18,inventy-2,incryanpage + dw inventx +openchangesize: dw inventx+(4*itempicsize) + dw inventy+100,inventy+100+itempicsize,useopened + dw inventx,inventx+(5*itempicsize) + dw inventy,inventy+(2*itempicsize),intoinv + dw 0,320,0,200,blank + dw 0ffffh + +withlist1: dw 273,320,157,198,getbackfromob + dw inventx+167,inventx+167+(18*3),inventy-18,inventy-2,incryanpage + dw inventx,inventx+(5*itempicsize) + dw inventy,inventy+(2*itempicsize),selectob + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + + +Makemainscreen proc near + + call createpanel + mov newobs,1 + call drawfloor + call spriteupdate + call printsprites + call reelsonscreen + call showicon + call getunderzoom + call undertextline + mov commandtype,255 + call animpointer + call worktoscreenm + mov commandtype,200 + mov manisoffscreen,0 + ret + + endp + + + + +Getbackfromob proc near + + cmp pickup,1 + jnz notheldob + call blank + ret +notheldob: call getback1 + ret + + endp + + + + + + + + + + + + + + + + +Incryanpage proc near + + cmp commandtype,222 + jz alreadyincryan + mov commandtype,222 + mov al,31 + call commandonly +alreadyincryan: mov ax,mousebutton + cmp ax,oldbutton + jz noincryan + and ax,1 + jnz doincryan +noincryan: ret + +doincryan: mov ax,mousex + sub ax,inventx+167 + mov ryanpage,-1 +findnewpage: inc ryanpage + sub ax,18 + jnc findnewpage + call delpointer + call fillryan + call readmouse + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + +Openinv proc near + + mov invopen,1 + mov al,61 + mov di,inventx + mov bx,inventy-10 + mov dl,240 + call printmessage + call fillryan + mov commandtype,255 + ret + + endp + + + + + + + +Showryanpage proc near + + mov ds,icons1 + mov di,inventx+167 + mov bx,inventy-12 + mov al,12 + mov ah,0 + call showframe + + mov al,13 + add al,ryanpage + push ax + mov al,ryanpage + mov ah,0 + mov cx,18 + mul cx + mov ds,icons1 + mov di,inventx+167 + add di,ax + mov bx,inventy-12 + pop ax + mov ah,0 + call showframe + ret + + endp + + + + + + + + + +Openob proc near + + mov al,openedob + mov ah,openedtype + mov di,offset cs:commandline + call copyname + + mov di,inventx + mov bx,inventy+86 + mov al,62 + mov dl,240 + call printmessage + + mov di,lastxpos + add di,5 + mov bx,inventy+86 + push cs + pop es + mov si,offset cs:commandline + mov dl,220 + mov al,0 + mov ah,0 + call printdirect + + call fillopen + call getopenedsize + mov al,ah + mov ah,0 + mov cx,itempicsize + mul cx + add ax,inventx + mov bx,offset cs:openchangesize + mov [cs:bx],ax + ret + + endp + + + + + + +Obicons proc near + + mov al,command + call getanyad + cmp al,255 + jz cantopenit + + mov ds,icons2 + mov di,210 + mov bx,1 + mov al,4 + mov ah,0 + call showframe + +cantopenit: mov ds,icons2 + mov di,260 + mov bx,1 + mov al,1 + mov ah,0 + call showframe + ret + + endp + + + + + + + +Examicon proc near + + mov ds,icons2 + mov di,254 + mov bx,5 + mov al,3 + mov ah,0 + call showframe + ret + + endp + + + + + + + +Obpicture proc near + + mov al,command + mov ah,objecttype + cmp ah,1 + jz setframe + cmp ah,4 + jz exframe + + mov ds,freeframes + mov di,160 + mov bx,68 + mov cl,al + add al,al + add al,cl + inc al + mov ah,128 + call showframe + ret + +setframe: ret + +exframe: mov ds,extras + mov di,160 + mov bx,68 + mov cl,al + add al,al + add al,cl + inc al + mov ah,128 + call showframe + ret + + endp + + + + + + + + + + +Describeob proc near + + call getobtextstart + + mov di,33 + mov bx,92 + if foreign + cmp objecttype,1 + jnz notsetd + mov bx,82 +notsetd: endif + mov dl,241 + mov ah,16 + mov charshift,91+91 + call printdirect + mov charshift,0 + mov di,36 + mov bx,104 + if foreign + cmp objecttype,1 + jnz notsetd2 + mov bx,94 +notsetd2: endif + mov dl,241 + mov ah,0 + call printdirect + push bx + call obsthatdothings + pop bx + call additionaltext + ret + + + endp + + + + + +Additionaltext proc near + + add bx,10 + push bx + mov al,command + mov ah,objecttype + mov cl,"C" + mov ch,"U" + mov dl,"P" + mov dh,"E" + call compare + jz emptycup + mov al,command + mov ah,objecttype + mov cl,"C" + mov ch,"U" + mov dl,"P" + mov dh,"F" + call compare + jz fullcup + pop bx + ret +emptycup: mov al,40 + call findpuztext + pop bx + mov di,36 + mov dl,241 + mov ah,0 + call printdirect + ret +fullcup: mov al,39 + call findpuztext + pop bx + mov di,36 + mov dl,241 + mov ah,0 + call printdirect + ret + + endp + + + + + + + + + + + +Obsthatdothings proc near + + mov al,command + mov ah,objecttype + mov cl,"M" + mov ch,"E" + mov dl,"M" + mov dh,"B" + call compare + jnz notlouiscard + mov al,4 + call getlocation + cmp al,1 + jz seencard + mov al,4 + call setlocation + call lookatcard +seencard: ret +notlouiscard: ret + + endp + + + + + + + +Getobtextstart proc near + + mov es,freedesc + mov si,freetextdat + mov cx,freetext + cmp objecttype,2 + jz describe + mov es,setdesc + mov si,settextdat + mov cx,settext + cmp objecttype,1 + jz describe + mov es,extras + mov si,extextdat + mov cx,extext + +describe: mov al,command + mov ah,0 + add ax,ax + add si,ax + mov ax,[es:si] + add ax,cx + mov si,ax + mov bx,ax +tryagain: push si + call findnextcolon + mov al,[es:si] + mov cx,si + pop si + cmp objecttype,1 + jnz cantmakeoneup + cmp al,0 + jz findsometext + cmp al,":" + jz findsometext +cantmakeoneup: ret + +findsometext: call searchforsame + jmp tryagain + ret + + endp + + + + + + +Searchforsame proc near + + mov si,cx +searchagain: inc si + mov al,[es:bx] +search: cmp [es:si],al + jz gotstartletter + inc cx + inc si + cmp si,8000 ;arbitrary give-up + jc search ;counter. + mov si,bx + pop ax + ret + +gotstartletter: push bx si +keepchecking: inc si + inc bx + mov al,[es:bx] + mov ah,[es:si] + cmp al,":" + jz foundmatch + cmp al,0 + jz foundmatch + cmp al,ah + jz keepchecking + pop si bx + jmp searchagain + +foundmatch: pop si bx + ret + + endp + + + + + + + +;-----------------------------------------------------------Using an object---- + + + + + +Findnextcolon proc near + +isntcolon: mov al,[es:si] + inc si + cmp al,0 + jz endofcolon + cmp al,":" + jnz isntcolon +endofcolon: ret + + endp + + +;------------------------------------------------------Taking, dropping etc---- + + + + + + +Inventory proc near + + cmp mandead,1 + jz iswatchinv + cmp watchingtime,0 + jz notwatchinv +iswatchinv: call blank + ret +notwatchinv: cmp commandtype,239 + jz alreadyopinv + mov commandtype,239 + mov al,32 + call commandonly +alreadyopinv: mov ax,mousebutton + cmp ax,oldbutton + jz cantopinv + and ax,1 + jnz doopeninv +cantopinv: ret + +doopeninv: mov timecount,0 + mov pointermode,0 + mov inmaparea,0 + call animpointer + call createpanel + call showpanel + call examicon + call showman + call showexit + call undertextline + mov pickup,0 + mov invopen,2 + call openinv + call readmouse + call showpointer + call worktoscreen + call delpointer + mov openedob,255 + jmp waitexam ; very naughty! + + endp + + + + + + +Setpickup proc near + + cmp objecttype,1 + jz cantpick + cmp objecttype,3 + jz cantpick + call getanyad + mov al,[es:bx+2] + cmp al,4 + jnz canpick +cantpick: call blank + ret + +canpick: cmp commandtype,209 + jz alreadysp + mov commandtype,209 + + mov bl,command + mov bh,objecttype + mov al,33 + call commandwithob +alreadysp: mov ax,mousebutton + cmp ax,1 + jnz nosetpick + cmp ax,oldbutton + jnz dosetpick +nosetpick: ret + +dosetpick: call createpanel + call showpanel + call showman + call showexit + call examicon + mov pickup,1 + mov invopen,2 + cmp objecttype,4 + jz pickupexob + + mov al,command + mov itemframe,al + mov openedob,255 + call transfertoex + mov itemframe,al + mov objecttype,4 + call geteitherad + mov byte ptr [es:bx+2],20 ; means it is in transit + mov byte ptr [es:bx+3],255 + call openinv + call worktoscreenm + ret + +pickupexob: mov al,command + mov itemframe,al + mov openedob,255 + call openinv + call worktoscreenm + ret + + endp + + + + + +Examinventory proc near + + cmp commandtype,249 + jz alreadyexinv + mov commandtype,249 + mov al,32 + call commandonly +alreadyexinv: mov ax,mousebutton + and ax,1 + jnz doexinv + ret + +doexinv: call createpanel + call showpanel + call showman + call showexit + call examicon + mov pickup,0 + mov invopen,2 + call openinv + call worktoscreenm + ret + + endp + + + + + +Reexfrominv proc near + + call findinvpos + mov ax,[es:bx] + mov commandtype,ah + mov command,al + mov examagain,1 + mov pointermode,0 + ret + + endp + + + + + + + +Reexfromopen proc near + + ret + call findopenpos + mov ax,[es:bx] + mov commandtype,ah + mov command,al + mov examagain,1 + mov pointermode,0 + ret + + endp + + + + + + + + + + + + + + + + + + + +Swapwithinv proc near + + mov al,itemframe + mov ah,objecttype + cmp ax,oldsubject + jnz difsub7 + cmp commandtype,243 + jz alreadyswap1 + mov commandtype,243 + +difsub7: mov oldsubject,ax + mov bx,ax + mov al,34 + call commandwithob +alreadyswap1: mov ax,mousebutton + cmp ax,oldbutton + jz cantswap1 + and ax,1 + jnz doswap1 +cantswap1: ret + +doswap1: mov ah,objecttype + mov al,itemframe + push ax + + call findinvpos + mov ax,[es:bx] + mov itemframe,al + mov objecttype,ah + call geteitherad + mov byte ptr [es:bx+2],20 ; means unplaced object + mov byte ptr [es:bx+3],255 + mov bl,itemframe + mov bh,objecttype + + pop ax + mov objecttype,ah + mov itemframe,al + push bx + + call findinvpos ;NONE OF THIS IS NEEDED + call delpointer ;ONLY EXTRAS CAN BE IN + mov al,itemframe + call geteitherad + mov byte ptr [es:bx+2],4 + mov byte ptr [es:bx+3],255 + mov al,lastinvpos + mov [es:bx+4],al + + pop ax + mov objecttype,ah + mov itemframe,al + call fillryan + call readmouse + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + + + + +Swapwithopen proc near + + mov al,itemframe + mov ah,objecttype + cmp ax,oldsubject + jnz difsub8 + cmp commandtype,242 + jz alreadyswap2 + mov commandtype,242 + +difsub8: mov oldsubject,ax + mov bx,ax + mov al,34 + call commandwithob +alreadyswap2: mov ax,mousebutton + cmp ax,oldbutton + jz cantswap2 + and ax,1 + jnz doswap2 +cantswap2: ret + +doswap2: call geteitherad + call isitworn + jnz notwornswap + call wornerror + ret +notwornswap: call delpointer + mov al,itemframe + cmp al,openedob + jnz isntsame2 + mov al,objecttype + cmp al,openedtype + jnz isntsame2 + call errormessage1 + ret + +isntsame2: call checkobjectsize + cmp al,0 + jz sizeok2 + ret + +sizeok2: mov ah,objecttype + mov al,itemframe + push ax + + call findopenpos + mov ax,[es:bx] + mov itemframe,al + mov objecttype,ah + + cmp ah,4 + jnz makeswapex + call geteitherad + mov byte ptr [es:bx+2],20 + mov byte ptr [es:bx+3],255 + jmp actuallyswap + +makeswapex: call transfertoex + mov itemframe,al + mov objecttype,4 + call geteitherad + mov byte ptr [es:bx+2],20 + mov byte ptr [es:bx+3],255 + +actuallyswap: mov bl,itemframe + mov bh,objecttype + pop ax + mov objecttype,ah + mov itemframe,al + push bx + + call findopenpos + call geteitherad + mov al,openedtype + mov byte ptr [es:bx+2],al + mov al,openedob + mov byte ptr [es:bx+3],al + mov al,lastinvpos + mov [es:bx+4],al + mov al,reallocation + mov [es:bx+5],al + + pop ax + mov objecttype,ah + mov itemframe,al + call fillopen + call fillryan + call undertextline + call readmouse + call useopened + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + + + + + +Intoinv proc near + + cmp pickup,0 + jnz notout + call outofinv + ret + +notout: call findinvpos + mov ax,[es:bx] + cmp al,255 + jz canplace1 + call swapwithinv + ret + +canplace1: mov al,itemframe + mov ah,objecttype + cmp ax,oldsubject + jnz difsub1 + cmp commandtype,220 + jz alreadyplce + mov commandtype,220 + +difsub1: mov oldsubject,ax + mov bx,ax + mov al,35 + call commandwithob +alreadyplce: mov ax,mousebutton + cmp ax,oldbutton + jz notletgo2 + and ax,1 + jnz doplace +notletgo2: ret + +doplace: call delpointer + mov al,itemframe + call getexad + mov byte ptr [es:bx+2],4 + mov byte ptr [es:bx+3],255 + mov al,lastinvpos + mov [es:bx+4],al + + mov pickup,0 + call fillryan + call readmouse + call showpointer + call outofinv + call worktoscreen + call delpointer + ret + + endp + + + + + + + +Deletetaken proc near ;gets rid of objects that were + ;transfered to exlist ages ago + mov es,freedat + mov ah,reallocation + mov ds,extras + mov si,exdata + + mov cx,numexobjects +takenloop: mov al,[si+11] + cmp al,ah + jnz notinhere + mov bl,[si+1] + mov bh,0 + add bx,bx + add bx,bx + add bx,bx + add bx,bx + mov byte ptr [es:bx+2],254 ; was 255 + +notinhere: add si,16 + loop takenloop + + ret + + endp + + + + + + +Outofinv proc near + + call findinvpos + mov ax,[es:bx] + cmp al,255 + jnz canpick2 + call blank + ret + +canpick2: mov bx,mousebutton + cmp bx,2 + jnz canpick2a + call reexfrominv + ret + +canpick2a: cmp ax,oldsubject + jnz difsub3 + cmp commandtype,221 + jz alreadygrab + mov commandtype,221 + +difsub3: mov oldsubject,ax + mov bx,ax + mov al,36 + call commandwithob +alreadygrab: mov ax,mousebutton + cmp ax,oldbutton + jz notletgo + and ax,1 + jnz dograb +notletgo: ret + +dograb: call delpointer + mov pickup,1 + call findinvpos + mov ax,[es:bx] + mov itemframe,al + mov objecttype,ah + call getexad + mov byte ptr [es:bx+2],20 ; means unplaced object + mov byte ptr [es:bx+3],255 + call fillryan + call readmouse + call showpointer + call intoinv + call worktoscreen + call delpointer + ret + + endp + + + + + +Getfreead proc near + + mov ah,0 + mov cl,4 + shl ax,cl + mov bx,ax + mov es,freedat + ret + + endp + + + + + + + + +Getexad proc near + + mov ah,0 + mov bx,16 + mul bx + mov bx,ax + mov es,extras + add bx,exdata + ret + + endp + + + + + + +Geteitherad proc near + + cmp objecttype,4 + jz isinexlist + mov al,itemframe + call getfreead + ret +isinexlist: mov al,itemframe + call getexad + ret + + endp + + + + + + +Getanyad proc near ;nearly same as above + ;but uses command + cmp objecttype,4 + jz isex + cmp objecttype,2 + jz isfree + mov al,command + call getsetad + mov ax,[es:bx+4] + ret +isfree: mov al,command + call getfreead + mov ax,[es:bx+7] + ret +isex: mov al,command + call getexad + mov ax,[es:bx+7] + ret + + endp + + + +Getanyaddir proc near ;nearly same as above + ;but uses ax + cmp ah,4 + jz isex3 + cmp ah,2 + jz isfree3 + call getsetad + ret +isfree3: call getfreead + ret +isex3: call getexad + ret + + endp + + + + + + +Getopenedsize proc near ;nearly same as above again + ;but finds ad of opened ob + cmp openedtype,4 + jz isex2 + cmp openedtype,2 + jz isfree2 + mov al,openedob + call getsetad + mov ax,[es:bx+3] + ret +isfree2: mov al,openedob + call getfreead + mov ax,[es:bx+7] + ret +isex2: mov al,openedob + call getexad + mov ax,[es:bx+7] + ret + + endp + + + + + + + + +Getsetad proc near + + mov ah,0 + mov bx,64 + mul bx + mov bx,ax + mov es,setdat + ret + + endp + + + + + + +Findinvpos proc near + + mov cx,mousex + sub cx,inventx + mov bx,-1 +findinv1: inc bx + sub cx,itempicsize + jnc findinv1 + + mov cx,mousey + sub cx,inventy + sub bx,5 +findinv2: add bx,5 + sub cx,itempicsize + jnc findinv2 + + mov al,ryanpage + mov ah,0 + mov cx,10 + mul cx + add bx,ax + + mov al,bl + mov lastinvpos,al + add bx,bx + + mov es,buffers + add bx,ryaninvlist + ret + + endp + + + + + + + + + +Findopenpos proc near + + mov cx,mousex + sub cx,inventx + mov bx,-1 +findopenp1: inc bx + sub cx,itempicsize + jnc findopenp1 + + mov al,bl + mov lastinvpos,al + + add bx,bx + mov es,buffers + add bx,openinvlist + ret + + endp + + + + + + + + + + + + +;--------------------------------------------------------Dropping an object---- + +Dropobject proc near + + cmp commandtype,223 + jz alreadydrop + mov commandtype,223 + cmp pickup,0 + jz blank + + mov bl,itemframe + mov bh,objecttype + mov al,37 + call commandwithob +alreadydrop: mov ax,mousebutton + cmp ax,oldbutton + jz nodrop + and ax,1 + jnz dodrop +nodrop: ret + +dodrop: call geteitherad + call isitworn + jnz nowornerror + call wornerror + ret +nowornerror: cmp reallocation,47 + jz nodrop2 + mov cl,ryanx + add cl,12 + mov ch,ryany + add ch,12 + call checkone + cmp cl,2 + jc nodroperror +nodrop2: call droperror + ret +nodroperror: cmp mapxsize,64 + jnz notinlift + cmp mapysize,64 + jnz notinlift + call droperror + ret +notinlift: mov al,itemframe + mov ah,4 + mov cl,"G" + mov ch,"U" + mov dl,"N" + mov dh,"A" + call compare + jz cantdrop + mov al,itemframe + mov ah,4 + mov cl,"S" + mov ch,"H" + mov dl,"L" + mov dh,"D" + call compare + jz cantdrop + mov objecttype,4 + mov al,itemframe + call getexad + mov byte ptr [es:bx+2],0 + mov al,ryanx + add al,4 + mov cl,4 + shr al,cl + add al,mapx + mov ah,ryany + add ah,8 + mov cl,4 + shr ah,cl + add ah,mapy + mov byte ptr [es:bx+3],al + mov byte ptr [es:bx+5],ah + mov al,ryanx + add al,4 + and al,15 + mov ah,ryany + add ah,8 + and ah,15 + mov byte ptr [es:bx+4],al + mov byte ptr [es:bx+6],ah + mov pickup,0 + mov al,reallocation + mov [es:bx],al + ret + + endp + + + + +Droperror proc near + + mov commandtype,255 + call delpointer + mov di,76 + mov bx,21 + mov al,56 + mov dl,240 + call printmessage + call worktoscreenm + mov cx,50 + call hangonp + call showpanel + call showman + call examicon + mov commandtype,255 + call worktoscreenm + ret + + endp + + + + +Cantdrop proc near + + mov commandtype,255 + call delpointer + mov di,76 + mov bx,21 + mov al,24 + mov dl,240 + call printmessage + call worktoscreenm + mov cx,50 + call hangonp + call showpanel + call showman + call examicon + mov commandtype,255 + call worktoscreenm + ret + + endp + + + +Wornerror proc near + + mov commandtype,255 + call delpointer + mov di,76 + mov bx,21 + mov al,57 + mov dl,240 + call printmessage + call worktoscreenm + mov cx,50 + call hangonp + call showpanel + call showman + call examicon + mov commandtype,255 + call worktoscreenm + ret + + endp + + + + + + + + + + +Removeobfrominv proc near + + cmp command,100 + jz obnotexist + call getanyad + mov di,bx + mov cl,command + mov ch,0 + call deleteexobject + ;mov byte ptr [es:bx+2],0 +obnotexist: ret + + endp + + + + +;---------------------------------------------------------Opening an object---- + +Selectopenob proc near + + mov al,command + call getanyad + cmp al,255 + jnz canopenit1 + call blank + ret + +canopenit1: cmp commandtype,224 + jz alreadyopob + mov commandtype,224 + + mov bl,command + mov bh,objecttype + mov al,38 + call commandwithob +alreadyopob: mov ax,mousebutton + cmp ax,oldbutton + jz noopenob + and ax,1 + jnz doopenob +noopenob: ret + +doopenob: mov al,command + mov openedob,al + mov al,objecttype + mov openedtype,al + + call createpanel + call showpanel + call showman + call examicon + call showexit + call openinv + call openob + call undertextline + call readmouse + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + + + + +Useopened proc near + + cmp openedob,255 + jz cannotuseopen + cmp pickup,0 + jnz notout2 + call outofopen + ret + +notout2: call findopenpos + mov ax,[es:bx] + cmp al,255 + jz canplace3 + call swapwithopen +cannotuseopen: ret + +canplace3: cmp pickup,1 + jz intoopen + call blank + ret + +intoopen: mov al,itemframe + mov ah,objecttype + cmp ax,oldsubject + jnz difsub2 + cmp commandtype,227 + jz alreadyplc2 + mov commandtype,227 + +difsub2: mov oldsubject,ax + mov bx,ax + mov al,35 + call commandwithob +alreadyplc2: mov ax,mousebutton + cmp ax,oldbutton + jz notletgo3 + cmp ax,1 + jz doplace2 +notletgo3: ret + +doplace2: call geteitherad + call isitworn + jnz notworntoopen + call wornerror + ret +notworntoopen: call delpointer + mov al,itemframe + cmp al,openedob + jnz isntsame + mov al,objecttype + cmp al,openedtype + jnz isntsame + call errormessage1 + ret + +isntsame: call checkobjectsize + cmp al,0 + jz sizeok1 + ret + +sizeok1: mov pickup,0 + mov al,itemframe + call geteitherad + mov al,openedtype + mov byte ptr [es:bx+2],al + mov al,openedob + mov byte ptr [es:bx+3],al + mov al,lastinvpos + mov [es:bx+4],al + mov al,reallocation + mov [es:bx+5],al + call fillopen + call undertextline + call readmouse + call useopened + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + + +Errormessage1 proc near + + call delpointer + mov di,76 + mov bx,21 + mov al,58 + mov dl,240 + call printmessage + call readmouse + call showpointer + call worktoscreen + call delpointer + mov cx,50 + call hangonp + call showpanel + call showman + call examicon + call readmouse + call useopened + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + +Errormessage2 proc near + + mov commandtype,255 + call delpointer + mov di,76 + mov bx,21 + mov al,59 + mov dl,240 + call printmessage + call readmouse + call showpointer + call worktoscreen + call delpointer + mov cx,50 + call hangonp + call showpanel + call showman + call examicon + call readmouse + call useopened + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + + + + +Errormessage3 proc near + + call delpointer + mov di,76 + mov bx,21 + mov al,60 + mov dl,240 + call printmessage + call worktoscreenm + mov cx,50 + call hangonp + call showpanel + call showman + call examicon + call readmouse + call useopened + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + +Checkobjectsize proc near + + call getopenedsize + push ax + mov al,itemframe + call geteitherad + mov al,[es:bx+9] + pop cx + + cmp al,255 ;gives a size of 6 if no + jnz notunsized ;size was defined in the editor + mov al,6 ;could be a bad idea +notunsized: + + + cmp al,100 + jnc specialcase + cmp cl,100 + jc isntspecial + call errormessage3 + jmp sizewrong +isntspecial: cmp cl,al + jnc sizeok +specialcase: sub al,100 + cmp cl,100 + jnc bothspecial + cmp cl,al + jnc sizeok + call errormessage2 + jmp sizewrong +bothspecial: sub cl,100 + cmp al,cl + jz sizeok + call errormessage3 +sizewrong: mov al,1 + ret +sizeok: mov al,0 + ret + + endp + + + + + + + + +Outofopen proc near + + cmp openedob,255 + jz cantuseopen + call findopenpos + mov ax,[es:bx] + cmp al,255 + jnz canpick4 +cantuseopen: call blank + ret + +canpick4: cmp ax,oldsubject + jnz difsub4 + cmp commandtype,228 + jz alreadygrb + mov commandtype,228 + +difsub4: mov oldsubject,ax + mov bx,ax + mov al,36 + call commandwithob +alreadygrb: mov ax,mousebutton + cmp ax,oldbutton + jz notletgo4 + cmp ax,1 + jz dogrb + cmp ax,2 + jnz notletgo4 + call reexfromopen +notletgo4: ret + +dogrb: call delpointer + mov pickup,1 + call findopenpos + mov ax,[es:bx] + mov itemframe,al + mov objecttype,ah + + cmp ah,4 + jnz makeintoex + call geteitherad + mov byte ptr [es:bx+2],20 ; means unplaced object + mov byte ptr [es:bx+3],255 + jmp actuallyout + +makeintoex: call transfertoex + mov itemframe,al + mov objecttype,4 + call geteitherad + mov byte ptr [es:bx+2],20 ; means it is in transit + mov byte ptr [es:bx+3],255 + +actuallyout: call fillopen + call undertextline + call readmouse + call useopened + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + +;All Extra object code - adding and removing plus purge routines ------------- + + + + + + +Transfertoex proc near + + call emergencypurge + + call getexpos + mov al,expos + push ax + + push di + mov al,itemframe + mov ah,0 + mov bx,16 + mul bx + mov ds,freedat + mov si,ax + mov cx,8 + rep movsw + pop di + + mov al,reallocation + mov [es:di],al + mov [es:di+11],al + mov al,itemframe + mov [es:di+1],al + mov byte ptr [es:di+2],4 + mov byte ptr [es:di+3],255 + mov al,lastinvpos + mov [es:di+4],al + + mov al,itemframe + mov itemtotran,al + call transfermap + call transferinv + call transfertext + + mov al,itemframe + mov ah,0 + mov bx,16 + mul bx + mov ds,freedat + mov si,ax + mov byte ptr [si+2],254 ; was 255 + call pickupconts + + pop ax + ret + + endp + + + + + + + + + + + + + + +Pickupconts proc near + + mov al,[si+7] + cmp al,255 + jz notopenable + + mov al,itemframe + mov ah,objecttype + mov dl,expos + ;dec dl + mov es,freedat + mov bx,0 + mov cx,0 +pickupcontloop: push cx es bx dx ax + + cmp byte ptr [es:bx+2],ah + jnz notinsidethis + cmp byte ptr [es:bx+3],al + jnz notinsidethis + + mov itemtotran,cl + call transfercontoex + +notinsidethis: pop ax dx bx es cx + add bx,16 + inc cx + cmp cx,80 + jnz pickupcontloop + +notopenable: ret + + endp + + + + + + + +Transfercontoex proc near + + push es bx + + push dx es bx + call getexpos + pop si ds + + push di + mov cx,8 + rep movsw + pop di + pop dx + + mov al,reallocation + mov [es:di],al + mov [es:di+11],al + mov al,itemtotran + mov [es:di+1],al + mov [es:di+3],dl + mov byte ptr [es:di+2],4 + + call transfermap + call transferinv + call transfertext + ;inc expos + + pop si ds + mov byte ptr [si+2],255 + ret + + endp + + + + + + + + + + + + + + + + + + +Transfertext proc near + + mov es,extras + mov al,expos + mov ah,0 + add ax,ax + mov bx,extextdat + add bx,ax + mov di,extextpos + mov [es:bx],di + add di,extext + + mov al,itemtotran + mov ah,0 + add ax,ax + mov ds,freedesc + mov bx,freetextdat + add bx,ax + mov si,freetext + mov ax,[bx] + add si,ax + +moretext: lodsb + stosb + inc extextpos + cmp al,0 + jnz moretext + ret + + endp + + + + + + + + + + +Getexpos proc near + + + mov es,extras + mov al,0 + mov di,exdata +tryanotherex: cmp byte ptr [es:di+2],255 + jz foundnewex + add di,16 + inc al + cmp al,numexobjects + jnz tryanotherex +foundnewex: mov expos,al + ret + + endp + + + + + + + + + +Purgealocation proc near + + push ax + mov es,extras + mov di,exdata + pop bx + mov cx,0 +purgeloc: cmp bl,[es:di+0] + jnz dontpurge + cmp byte ptr [es:di+2],0 + jnz dontpurge + push di es bx cx + call deleteexobject + pop cx bx es di +dontpurge: add di,16 + inc cx + cmp cx,numexobjects + jnz purgeloc + ret + + endp + + + + + +Emergencypurge proc near + +checkpurgeagain: mov ax,exframepos + add ax,4000 + cmp ax,exframeslen + jc notnearframeend + call purgeanitem + jmp checkpurgeagain +notnearframeend: mov ax,extextpos + add ax,400 + cmp ax,extextlen + jc notneartextend + call purgeanitem + jmp checkpurgeagain +notneartextend: ret + + endp + + + + + + +Purgeanitem proc near + + mov es,extras ;first time try and + mov di,exdata ;find an object in a + mov bl,reallocation ;location other than + mov cx,0 ;the one the player is +lookforpurge: mov al,[es:di+2] ;in + cmp al,0 + jnz cantpurge + cmp byte ptr [es:di+12],2 + jz iscup + cmp byte ptr [es:di+12],255 + jnz cantpurge +iscup: cmp byte ptr [es:di+11],bl + jz cantpurge + call deleteexobject + ret +cantpurge: add di,16 + inc cx + cmp cx,numexobjects + jnz lookforpurge + + mov di,exdata + mov bl,reallocation + mov cx,0 +lookforpurge2: mov al,[es:di+2] + cmp al,0 + jnz cantpurge2 + cmp byte ptr [es:di+12],255 + jnz cantpurge2 + call deleteexobject + ret +cantpurge2: add di,16 + inc cx + cmp cx,numexobjects + jnz lookforpurge2 + ret + + endp + + + + + +Deleteexobject proc near ;es:di holds data ad + ;cx holds number + push cx cx cx cx + mov al,255 + mov cx,16 + rep stosb + pop ax + mov cl,al + add al,al + add al,cl + call deleteexframe + pop ax + mov cl,al + add al,al + add al,cl + inc al + call deleteexframe + pop ax + call deleteextext + + pop bx + mov bh,bl + mov bl,4 + mov di,exdata + mov cx,0 +deleteconts: cmp [es:di+2],bx + jnz notinsideex + push bx cx di + call deleteexobject ;Oooh missus! + pop di cx bx ;Recursive code! +notinsideex: add di,16 + inc cx + cmp cx,numexobjects + jnz deleteconts + ret + + endp + + + + + +Deleteexframe proc near ;al holds frame to delete + + mov di,exframedata + mov ah,0 + add ax,ax + add di,ax + add ax,ax + add di,ax + mov al,[es:di] + mov ah,0 + mov cl,[es:di+1] + mov ch,0 + mul cx ;ax holds size of this + ;frame in bytes + mov si,[es:di+2] + push si + add si,exframes + mov cx,exframeslen + sub cx,[es:di+2] + mov di,si ;di/si hold start of frame + add si,ax ;si holds end of frame + push ax + push es + pop ds + rep movsb + pop bx ;bx holds size now + sub exframepos,bx + pop si ;si holds start of frame + ;(offset only) + mov cx,numexobjects*3 + mov di,exframedata +shuffleadsdown: mov ax,[es:di+2] + cmp ax,si + jc beforethisone + sub ax,bx +beforethisone: mov [es:di+2],ax + add di,6 + loop shuffleadsdown + ret + + endp + + + + +Deleteextext proc near + + mov di,extextdat + mov ah,0 + add ax,ax + add di,ax + mov ax,[es:di] + mov si,ax + mov di,ax + add si,extext + add di,extext + mov ax,0 +findlenextext: mov cl,[es:si] + inc ax + inc si + cmp cl,0 + jnz findlenextext + + mov cx,extextlen + mov bx,si + sub bx,extext + push bx ax + sub cx,bx + rep movsb + pop bx + sub extextpos,bx + + pop si + mov cx,numexobjects + mov di,extextdat +shuffletextads: mov ax,[es:di] + cmp ax,si + jc beforethistext + sub ax,bx +beforethistext: mov [es:di],ax + add di,2 + loop shuffletextads + ret + + endp + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/print.asm b/devtools/tasmrecover/dreamweb/print.asm new file mode 100644 index 0000000000..2dbf616efc --- /dev/null +++ b/devtools/tasmrecover/dreamweb/print.asm @@ -0,0 +1,591 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +Printchar proc near + + cmp al,255 + jz ignoreit + push si bx di + if foreign + sub bx,3 + endif + push ax + sub al,32 ;"A" + mov ah,0 + add ax,charshift + call showframe + pop ax di bx si + cmp kerning,0 + jnz nokern + call kernchars +nokern: push cx + mov ch,0 + add di,cx + pop cx + ;dec di +ignoreit: ret + + endp + + + + + + + + + + +Kernchars proc near + + ;sub al,13 + cmp al,"a" + jz iskern + cmp al,"u" + jz iskern + ret +iskern: cmp ah,"n" + jz kernit + cmp ah,"t" + jz kernit + cmp ah,"r" + jz kernit + cmp ah,"i" + jz kernit + cmp ah,"l" + jz kernit + ret +kernit: dec cl + ret + + endp + + + + + + +;------------------------------------------------Proportional text printing---- + + +;Memprint proc near +; +; call usecharset1 +; +; push ax bx cx dx es ds si di +; call deltextline +; pop di si ds es dx cx bx ax +; +; pop si +; push cs +; pop es +; inc si +; mov ds,currentset +; mov di,textaddressx +; mov bx,textaddressy +; mov dl,textlen +; mov al,0 +; mov ah,0 +; call printdirect +; push si + +; mov newtextline,1 +; ret + +; endp + + + + + + +;------------------------------------------------Proportional text printing---- + +;Print proc near +; +; pop si +; mov bx,[cs:si+2] +; mov di,[cs:si+0] +; mov dl,[cs:si+4] +; add si,6 +; mov ds,currentset +; +;printloop2: push bx di dx +; push es cs +; pop es +; call getnumber +; pop es +; mov ch,0 +;printloop1: mov ax,[cs:si] +; inc si +; cmp al,0 +; jz finishprint +; push cx es +; call modifychar +; call printchar +; pop es cx +; loop printloop1 +; pop dx di bx +; add bx,linespacing +; jmp printloop2 + +;finishprint: pop dx di bx + ; push si + ; ret + + ; endp + + + + + + + + + +Printslow proc near + + mov pointerframe,1 + mov pointermode,3 + mov ds,charset1 +printloopslow6: push bx di dx + call getnumber + + mov ch,0 +printloopslow5: push cx si es + mov ax,[es:si] + push bx cx es si ds + if foreign + call modifychar + endif + call printboth + pop ds si es cx bx + mov ax,[es:si+1] + inc si + cmp al,0 + jz finishslow + cmp al,":" + jz finishslow + cmp cl,1 + jz afterslow + push di ds bx cx es si + if foreign + call modifychar + endif + mov charshift,91 + call printboth + mov charshift,0 + pop si es cx bx ds di + call waitframes + cmp ax,0 + jz keepgoing + cmp ax,oldbutton + jnz finishslow2 +keepgoing: call waitframes +noslow: cmp ax,0 + jz afterslow + cmp ax,oldbutton + jnz finishslow2 ;used to finish early +afterslow: pop es si cx + inc si + loop printloopslow5 + + pop dx di bx + add bx,10 + jmp printloopslow6 + +finishslow: pop es si cx dx di bx + mov al,0 + ret + +finishslow2: pop es si cx dx di bx + mov al,1 + ret + + endp + + + +Waitframes proc near + + push di bx es si ds + call readmouse + call showpointer + call vsync + call dumppointer + call delpointer + mov ax,mousebutton + pop ds si es bx di + ret + + endp + + + + +Printboth proc near + + push ax cx bx + push di + call printchar + pop ax + push di + mov di,ax + call multidump + pop di + pop bx cx ax + ret + + endp + + + + + + +Printdirect proc near + + mov lastxpos,di + mov ds,currentset +printloop6: push bx di dx + call getnumber + mov ch,0 +printloop5: mov ax,[es:si] + inc si + cmp al,0 + jz finishdirct + cmp al,":" + jz finishdirct + push cx es + if foreign + call modifychar + endif + call printchar + mov lastxpos,di + pop es cx + loop printloop5 + pop dx di bx + add bx,linespacing + jmp printloop6 + +finishdirct: pop dx di bx + ret + + endp + + + + + + + + + + + + + + +Monprint proc near + + mov kerning,1 + mov si,bx + mov dl,166 + mov di,monadx + mov bx,monady + mov ds,tempcharset + +printloop8: push bx di dx + call getnumber + mov ch,0 +printloop7: mov al,[es:si] + inc si + + cmp al,":" + jz finishmon2 + cmp al,0 + jz finishmon + cmp al,34 + jz finishmon + cmp al,"=" + jz finishmon + cmp al,"%" + jnz nottrigger + mov ah,[es:si] + inc si + inc si + jmp finishmon +nottrigger: push cx es + if foreign + call modifychar + endif + call printchar + mov curslocx,di + mov curslocy,bx + mov maintimer,1 + call printcurs + + call vsync + push si dx ds es bx di + call lockmon + pop di bx es ds dx si + call delcurs + pop es cx + loop printloop7 + +finishmon2: pop dx di bx + call scrollmonitor + mov curslocx,di + jmp printloop8 + +finishmon: pop dx di bx + cmp al,"%" + jnz nottrigger2 + mov lasttrigger,ah +nottrigger2: mov curslocx,di + call scrollmonitor + mov bx,si + mov kerning,0 + ret + + endp + + + + + + + + + +Getnumber proc near + + mov cx,0 + push si bx di ds es + mov di,si + +wordloop: push cx dx + call getnextword + pop dx cx + cmp al,1 + jz endoftext + mov al,cl + mov ah,0 + push bx + mov bh,0 + add ax,bx + pop bx + sub ax,10 + mov dh,0 + cmp ax,dx + jnc gotoverend + add cl,bl + add ch,bh + jmp wordloop + +gotoverend: mov al,dl + and al,1 + jz notcentre + push cx + mov al,dl + and al,11111110b + mov ah,0 + mov ch,0 + sub ax,cx + add ax,20 + shr ax,1 + pop cx + pop es ds di bx si + add di,ax + mov cl,ch + ret +notcentre: pop es ds di bx si + mov cl,ch + ret + + + +endoftext: mov al,cl + mov ah,0 + push bx + mov bh,0 + add ax,bx + pop bx + sub ax,10 + mov dh,0 + cmp ax,dx + jnc gotoverend2 + add cl,bl + add ch,bh + +gotoverend2: mov al,dl + and al,1 + jz notcent2 + push cx + mov al,dl + and al,11111110b + add al,2 + mov ah,0 + mov ch,0 + add ax,20 + sub ax,cx + shr ax,1 + pop cx + pop es ds di bx si + add di,ax + mov cl,ch + ret +notcent2: pop es ds di bx si + mov cl,ch + ret + + endp + + + + + +Getnextword proc near + + mov bx,0 +getloop: mov ax,[es:di] + inc di + inc bh + cmp al,":" + jz endall + cmp al,0 + jz endall + cmp al,32 + jz endword + if foreign + call modifychar + endif + cmp al,255 + jz getloop + push ax + sub al,32 ;"A" + mov ah,0 + add ax,charshift + add ax,ax + mov si,ax + add ax,ax + add si,ax + mov cl,[si+0] + pop ax + call kernchars + add bl,cl + ;dec bl + jmp getloop + +endword: add bl,6 + mov al,0 + ret + +endall: add bl,6 + mov al,1 + ret + + endp + + + + + + if german + +Modifychar proc near + + cmp al,128 + jc nomod + cmp al,129 + jnz not129 + mov al,"Z"+3 + ret +not129: cmp al,132 + jnz not132 + mov al,"Z"+1 + ret +not132: cmp al,142 + jnz not142 + mov al,"Z"+4 + ret +not142: cmp al,154 + jnz not154 + mov al,"Z"+6 + ret +not154: cmp al,225 + jnz not225 + mov al,"A"-1 + ret +not225: cmp al,153 + jnz not153 + mov al,"Z"+5 + ret +not153: cmp al,148 + jnz not148 + mov al,"Z"+2 + ret +not148: ret + +nomod: ret + + endp + + endif + + + + + if spanish + +Modifychar proc near + + cmp al,128 + jc nomod + cmp al,160 + jnz not160 + mov al,"Z"+1 + ret +not160: cmp al,130 + jnz not130 + mov al,"Z"+2 + ret +not130: cmp al,161 + jnz not161 + mov al,"Z"+3 + ret +not161: cmp al,162 + jnz not162 + mov al,"Z"+4 + ret +not162: cmp al,163 + jnz not163 + mov al,"Z"+5 + ret +not163: cmp al,164 + jnz not164 + mov al,"Z"+6 + ret +not164: cmp al,165 + jnz not165 + mov al,","-1 + ret +not165: cmp al,168 + jnz not168 + mov al,"A"-1 + ret +not168: cmp al,173 + jnz not173 + mov al,"A"-4 + ret +not173: cmp al,129 + jnz not129 + mov al,"A"-5 +not129: ret + +nomod: ret + + endp + + endif + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/saveload.asm b/devtools/tasmrecover/dreamweb/saveload.asm new file mode 100644 index 0000000000..a814c50bd6 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/saveload.asm @@ -0,0 +1,1495 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text + + +Zoomonoff proc near + + cmp watchingtime,0 + jnz blank + cmp pointermode,2 + jz blank + cmp commandtype,222 + jz alreadyonoff + mov commandtype,222 + mov al,39 + call commandonly +alreadyonoff: mov ax,mousebutton + cmp ax,oldbutton + jz nozoomonoff + and ax,1 + jnz dozoomonoff +nozoomonoff: ret + +dozoomonoff: mov al,zoomon + xor al,1 + mov zoomon,al + + call createpanel + mov newobs,0 + call drawfloor + call printsprites + call reelsonscreen + call showicon + call getunderzoom + call undertextline + mov al,39 + call commandonly + call readmouse + call worktoscreenm + ret + + endp + + + + + + + + + + + + +Saveload proc near + + if demo + call dosreturn + ret + else + cmp watchingtime,0 + jnz blank + cmp pointermode,2 + jz blank + cmp commandtype,253 + jz alreadyops + mov commandtype,253 + mov al,43 + call commandonly +alreadyops: mov ax,mousebutton + cmp ax,oldbutton + jz noops + and ax,1 + jz noops + call dosaveload +noops: ret + endif + + endp + + + + + + + + + + + +Dosaveload proc near + + mov pointerframe,0 + mov textaddressx,70 + mov textaddressy,182-8 + mov textlen,181 + mov manisoffscreen,1 + call clearwork + call createpanel2 + call undertextline + call getridofall ;reels + call loadsavebox + call showopbox + call showmainops + call worktoscreen ;2 + jmp donefirstops + +restartops: call showopbox + call showmainops + call worktoscreenm +donefirstops: mov getback,0 +waitops: call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + call delpointer + mov bx,offset cs:opslist + call checkcoords + cmp getback,0 + jz waitops + cmp getback,2 + jz restartops + mov textaddressx,13 + mov textaddressy,182 + mov textlen,240 + cmp getback,4 + jz justret + call getridoftemp + call restoreall ;reels + call redrawmainscrn + call worktoscreenm + mov commandtype,200 +justret: mov manisoffscreen,0 + ret + +opslist: dw opsx+59,opsx+114,opsy+30,opsy+76,getbackfromops + dw opsx+10,opsx+77,opsy+10,opsy+59,dosreturn + dw opsx+128,opsx+190,opsy+16,opsy+100,discops + dw 0,320,0,200,blank + dw 0ffffh + + + endp + + + +Getbackfromops proc near + + cmp mandead,2 + jz opsblock1 + call getback1 + ret +opsblock1: call blank + ret + + endp + + + + + +Showmainops proc near + + mov ds,tempgraphics + mov di,opsx+10 + mov bx,opsy+10 + mov al,8 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,opsx+59 + mov bx,opsy+30 + mov al,7 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,opsx+128+4 + mov bx,opsy+12 + mov al,1 + mov ah,0 + call showframe + ret + + endp + + + + +Showdiscops proc near + + mov ds,tempgraphics + mov di,opsx+128+4 + mov bx,opsy+12 + mov al,1 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,opsx+10 + mov bx,opsy+10 + mov al,9 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,opsx+59 + mov bx,opsy+30 + mov al,10 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,opsx+176+2 + mov bx,opsy+60-4 + mov al,5 + mov ah,0 + call showframe + ret + + endp + + + + +Loadsavebox proc near + + mov dx,offset cs:icongraphics8 + call loadintotemp + ret + + endp + + + + + + + + +Loadgame proc near + + cmp commandtype,246 + jz alreadyload + mov commandtype,246 + mov al,41 + call commandonly +alreadyload: mov ax,mousebutton + cmp ax,oldbutton + jz noload + cmp ax,1 + jz doload +noload: ret + +doload: mov loadingorsave,1 + call showopbox + call showloadops + mov currentslot,0 + call showslots + call shownames + mov pointerframe,0 + call worktoscreenm + call namestoold + mov getback,0 + +loadops: call delpointer + call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + + mov bx,offset cs:loadlist + call checkcoords + cmp getback,0 + jz loadops + cmp getback,2 + jz quitloaded + call getridoftemp + ;call clearnoreels + mov dx,seg madeuproomdat + mov es,dx + mov bx,offset es:madeuproomdat + call startloading + call loadroomssample + mov roomloaded,1 + mov newlocation,255 + call clearsprites + call initman + call initrain + mov textaddressx,13 + mov textaddressy,182 + mov textlen,240 + call startup + call worktoscreen + mov getback,4 +quitloaded: ret + +loadlist: dw opsx+176,opsx+192,opsy+60,opsy+76,getbacktoops + dw opsx+128,opsx+190,opsy+12,opsy+100,actualload + dw opsx+2,opsx+92,opsy+4,opsy+81,selectslot + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + + + +Getbacktoops proc near + + cmp commandtype,201 + jz alreadygetops + mov commandtype,201 + mov al,42 + call commandonly +alreadygetops: mov ax,mousebutton + cmp ax,oldbutton + jz nogetbackops + and ax,1 + jnz dogetbackops +nogetbackops: ret + +dogetbackops: call oldtonames + mov getback,2 + ret + + endp + + + + + + + +Discops proc near + + cmp commandtype,249 + jz alreadydiscops + mov commandtype,249 + mov al,43 + call commandonly +alreadydiscops: mov ax,mousebutton + cmp ax,oldbutton + jz nodiscops + and ax,1 + jnz dodiscops +nodiscops: ret +dodiscops: call scanfornames + mov loadingorsave,2 + call showopbox + call showdiscops + mov currentslot,0 + call worktoscreenm + + mov getback,0 +discopsloop: call delpointer + call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + mov bx,offset cs:discopslist + call checkcoords + cmp getback,0 + jz discopsloop + ret + +discopslist: dw opsx+59,opsx+114,opsy+30,opsy+76,loadgame + dw opsx+10,opsx+79,opsy+10,opsy+59,savegame + dw opsx+176,opsx+192,opsy+60,opsy+76,getbacktoops + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + + + + +Savegame proc near + + cmp mandead,2 + jnz cansaveok + call blank + ret + +cansaveok: cmp commandtype,247 + jz alreadysave + mov commandtype,247 + mov al,44 + call commandonly +alreadysave: mov ax,mousebutton + and ax,1 + jnz dosave + ret +dosave: mov loadingorsave,2 + call showopbox + call showsaveops + mov currentslot,0 + call showslots + call shownames + call worktoscreenm + + call namestoold + mov bufferin,0 + mov bufferout,0 + + mov getback,0 + +saveops: call delpointer + call checkinput + call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + + mov bx,offset cs:savelist + call checkcoords + cmp getback,0 + jz saveops + ret + +savelist: dw opsx+176,opsx+192,opsy+60,opsy+76,getbacktoops + dw opsx+128,opsx+190,opsy+12,opsy+100,actualsave + dw opsx+2,opsx+92,opsy+4,opsy+81,selectslot + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + +Actualsave proc near + + cmp commandtype,222 + jz alreadyactsave + mov commandtype,222 + mov al,44 + call commandonly +alreadyactsave: mov ax,mousebutton + and ax,1 + jz noactsave + + mov dx,seg savenames + mov ds,dx + mov si,offset savenames + mov al,currentslot + mov ah,0 + mov cx,17 + mul cx + add si,ax + inc si + cmp byte ptr [si],0 + jz noactsave + + mov al,location + mov ah,0 + mov cx,32 + mul cx + push cs + pop ds + mov si,offset cs:roomdata + add si,ax + + mov di,offset cs:madeuproomdat + mov bx,di + push cs + pop es + mov cx,16 + rep movsw + + mov al,roomssample + mov [es:bx+13],al + mov al,mapx + mov [es:bx+15],al + mov al,mapy + mov [es:bx+16],al + mov al,liftflag + mov [es:bx+20],al + mov al,manspath + mov [es:bx+21],al + mov al,facing + mov [es:bx+22],al + mov al,255 + mov [es:bx+27],al + call saveposition + call getridoftemp + call restoreall ;reels + mov textaddressx,13 + mov textaddressy,182 + mov textlen,240 + call redrawmainscrn + call worktoscreenm + mov getback,4 +noactsave: ret + + endp + + + + +Actualload proc near + + cmp commandtype,221 + jz alreadyactload + mov commandtype,221 + mov al,41 + call commandonly +alreadyactload: mov ax,mousebutton + cmp ax,oldbutton + jz notactload + cmp ax,1 + jnz notactload + + mov dx,seg savenames + mov ds,dx + mov si,offset savenames + mov al,currentslot + mov ah,0 + mov cx,17 + mul cx + add si,ax + inc si + cmp byte ptr [si],0 + jz notactload + call loadposition + mov getback,1 +notactload: ret + + endp + + + + +Selectslot2 proc near + + cmp mousebutton,0 + jz noselslot2 + mov loadingorsave,2 +noselslot2: call selectslot + ret + + endp + + + + + +Checkinput proc near + + cmp loadingorsave,3 + jz nokeypress + call readkey + mov al,currentkey + cmp al,0 + jz nokeypress + cmp al,13 + jnz notret + mov loadingorsave,3 + jmp afterkey +notret: cmp al,8 + jnz nodel2 + cmp cursorpos,0 + jz nokeypress + call getnamepos + dec cursorpos + mov byte ptr [es:bx],0 + mov byte ptr [es:bx+1],1 + jmp afterkey +nodel2: ;cmp al,32 + ;jz spacepress + ;cmp al,"A" + ;jc nokeypress + ;cmp al,"Z"+1 + ;jnc nokeypress +spacepress: cmp cursorpos,14 + jz nokeypress + call getnamepos + inc cursorpos + mov al,currentkey + mov [es:bx+1],al + mov byte ptr [es:bx+2],0 + mov byte ptr [es:bx+3],1 + jmp afterkey + +nokeypress: ret + +afterkey: call showopbox + call shownames + call showslots + call showsaveops + call worktoscreenm + ret + + endp + + + + + +Getnamepos proc near + + mov al,currentslot + mov ah,0 + mov cx,17 + mul cx + mov dx,seg savenames + mov es,dx + mov bx,offset es:savenames + add bx,ax + mov al,cursorpos + mov ah,0 + add bx,ax + ret + + endp + + + + + + + + +Showopbox proc near + + mov ds,tempgraphics + mov di,opsx + mov bx,opsy + mov al,0 + mov ah,0 + call showframe + + mov ds,tempgraphics + mov di,opsx + mov bx,opsy+55 + mov al,4 + mov ah,0 + call showframe + ret + + endp + + + + + + + + +Showloadops proc near + + mov ds,tempgraphics + mov di,opsx+128+4 + mov bx,opsy+12 + mov al,1 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,opsx+176+2 + mov bx,opsy+60-4 + mov al,5 + mov ah,0 + call showframe + + mov di,opsx+104 + mov bx,opsy+14 + mov al,55 + mov dl,101 + call printmessage + ret + + endp + + + + +Showsaveops proc near + + mov ds,tempgraphics + mov di,opsx+128+4 + mov bx,opsy+12 + mov al,1 + mov ah,0 + call showframe + mov ds,tempgraphics + mov di,opsx+176+2 + mov bx,opsy+60-4 + mov al,5 + mov ah,0 + call showframe + + mov di,opsx+104 + mov bx,opsy+14 + mov al,54 + mov dl,101 + call printmessage + ret + + endp + + + + + +Selectslot proc near + + cmp commandtype,244 + jz alreadysel + mov commandtype,244 + mov al,45 + call commandonly +alreadysel: mov ax,mousebutton + cmp ax,1 + jnz noselslot + cmp ax,oldbutton + jz noselslot + + cmp loadingorsave,3 + jnz notnocurs + dec loadingorsave +notnocurs: call oldtonames + mov ax,mousey + sub ax,opsy+4 + mov cl,-1 +getslotnum: inc cl + sub ax,11 + jnc getslotnum + mov currentslot,cl + call delpointer + call showopbox + call showslots + call shownames + cmp loadingorsave,1 + jz isloadmode + call showsaveops + call readmouse + call showpointer + call worktoscreen + call delpointer + ret +isloadmode: call showloadops + call readmouse + call showpointer + call worktoscreen + call delpointer + ret + +noselslot: ret + + endp + + + + + + + + + + +Showslots proc near + + mov di,opsx+7 + mov bx,opsy+8 + mov al,2 + mov ds,tempgraphics + mov ah,0 + call showframe + + mov di,opsx+10 + mov bx,opsy+11 + mov cl,0 +slotloop: push cx di bx + + cmp cl,currentslot + jnz nomatchslot + mov al,3 + mov ds,tempgraphics + mov ah,0 + call showframe + +nomatchslot: pop bx di cx + add bx,10 + inc cl + cmp cl,7 + jnz slotloop + ret + + endp + + + + + +Shownames proc near + + mov dx,seg savenames + mov es,dx + mov si,offset es:savenames+1 + mov di,opsx+21 + mov bx,opsy+10 + mov cl,0 + +shownameloop: push cx di es bx si + mov al,4 + cmp cl,currentslot + jnz nomatchslot2 + + cmp loadingorsave,2 + jnz loadmode + + mov dx,si + mov cx,15 + add si,15 +zerostill: dec si + dec cl + cmp byte ptr [es:si],1 + jnz foundcharacter + jmp zerostill +foundcharacter: mov cursorpos,cl + mov byte ptr [es:si],"/" + mov byte ptr [es:si+1],0 + push si + mov si,dx + mov dl,200 + mov ah,0 + call printdirect + pop si + mov byte ptr [es:si],0 + mov byte ptr [es:si+1],1 + jmp afterprintname + +loadmode: mov al,0 + mov dl,200 + mov ah,0 + mov charshift,91 + call printdirect + mov charshift,0 + jmp afterprintname + +nomatchslot2: mov dl,200 + mov ah,0 + call printdirect + +afterprintname: pop si bx es di cx + add si,17 + add bx,10 + inc cl + cmp cl,7 + jnz shownameloop + ret + + endp + + + + + + + + + + + + + + + + + + +Dosreturn proc near + + cmp commandtype,250 + jz alreadydos + mov commandtype,250 + mov al,46 + call commandonly +alreadydos: mov ax,mousebutton + and ax,1 + jz nodos + +quickquit2: call soundend + call removeemm + +quickquit: if recording + call saverec + mov bx,rechandle + mov ah,3eh + int 21h + endif + if playback + mov bx,rechandle + mov ah,3eh + int 21h + endif + + call resetkeyboard + mov bl,31h + mov al,0 + mov ah,12h + int 10h + call vsync + + mov ah,0 + mov al,3 + int 10h + call error + mov ax,4c00h + int 21h + ret + + endp + + + +Error proc near + + cmp gameerror,1 + jz error1 + cmp gameerror,2 + jz error2 + cmp gameerror,3 + jz error3 + cmp gameerror,4 + jz error4 + cmp gameerror,5 + jz error5 + cmp gameerror,6 + jz error6 + cmp gameerror,7 + jz error7 + cmp gameerror,8 + jz error8 + ret + +error1: mov dx,offset cs:gameerror1 + jmp generalerror + +error2: mov ax,soundbaseadd + sub ax,200h + mov cl,4 + shr ax,cl + add al,"0" + mov bx,offset cs:error2patch + mov [cs:bx+1],al + mov dx,offset cs:gameerror2 + call generalerror + mov dx,offset cs:gameinfo + jmp generalerror + +error3: mov dx,offset cs:gameerror3 + jmp generalerror + +error4: mov dx,offset cs:gameerror4 + jmp generalerror + +error5: mov dx,offset cs:gameerror5 + jmp generalerror + +error6: mov al,soundint + add al,"0" + mov bx,offset cs:error6patch + mov [cs:bx],al + mov dx,offset cs:gameerror6 + call generalerror + mov dx,offset cs:gameinfo + jmp generalerror + +error7: mov dx,offset cs:gameerror7 + jmp generalerror + +error8: mov dx,offset cs:gameerror8 + jmp generalerror + +generalerror: mov ah,9h + push cs + pop ds + int 21h + ret + +nodos: ret + +gameerror1: db 13,10,13,10 + db "Dreamweb has an Error:",13,10 + db "Unable to allocate Expanded Memory." + db 13,10,13,10 + db 24h +gameerror2: db 13,10,13,10 + db "Dreamweb has an Error:",13,10 + db "Sound Blaster card not found at address " +error2patch: db "220 Hex." + db 13,10,13,10 + db 24h +gameerror3: db 13,10,13,10 + db "Dreamweb has an Error:",13,10 + db "Out of Base Memory." + db 13,10,13,10 + db 24h +gameerror4: db 13,10,13,10 + db "Dreamweb has an Error:",13,10 + db "Memory Deallocation problem." + db 13,10,13,10 + db 24h +gameerror5: db 13,10,13,10 + db "Dreamweb has an Error:",13,10 + db "At least 590K of base memory is required." + db 13,10,13,10 + db 24h +gameerror6: db 13,10,13,10 + db "Dreamweb has an Error:",13,10 + db "Sound Blaster not found on interupt " +error6patch: db "0" + db 13,10,13,10 + db 24h +gameerror7: db 13,10,13,10 + db "Dreamweb has an Error:",13,10 + db "Unable to select EMM page." + db 13,10,13,10 + db 24h +gameerror8: db 13,10,13,10 + db "Dreamweb has an Error:",13,10 + db "File not found.c" +error8patch: db 13,10,13,10 + db 24h + +gameinfo: db "Dreamweb looks for Sound Blaster information in",13,10 + db "the BLASTER environment variable (in your AUTOEXEC.BAT)",13,10 + db 13,10,"If this is not found then IRQ 7, DMA channel 1 and base",13,10 + db "address 220h are assumed.",13,10,13,10 + + db "To alter any or all of these settings you can specify them",13,10 + db "on the command line. For example:",13,10,13,10 + db "Type DREAMWEB I7 A220 D1 to run Dreamweb on IRQ 7, DMA",13,10 + db " channel 1 and base address 220h" + db 13,10 + db " DREAMWEB I5 to run Dreamweb on IRQ 5 and",13,10 + db " default address of 220h, DMA 1",13,10 + db 13,10 + db 24h + +endgametext1: db 13,10,13,10 + db "Try the Dreamweb CD in your stereo....",13,10 + db 13,10,13,10 + db 24h + + endp + + + + + + + + +Namestoold proc near + + push cs + pop ds + mov si,offset cs:savenames + mov di,zoomspace + mov es,buffers + mov cx,17*4 + rep movsb + ret + + endp + + + +Oldtonames proc near + + push cs + pop es + mov di,offset cs:savenames + mov si,zoomspace + mov ds,buffers + mov cx,17*4 + rep movsb + ret + + endp + + + +Savefilewrite proc near + mov bx,handle + mov ah,40h + int 21h + ret + endp + +Savefileread proc near + mov bx,handle + mov ah,3fh + int 21h + ret + endp + +Saveposition proc near + + call makeheader + + mov al,currentslot + mov ah,0 + push ax + mov cx,13 + mul cx + mov dx,seg savefiles + mov ds,dx + mov dx,offset savefiles + add dx,ax + call openforsave + + mov dx,seg fileheader + mov ds,dx + mov dx,offset fileheader + mov cx,headerlen + call savefilewrite + mov dx,seg fileheader + mov es,dx + mov di,offset es:filedata + + pop ax + mov cx,17 + mul cx + mov dx,seg savenames + mov ds,dx + mov dx,offset savenames + add dx,ax + call saveseg + + mov dx,seg startvars + mov ds,dx + mov dx,offset startvars + call saveseg + + mov ds,extras + mov dx,exframedata + call saveseg + + mov ds,buffers + mov dx,listofchanges + call saveseg + + mov dx,seg madeuproomdat + mov ds,dx + mov dx,offset madeuproomdat + call saveseg + + mov dx,seg reelroutines + mov ds,dx + mov dx,offset reelroutines + call saveseg + +fquit: call closefile + ret + + endp + + + + + + +Loadposition proc near + + mov timecount,0 + call clearchanges + + mov al,currentslot + mov ah,0 + push ax + mov cx,13 + mul cx + mov dx,seg savefiles + mov ds,dx + mov dx,offset savefiles + add dx,ax + if cd + call openfilefromc + else + call openfile + endif + + push cs + pop ds + mov dx,offset cs:fileheader + mov cx,headerlen + call savefileread + push cs + pop es + mov di,offset cs:filedata + + pop ax + mov cx,17 + mul cx + mov dx,seg savenames + mov ds,dx + mov dx,offset savenames + add dx,ax + call loadseg + + mov dx,seg startvars + mov ds,dx + mov dx,offset startvars + call loadseg + + mov ds,extras + mov dx,exframedata + call loadseg + + mov ds,buffers + mov dx,listofchanges + call loadseg + + mov dx,seg madeuproomdat + mov ds,dx + mov dx,offset madeuproomdat + call loadseg + + push cs + pop ds + mov dx,offset cs:reelroutines + call loadseg + + call closefile + ret + + endp + + + + + +Loadseg proc near + + mov bx,handle + mov ax,[es:di] + add di,2 + push di + push es + mov cx,ax + mov ah,3fh + int 21h + pop es + pop di + ret + + endp + + + + + +Makeheader proc near + + mov dx,seg fileheader + mov es,dx + mov di,offset es:filedata + mov ax,17 + call storeit + mov ax,lengthofvars + call storeit + mov ax,lengthofextra + call storeit + mov ax,numchanges*4 + call storeit + mov ax,48 + call storeit + mov ax,lenofreelrouts + call storeit + ret + + endp + + + + + +Storeit proc near + + cmp ax,0 + jnz isntblank + inc ax +isntblank: stosw + ret + + endp + + + + +Saveseg proc near + + mov cx,[es:di] + add di,2 + push di es + mov bx,handle + mov ah,40h + int 21h + pop es di + ret + + endp + + + +Findlen proc near + + dec bx + add bx,ax +nextone: cmp cl,[bx] + jnz foundlen + dec bx + dec ax + cmp ax,0 + jnz nextone +foundlen: ret + + endp + + + + + +Scanfornames proc near + + mov dx,seg savenames + mov es,dx + mov di,offset es:savenames + mov dx,seg savefiles + mov ds,dx + mov dx,offset savefiles + mov cx,7 +scanloop: push es ds di dx cx + + if cd + call openfilefromc + else + call openfilenocheck + endif + jc notexist + pop cx + inc ch + push cx + push di es + mov dx,seg fileheader + mov ds,dx + mov dx,offset fileheader + mov cx,headerlen + call savefileread + mov dx,seg fileheader + mov es,dx + mov di,offset es:filedata + pop ds dx + call loadseg + mov bx,handle + call closefile + +notexist: pop cx dx di ds es + add dx,13 + add di,17 + dec cl + jnz scanloop + mov al,ch + ret + + endp + + + + + +Decide proc near + + call setmode + call loadpalfromiff + call clearpalette + mov pointermode,0 + mov watchingtime,0 + mov pointerframe,0 + mov textaddressx,70 + mov textaddressy,182-8 + mov textlen,181 + mov manisoffscreen,1 + call loadsavebox + call showdecisions + call worktoscreen + call fadescreenup + mov getback,0 + +waitdecide: call readmouse + call showpointer + call vsync + call dumppointer + call dumptextline + call delpointer + mov bx,offset cs:decidelist + call checkcoords + cmp getback,0 + jz waitdecide + cmp getback,4 + jz hasloadedroom + call getridoftemp +hasloadedroom: mov textaddressx,13 + mov textaddressy,182 + mov textlen,240 + ret + +decidelist: dw opsx+69,opsx+124,opsy+30,opsy+76,newgame + dw opsx+20,opsx+87,opsy+10,opsy+59,dosreturn + dw opsx+123,opsx+190,opsy+10,opsy+59,loadold + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + + +Showdecisions proc near + + call createpanel2 + call showopbox + mov ds,tempgraphics + mov di,opsx+17 + mov bx,opsy+13 + mov al,6 + mov ah,0 + call showframe + call undertextline + ret + + endp + + + + + +Newgame proc near + + cmp commandtype,251 + jz alreadynewgame + mov commandtype,251 + mov al,47 + call commandonly +alreadynewgame: mov ax,mousebutton + cmp ax,1 + jnz nonewgame + mov getback,3 +nonewgame: ret + + endp + + + + + + + +Loadold proc near + + cmp commandtype,252 + jz alreadyloadold + mov commandtype,252 + mov al,48 + call commandonly +alreadyloadold: mov ax,mousebutton + and ax,1 + jz noloadold + call doload + cmp getback,4 + jz noloadold + call showdecisions + call worktoscreenm + mov getback,0 +noloadold: ret + + endp + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/sblaster.asm b/devtools/tasmrecover/dreamweb/sblaster.asm new file mode 100644 index 0000000000..113bdd9548 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/sblaster.asm @@ -0,0 +1,1293 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +; Creative Reality Sound Blaster Drivers . (C) 1994 Creative Reality + +; Very sparsly commented. + + + +;These drivers are not stand alone. We had them as an integral part of the +;game. +; +;Put interupt no. into SOUNDINT, base address (eg 220h) into SOUNDBASEADD. +;If interupt is 255 then no card is assumed. +; +;Call soundstartup at beginning of program to test card and initialise. +; +;This code assumes that EMS has been initialised +;Emm page frame is in variable EMMPAGEFRAME. Handle is in EMMHANDLE. +; +;Call loadsample with a filename in CS:DX (ie. in the code somewhere) +; +;To play a sample call playchannel0 or playchannel1 with sound no. in al. +; +;Call endsample to restore interupts and halt sound. +; +; + + + + +;------------------------------------------- Initial sound set up and end --- + +Loadspeech proc near + + cmp soundint,255 + jz dontbother8 + + call cancelch1 + + mov speechloaded,0 + call createname + + mov speechlength,0 + mov dx,offset cs:speechfilename + call openfilenocheck + jc dontbother8 + + mov bx,speechemmpage + +moreloadspeech: push dx bx + + push es di bx + mov al,2 + mov dx,emmhandle + mov ah,44h + int 67h + cmp ah,0 + jnz emmerror + mov ds,emmpageframe + pop bx di es + inc bx + push es di + mov al,3 + mov dx,emmhandle + mov ah,44h + int 67h + cmp ah,0 + jnz emmerror + mov ds,emmpageframe + mov es,emmpageframe + mov di,8000h + mov cx,4000h + mov ax,0 + rep stosw + pop di es + + mov cx,8000h + mov dx,8000h + call readfromfile + mov cl,11 + shr ax,cl + add speechlength,ax + pop bx dx + add bx,2 + cmp ax,0 + jnz moreloadspeech + call closefile + + mov es,sounddata2 + mov di,50*6 + mov ax,speechemmpage + mov [es:di],al + mov ax,0 + mov [es:di+1],ax + mov ax,speechlength + mov [es:di+3],ax + mov speechloaded,1 +dontbother8: ret + +speechfilename: db "SPEECH\" +speechfile: db "R24C0005.RAW",0 + + endp + + + +Createname proc near + + push ax + mov di,offset cs:speechfile + mov byte ptr [cs:di+0],dl ;"R" + mov [cs:di+3],cl + + mov al,dh ;reallocation + mov ah,"0"-1 +findten: inc ah + sub al,10 + jnc findten + mov [cs:di+1],ah + add al,10+"0" + mov [cs:di+2],al + pop ax + + mov cl,"0"-1 +thousandsc: inc cl + sub ax,1000 + jnc thousandsc + add ax,1000 + mov [cs:di+4],cl + mov cl,"0"-1 +hundredsc: inc cl + sub ax,100 + jnc hundredsc + add ax,100 + mov [cs:di+5],cl + mov cl,"0"-1 +tensc: inc cl + sub ax,10 + jnc tensc + add ax,10 + mov [cs:di+6],cl + add al,"0" + mov [cs:di+7],al + ret + + endp + + + + + + +Loadsample proc near + + cmp soundint,255 + jz dontbother + + call openfile + call readheader + mov bx,[es:di] + push es di bx + mov ds,sounddata + pop cx + mov dx,0 + call readfromfile + pop di es + + add di,2 + mov bx,0 + mov dx,[es:di] + add dx,1 + shr dx,1 + + mov soundemmpage,0 + +moreload: push dx bx + + push es di bx + mov al,2 + mov dx,emmhandle + mov ah,44h + int 67h + cmp ah,0 + jnz emmerror + mov ds,emmpageframe + pop bx di es + inc bx + push es di + mov al,3 + mov dx,emmhandle + mov ah,44h + int 67h + cmp ah,0 + jnz emmerror + mov ds,emmpageframe + pop di es + + mov cx,8000h + mov dx,8000h + call readfromfile + pop bx dx + add bx,2 + add soundemmpage,2 + dec dx + jnz moreload + ;inc soundemmpage + call closefile +dontbother: ret + +emmerror: mov gameerror,7 + jmp quickquit2 + + endp + + + + + + +Loadsecondsample proc near + + cmp soundint,255 + jz dontbother9 + + cmp ch0playing,12 + jc ch0oksecond + cmp ch0playing,255 + jz ch0oksecond + call cancelch0 + ;mov cx,100 + ;call hangon + jmp ch0oksecond +justcancel: call cancelch0 +ch0oksecond: cmp ch1playing,12 + jc ch1oksecond + call cancelch1 + +ch1oksecond: call openfile + call readheader + mov bx,[es:di] + push es di bx + mov ds,sounddata2 + pop cx + mov dx,0 + call readfromfile + + mov cx,100 + mov di,0 + mov es,sounddata2 + mov bx,soundemmpage +adjustemmpage: mov al,[es:di] + add al,bl + mov [es:di],al + add di,6 + loop adjustemmpage + + pop di es + + add di,2 + mov bx,soundemmpage + mov speechemmpage,bx + mov dx,[es:di] + add dx,1 + shr dx,1 + +moreload2: push dx bx + + push es di bx + mov al,2 + mov dx,emmhandle + mov ah,44h + int 67h + cmp ah,0 + jnz emmerror2 + mov ds,emmpageframe + pop bx di es + inc bx + push es di + mov al,3 + mov dx,emmhandle + mov ah,44h + int 67h + cmp ah,0 + jnz emmerror2 + mov ds,emmpageframe + pop di es + + mov cx,8000h + mov dx,8000h + call readfromfile + pop bx dx + add bx,2 + add speechemmpage,2 + dec dx + jnz moreload2 + call closefile +dontbother9: ret + +emmerror2: mov gameerror,7 + jmp quickquit2 + + endp + + + + + + +Soundstartup proc near + + cmp soundint,255 + jz dontbother2 + + mov dx,soundbaseadd + add dx,0eh + mov DSP_status,dx + mov dx,soundbaseadd + add dx,0ch + mov DSP_write,dx + + mov al,1 + mov dx,soundbaseadd + add dx,0006h + out dx,al + push ax ax ax ax ax ax ax ax + pop ax ax ax ax ax ax ax ax + mov al,0 + out dx,al + + mov dx,DSP_status + mov cx,2000 +waitinit: in al,dx + and al,128 + jz waitinit + mov dx,soundbaseadd + add dx,000ah + in al,dx + cmp al,0aah + jz dspready + loop waitinit + mov gameerror,2 + jmp quickquit + +dspready: call trysoundalloc + + cli + mov ah,40h ;set sample rate + call out22c + mov ah,210 ;of 22050Hz + call out22c + sti + + call checksoundint + + mov ah,35h + mov al,soundint + add al,8 + int 21h + mov oldsoundintseg,es ; Save es:bx to temp memory + mov oldsoundintadd,bx + push cs + pop ds + mov dx,offset cs:dmaend + mov ah,25h + mov al,soundint + add al,8 + int 21h ; Set to new + + call enablesoundint + + mov al,sounddmachannel + xor ah,ah + mov bx,offset cs:dmaaddresses + add bx,ax + mov al,[cs:bx] + mov dmaaddress,al + + mov ah,0d1h ;speaker on + call out22c + mov ah,0d0h + call out22c + +dontbother2: ret + +dmaaddresses db 87h,83h,81h,82h + + endp + + + + + +Trysoundalloc proc near + + cmp needsoundbuff,1 + jz gotsoundbuff + inc soundtimes + mov bx,(16384+2048)/16 + call allocatemem + mov soundbuffer,ax + push ax + mov al,ah + mov cl,4 + shr al,cl + mov soundbufferpage,al + pop ax + mov cl,4 + shl ax,cl + mov soundbufferad,ax + cmp ax,0b7ffh + jnc soundfail + + mov es,soundbuffer + mov di,0 + mov cx,16384/2 + mov ax,7f7fh + rep stosw + mov needsoundbuff,1 + ret + +soundfail: mov es,soundbuffer + call deallocatemem +gotsoundbuff: ret + + endp + + + + + + +Setsoundoff proc near + + cmp soundint,255 + jz dontbother28 + mov soundbufferwrite,0 + cli + call setupPIT + mov soundbufferwrite,4096 + call startdmablock + sti +dontbother28: ret + + endp + + + + + + +Checksoundint proc near + + mov ah,0d3h ;speaker off + call out22c + + mov testresult,0 + mov ah,35h + mov al,soundint + add al,8 + int 21h + mov oldsoundintseg,es + mov oldsoundintadd,bx + push cs + pop ds + mov dx,offset cs:interupttest + mov ah,25h + mov al,soundint + add al,8 + int 21h + + call enablesoundint + + mov ah,0f2h + call out22c + + mov cx,20 + call hangon + + call disablesoundint + + mov dx,oldsoundintseg + mov ds,dx + mov dx,oldsoundintadd ;Restore old interupt vector + mov ah,25h + mov al,soundint + add al,8 + int 21h + + cmp testresult,1 + jz interuptworked + mov gameerror,6 ;interupt wrong + jmp quickquit ;exit to DOS with error + +interuptworked: ret + + endp + + + + + +Enablesoundint proc near + + mov dx,21h ; Enable int? + in al,dx + mov currentirq,al + mov ah,11111110b + mov cl,soundint + rol ah,cl + and al,ah + out dx,al + ret + + endp + + + + + +Disablesoundint proc near + + mov al,soundint + mov dx,21h + mov al,currentirq + out dx,al + ret + + endp + + + + +Interupttest proc near + + cli + push ax dx + mov testresult,1 + mov dx,DSP_status + in al,dx + mov al,20h + out 20h,al + pop dx ax + iret + + endp + + + + + +Soundend proc near + + cmp soundint,255 + jz dontbother3 + + call getridofPIT + + mov ah,0d0h + call out22c + + call disablesoundint + + mov ds,oldsoundintseg ;for keys + mov dx,oldsoundintadd ;Restore old interupt vector + mov ah,25h + mov al,soundint + add al,8 + int 21h + +dontbother3: ret + + endp + + + + + +Out22c proc near + + mov dx,DSP_write +notclear: in al,dx + or al,al + js notclear + mov al,ah + out dx,al + ret + + endp + + + + + +;--------------------------------------------------------------------------- + + + + +Playchannel0 proc near ;al=sound no + ;ah=times to repeat + cmp soundint,255 + jz dontbother4 + + push es ds bx cx di si + + mov ch0playing,al + mov es,sounddata + cmp al,12 + jc notsecondbank + mov es,sounddata2 + sub al,12 +notsecondbank: mov ch0repeat,ah + mov ah,0 + add ax,ax + mov bx,ax + add ax,ax + add bx,ax + + mov al,[es:bx] + mov ah,0 + mov ch0emmpage,ax + mov ax,[es:bx+1] + mov ch0offset,ax + mov ax,[es:bx+3] + mov ch0blockstocopy,ax + + cmp ch0repeat,0 + jz nosetloop + mov ax,ch0emmpage + mov ch0oldemmpage,ax + mov ax,ch0offset + mov ch0oldoffset,ax + mov ax,ch0blockstocopy + mov ch0oldblockstocopy,ax + +nosetloop: pop si di cx bx ds es + +dontbother4: ret + + endp + + + + + + + +Playchannel1 proc near ;al=sound no + + cmp soundint,255 + jz dontbother5 + cmp ch1playing,7 + jz dontbother5 + push es ds bx cx di si + + mov ch1playing,al + mov es,sounddata + cmp al,12 + jc notsecondbank1 + mov es,sounddata2 + sub al,12 +notsecondbank1: mov ah,0 + add ax,ax + mov bx,ax + add ax,ax + add bx,ax + + mov al,[es:bx] + mov ah,0 + mov ch1emmpage,ax + mov ax,[es:bx+1] + mov ch1offset,ax + mov ax,[es:bx+3] + mov ch1blockstocopy,ax + + pop si di cx bx ds es + +dontbother5: ret + + endp + + + + + + + + +Makenextblock proc near + + call volumeadjust + + call loopchannel0 + cmp ch1blockstocopy,0 + jz mightbeonlych0 + cmp ch0blockstocopy,0 + jz mightbeonlych1 + + dec ch0blockstocopy + dec ch1blockstocopy + call bothchannels + ret + +mightbeonlych1: mov ch0playing,255 + cmp ch1blockstocopy,0 + jz notch1only + dec ch1blockstocopy + call channel1only +notch1only: ret + +mightbeonlych0: mov ch1playing,255 + cmp ch0blockstocopy,0 + jz notch0only + dec ch0blockstocopy + call channel0only + ret +notch0only: mov es,soundbuffer + mov di,soundbufferwrite + mov cx,1024 + mov ax,7f7fh + rep stosw + and di,16384-1 + mov soundbufferwrite,di + ret + + endp + + + + +Volumeadjust proc near + + mov al,volumedirection + cmp al,0 + jz volok + mov al,volume + cmp al,volumeto + jz volfinish + add volumecount,64 + jnz volok + mov al,volume + add al,volumedirection + mov volume,al + ret +volfinish: mov volumedirection,0 +volok: ret + + endp + + + +Loopchannel0 proc near + + cmp ch0blockstocopy,0 + jnz notloop + cmp ch0repeat,0 + jz notloop + cmp ch0repeat,255 + jz endlessloop + dec ch0repeat +endlessloop: mov ax,ch0oldemmpage + mov ch0emmpage,ax + mov ax,ch0oldoffset + mov ch0offset,ax + mov ax,ch0blockstocopy + add ax,ch0oldblockstocopy + mov ch0blockstocopy,ax + ret +notloop: ret + + endp + + + + + + + +Cancelch0 proc near + + mov ch0repeat,0 + mov ch0blockstocopy,0 + mov ch0playing,255 + ret + + endp + + + +Cancelch1 proc near + + mov ch1blockstocopy,0 + mov ch1playing,255 + ret + + endp + + + + +Channel0only proc near + + call saveems + mov al,0 + mov bx,ch0emmpage + mov dx,emmhandle + mov ah,44h + int 67h + + mov es,soundbuffer + mov ds,emmpageframe + mov di,soundbufferwrite + mov si,ch0offset + + call channel0tran + call restoreems + + and di,16384-1 + mov soundbufferwrite,di + and si,16384-1 + mov ch0offset,si + cmp si,0 + jnz notch0endofpage0 + inc ch0emmpage +notch0endofpage0: ret + + endp + + + + +Channel1only proc near + + call saveems + mov al,1 + mov bx,ch1emmpage + mov dx,emmhandle + mov ah,44h + int 67h + + mov es,soundbuffer + mov ds,emmpageframe + mov di,soundbufferwrite + mov si,ch1offset + add si,16384 + + mov cx,1024 + rep movsw + call restoreems + + and di,16384-1 + mov soundbufferwrite,di + and si,16384-1 + mov ch1offset,si + cmp si,0 + jnz notch1endofpage1 + inc ch1emmpage +notch1endofpage1: ret + + endp + + + + + +Channel0tran proc near + + cmp volume,0 + jnz lowvolumetran + mov cx,1024 + rep movsw + ret + +lowvolumetran: mov cx,1024 + mov bh,volume + mov bl,0 + add bx,16384-256 +volloop: lodsw + mov bl,al + mov al,[es:bx] + mov bl,ah + mov ah,[es:bx] + stosw + loop volloop + ret + + + endp + + + + + + + + +Bothchannels proc near ;rather slow routine + ;to mix two channels + + call saveems + mov al,0 + mov bx,ch0emmpage + mov dx,emmhandle + mov ah,44h + int 67h + mov al,1 + mov bx,ch1emmpage + mov dx,emmhandle + mov ah,44h + int 67h + + mov es,soundbuffer + mov ds,emmpageframe + mov di,soundbufferwrite + mov si,ch0offset + mov bx,ch1offset + add bx,16384 + mov cx,2048 + mov dh,128 + mov dl,255 + + call domix + call restoreems + + and di,16384-1 + mov soundbufferwrite,di + + mov si,ch0offset + add si,2048 + and si,16384-1 + mov ch0offset,si + cmp si,0 + jnz notbothendofpage0 + inc ch0emmpage +notbothendofpage0: mov si,ch1offset + add si,2048 + and si,16384-1 + mov ch1offset,si + cmp si,0 + jnz notbothendofpage1 + inc ch1emmpage +notbothendofpage1: ret + + endp + + + +Saveems proc near + + mov ah,4eh + mov al,0 + mov es,soundbuffer + mov di,16384+2048-256 + int 67h + ret + + endp + + +Restoreems proc near + + push si di + mov ah,4eh + mov al,1 + mov ds,soundbuffer + mov si,16384+2048-256 + int 67h + pop di si + ret + + endp + + + +Domix proc near + + cmp volume,0 + jnz lowvolumemix + +slow: lodsb + mov ah,[bx] + inc bx + cmp al,dh + jnc toplot + +botlot: cmp ah,dh + jnc nodistort + add al,ah + js botok + xor al,al + stosb + loop slow + jmp doneit +botok: xor al,dh + stosb + loop slow + jmp doneit + +toplot: cmp ah,dh + jc nodistort + add al,ah + jns topok + mov al,dl + stosb + loop slow + jmp doneit +topok: xor al,dh + stosb + loop slow + jmp doneit + +nodistort: add al,ah + xor al,dh + stosb + loop slow + jmp doneit + + +lowvolumemix: lodsb + push bx + mov bh,volume + add bh,63 + mov bl,al + mov al,[es:bx] + pop bx + + mov ah,[bx] + inc bx + cmp al,dh + jnc toplotv + +botlotv: cmp ah,dh + jnc nodistortv + add al,ah + js botokv + xor al,al + stosb + loop lowvolumemix + jmp doneit +botokv: xor al,dh + stosb + loop lowvolumemix + jmp doneit + +toplotv: cmp ah,dh + jc nodistortv + add al,ah + jns topokv + mov al,dl + stosb + loop lowvolumemix + jmp doneit +topokv: xor al,dh + stosb + loop lowvolumemix + jmp doneit + +nodistortv: add al,ah + xor al,dh + stosb + loop lowvolumemix +doneit: ret + + + endp + + + + + + + +Dmaend proc near + + cli + push ax cx dx + call startdmablock + mov dx,DSP_status + in al,dx + mov al,20h + out 20h,al + pop dx cx ax + iret + + endp + + + + + + + + + + + + + + + + +Startdmablock proc near + + mov al,sounddmachannel ;cx=length + or al,4 ;bx=offset + out 0ah,al + xor al,al + out 0ch,al + + mov al,48h + or al,sounddmachannel + out 0bh,al + + mov cx,soundbufferad + xor dh,dh + mov dl,sounddmachannel + shl dl,1 + mov al,cl + out dx,al + mov al,ch + out dx,al + + mov dl,dmaaddress + mov al,soundbufferpage ;hardware page + out dx,al + + mov dl,sounddmachannel + shl dl,1 + inc dl + mov cx,16384-1 + mov al,cl + out dx,al + mov al,ch + out dx,al + + mov al,sounddmachannel + out 0ah,al ;dmac programmed + + mov dx,DSP_write +notclear1: in al,dx + or al,al + js notclear1 + mov al,14h + out dx,al +notclear2: in al,dx + or al,al + js notclear2 + mov al,cl + out dx,al +notclear3: in al,dx + or al,al + js notclear3 + mov al,ch + out dx,al + + ret + + + endp + + + + + + + + + + + + + + + +SetupPIT proc near + + mov ah,35h + mov al,8 + int 21h + mov oldint8seg,es ; Save es:bx to temp memory + mov oldint8add,bx + push cs + pop ds + mov dx,offset cs:PITinterupt + mov ah,25h + mov al,8 + int 21h ; Set to new + + mov al,34h + out 43h,al + mov al,0h + out 40h,al + mov al,0dah + out 40h,al + ret + + endp + + + + + + +Getridofpit proc near + + cmp oldint8seg,-1 + jz noresetPIT + mov dx,oldint8add + mov ax,oldint8seg + mov ds,ax + mov ah,25h + mov al,8 + int 21h + mov al,34h + out 43h,al + mov al,0 + out 40h,al + mov al,0 + out 40h,al +noresetPIT: ret + + endp + + + + + + +PITinterupt proc near + + cli + push ax dx cx + + xor dh,dh + mov dl,sounddmachannel + shl dl,1 + in al,dx + mov cl,al + in al,dx + mov ch,al + sub cx,soundbufferad + mov ax,soundbufferwrite + sub ax,cx + and ax,3fffh + sti + cmp ax,8192 + jnc mustgo + cmp ax,2048 + jnc nopitflip + +mustgo: push bx si di es ds + call makenextblock + pop ds es di si bx + +nopitflip: cli + mov al,20h + out 20h,al + pop cx dx ax + iret + + endp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/sprite.asm b/devtools/tasmrecover/dreamweb/sprite.asm new file mode 100644 index 0000000000..31325fc2b3 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/sprite.asm @@ -0,0 +1,5034 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +;------------------------------------------------------------People Routines---- + + + +Reelroutines db 1,44,0 ;Room number and x,y + dw 20 ;reel pointer + db 2,0,1 ;speed,speed count,convers. no. + + db 1,55,0 + dw 0 + db 50,20,0 + + db 24,22,0 + dw 74 + db 1,0,0 + + db 24,33,10 + dw 75 + db 1,0,1 + + db 1,44,0 + dw 27 + db 2,0,2 + + db 1,44,0 + dw 96 + db 3,0,4 + + db 1,44,0 + dw 118 + db 2,0,5 + + db 1,44,10 + dw 0 + db 2,0,0 + + db 5,22,20 + dw 53 + db 3,0,0 + + db 5,22,20 + dw 40 + db 1,0,2 + + db 5,22,20 + dw 50 + db 1,0,3 + + db 2,11,10 + dw 192 + db 1,0,0 + + db 2,11,10 + dw 182 + db 2,0,1 + + db 8,11,10 + dw 0 + db 2,0,1 + + db 23,0,50 + dw 0 + db 3,0,0 + + db 28,11,20 + dw 250 + db 4,0,0 + + db 23,0,50 + dw 43 + db 2,0,8 + + db 23,11,40 + dw 130 + db 2,0,1 + + db 23,22,40 + dw 122 + db 2,0,2 + + db 23,22,40 + dw 105 + db 2,0,3 + + db 23,22,40 + dw 81 + db 2,0,4 + + db 23,11,40 + dw 135 + db 2,0,5 + + db 23,22,40 + dw 145 + db 2,0,6 + + db 4,22,30 + dw 0 + db 2,0,0 + + db 45,22,30 + dw 200 + db 0,0,20 + + db 45,22,30 + dw 39 + db 2,0,0 + + db 45,22,30 + dw 25 + db 2,0,0 + + db 8,22,40 + dw 32 + db 2,0,0 + + db 7,11,20 + dw 64 + db 2,0,0 + + db 22,22,20 + dw 82 + db 2,0,0 + + db 27,11,30 + dw 0 + db 2,0,0 + + db 20,0,30 + dw 0 + db 2,0,0 + + db 14,33,40 + dw 21 + db 1,0,0 + + db 29,11,10 + dw 0 + db 1,0,0 + + db 2,22,0 + dw 2 + db 2,0,0 + + db 25,0,50 + dw 4 + db 2,0,0 + + db 50,22,30 + dw 121 + db 2,0,0 + + db 50,22,30 + dw 0 + db 20,0,0 + + db 52,22,30 + dw 192 + db 2,0,0 + + db 52,22,30 + dw 233 + db 2,0,0 + + db 50,22,40 + dw 104 + if cd + if german + db 65,0,0 + else + db 55,0,0 + endif + else + db 55,0,0 + endif + + db 53,33,0 + dw 99 + db 2,0,0 + + db 50,22,40 + dw 0 + db 3,0,0 + + db 50,22,30 + dw 162 + db 2,0,0 + + db 52,22,30 + dw 57 + db 2,0,0 + + db 52,22,30 + dw 0 + db 2,0,0 + + db 54,0,0 + dw 72 + db 3,0,0 + + db 55,44,0 + dw 0 + db 2,0,0 + + db 19,0,0 + dw 0 + db 28,0,0 + + db 14,22,0 + dw 2 + db 2,0,0 + + db 14,22,0 + dw 300 + db 1,0,0 + + db 10,22,30 + dw 174 + db 0,0,0 + + db 12,22,20 + dw 0 + db 1,0,0 + + db 11,11,20 + dw 0 + db 50,20,0 + + db 11,11,30 + dw 0 + db 50,20,0 + + db 11,22,20 + dw 0 + db 50,20,0 + + db 14,33,40 + dw 0 + db 50,20,0 + + db 255 + + +Lenofreelrouts equ $-reelroutines + + +Reelcalls dw gamer,sparkydrip,eden,edeninbath,sparky,smokebloke + dw manasleep,drunk,receptionist,malefan,femalefan + dw louis,louischair,soldier1,bossman,interviewer + dw heavy,manasleep2,mansatstill,drinker,bartender + dw othersmoker,tattooman,attendant,keeper,candles1 + dw smallcandle,security,copper,poolguard,rockstar + dw businessman,train,aide,mugger,helicopter + dw intromagic1,intromusic,intromagic2,candles2,gates + dw intromagic3,intromonks1,candles,intromonks2 + dw handclap,monkandryan,endgameseq,priest,madman + dw madmanstelly,alleybarksound,foghornsound + dw carparkdrip,carparkdrip,carparkdrip,carparkdrip + + + +;---------------------------------------------------------Character updates---- + + + +Alleybarksound proc near + + mov ax,[es:bx+3] + dec ax + cmp ax,0 + jnz nobark + push bx es + mov al,14 + call playchannel1 + pop es bx + mov ax,1000 +nobark: mov [es:bx+3],ax + ret + + endp + + + + +Intromusic proc near + + ret + + endp + + +Foghornsound proc near + + call randomnumber + cmp al,198 + jnz nofog + mov al,13 + call playchannel1 +nofog: ret + + endp + + + + +Receptionist proc near + + call checkspeed + jnz gotrecep + cmp cardpassflag,1 + jnz notsetcard + inc cardpassflag + mov byte ptr [es:bx+7],1 + mov word ptr [es:bx+3],64 +notsetcard: cmp word ptr [es:bx+3],58 + jnz notdes1 + call randomnumber + cmp al,30 + jc notdes2 + mov word ptr [es:bx+3],55 + jmp gotrecep + +notdes1: cmp word ptr [es:bx+3],60 + jnz notdes2 + call randomnumber + cmp al,240 + jc gotrecep + mov word ptr [es:bx+3],53 + jmp gotrecep + +notdes2: cmp word ptr [es:bx+3],88 + jnz notendcard + mov word ptr [es:bx+3],53 + jmp gotrecep + +notendcard: inc word ptr [es:bx+3] +gotrecep: call showgamereel + call addtopeoplelist + + mov al,[es:bx+7] + and al,128 + jz nottalkedrecep + mov talkedtorecep,1 +nottalkedrecep: ret + + endp + + + + +Smokebloke proc near + + cmp rockstardead,0 + jnz notspokento + mov al,[es:bx+7] + and al,128 + jz notspokento + push es bx + mov al,5 + call setlocation + pop bx es +notspokento: ;mov al,[es:bx+7] + ;and al,127 + ;mov [es:bx+7],al + call checkspeed + jnz gotsmokeb + cmp word ptr [es:bx+3],100 + jnz notsmokeb1 + call randomnumber + cmp al,30 + jc notsmokeb2 + mov word ptr [es:bx+3],96 + jmp gotsmokeb + +notsmokeb1: cmp word ptr [es:bx+3],117 + jnz notsmokeb2 + mov word ptr [es:bx+3],96 + jmp gotsmokeb + +notsmokeb2: inc word ptr [es:bx+3] +gotsmokeb: call showgamereel + call addtopeoplelist + ret + + endp + + + + + + + + + + +Attendant proc near + + call showgamereel + call addtopeoplelist + mov al,[es:bx+7] + and al,128 + jz nottalked + mov talkedtoattendant,1 +nottalked: ret + + endp + + + + + + +Manasleep proc near + + mov al,[es:bx+7] + and al,127 + mov [es:bx+7],al + call showgamereel + call addtopeoplelist + ret + + endp + + + +Eden proc near + + cmp generaldead,0 + jnz notinbed + call showgamereel + call addtopeoplelist +notinbed: ret + + endp + + + +Edeninbath proc near + + cmp generaldead,0 + jz notinbed + cmp sartaindead,0 + jnz notinbath + call showgamereel + call addtopeoplelist +notinbath: ret + + endp + + + +Malefan proc near + + call showgamereel + call addtopeoplelist + ret + + endp + + + +Femalefan proc near + + call showgamereel + call addtopeoplelist + ret + + endp + + + + +Louis proc near + + cmp rockstardead,0 + jnz notlouis1 + call showgamereel + call addtopeoplelist +notlouis1: ret + + endp + + + + +Louischair proc near + + cmp rockstardead,0 + jz notlouis2 + call checkspeed + jnz notlouisanim + mov ax,[es:bx+3] + inc ax + cmp ax,191 + jz restartlouis + cmp ax,185 + jz randomlouis + mov [es:bx+3],ax + jmp notlouisanim +randomlouis: mov [es:bx+3],ax + call randomnumber + cmp al,245 + jnc notlouisanim +restartlouis: mov ax,182 + mov [es:bx+3],ax +notlouisanim: call showgamereel + call addtopeoplelist +notlouis2: ret + + endp + + + +Manasleep2 proc near + + mov al,[es:bx+7] + and al,127 + mov [es:bx+7],al + call showgamereel + call addtopeoplelist + ret + + endp + + + + +Mansatstill proc near + + call showgamereel + call addtopeoplelist + ret + + endp + + +Tattooman proc near + + call showgamereel + call addtopeoplelist + ret + + endp + + +Drinker proc near + + call checkspeed + jnz gotdrinker + inc word ptr [es:bx+3] + cmp word ptr [es:bx+3],115 + jnz notdrinker1 + mov word ptr [es:bx+3],105 + jmp gotdrinker + +notdrinker1: cmp word ptr [es:bx+3],106 + jnz gotdrinker + call randomnumber + cmp al,3 + jc gotdrinker + mov word ptr [es:bx+3],105 + +gotdrinker: call showgamereel + call addtopeoplelist + ret + + endp + + + + + +Bartender proc near + + call checkspeed + jnz gotsmoket + cmp word ptr [es:bx+3],86 + jnz notsmoket1 + call randomnumber + cmp al,18 + jc notsmoket2 + mov word ptr [es:bx+3],81 + jmp gotsmoket + +notsmoket1: cmp word ptr [es:bx+3],103 + jnz notsmoket2 + mov word ptr [es:bx+3],81 + jmp gotsmoket + +notsmoket2: inc word ptr [es:bx+3] +gotsmoket: call showgamereel + cmp gunpassflag,1 + jnz notgotgun + mov byte ptr [es:bx+7],9 +notgotgun: call addtopeoplelist + ret + + endp + + + + + + + +Othersmoker proc near + + call showgamereel + call addtopeoplelist + ret + + endp + + + + + + +Barwoman proc near + + call showgamereel + call addtopeoplelist + ret + + endp + + + + + + + + + +Interviewer proc near + + cmp reeltowatch,68 + jnz notgeneralstart + inc word ptr [es:bx+3] +notgeneralstart: cmp word ptr [es:bx+3],250 + jz talking + call checkspeed + jnz talking + cmp word ptr [es:bx+3],259 + jz talking + inc word ptr [es:bx+3] +talking: call showgamereel + ret + + endp + + + + + +Soldier1 proc near + + cmp word ptr [es:bx+3],0 + jz soldierwait + mov watchingtime,10 + cmp word ptr [es:bx+3],30 + jnz notaftersshot + inc combatcount + cmp combatcount,40 + jnz gotsoldframe + mov mandead,2 + jmp gotsoldframe +notaftersshot: call checkspeed + jnz gotsoldframe + inc word ptr [es:bx+3] + jmp gotsoldframe +soldierwait: cmp lastweapon,1 + jnz gotsoldframe + mov watchingtime,10 + cmp manspath,2 + jnz gotsoldframe + cmp facing,4 + jnz gotsoldframe + inc word ptr [es:bx+3] + mov lastweapon,-1 + mov combatcount,0 +gotsoldframe: call showgamereel + call addtopeoplelist + ret + + endp + + + + + + + + +Rockstar proc near + + mov ax,[es:bx+3] + cmp ax,303 + jz rockcombatend + cmp ax,118 + jz rockcombatend + call checkspeed + jnz rockspeed + + mov ax,[es:bx+3] + inc ax + cmp ax,118 + jnz notbeforedead + mov mandead,2 + jmp gotrockframe + +notbeforedead: cmp ax,79 + jnz gotrockframe + dec ax + cmp lastweapon,1 + jnz notgunonrock + mov lastweapon,-1 + mov ax,123 + jmp gotrockframe +notgunonrock: inc combatcount + cmp combatcount,40 + jnz gotrockframe + mov combatcount,0 + mov ax,79 + +gotrockframe: mov [es:bx+3],ax +rockspeed: call showgamereel + cmp word ptr [es:bx+3],78 + jnz notalkrock + call addtopeoplelist + mov pointermode,2 + mov watchingtime,0 + ret + +notalkrock: mov watchingtime,2 + mov pointermode,0 + mov al,mapy + mov [es:bx+2],al + ret + +rockcombatend: mov newlocation,45 + call showgamereel + ret + + endp + + + + + + + + + + + + + + + +Helicopter proc near + + mov ax,[es:bx+3] + cmp ax,203 + jz heliwon + ;cmp ax,53 + ;jz helicombatend + call checkspeed + jnz helispeed + + mov ax,[es:bx+3] + inc ax + cmp ax,53 + jnz notbeforehdead + inc combatcount + cmp combatcount,8 + jc waitabit + mov mandead,2 +waitabit: mov ax,49 + jmp gotheliframe + +notbeforehdead: cmp ax,9 + jnz gotheliframe + dec ax + cmp lastweapon,1 + jnz notgunonheli + mov lastweapon,-1 + mov ax,55 + jmp gotheliframe +notgunonheli: mov ax,5 + inc combatcount + cmp combatcount,20 + jnz gotheliframe + mov combatcount,0 + mov ax,9 + +gotheliframe: mov [es:bx+3],ax +helispeed: call showgamereel + mov al,mapx + mov [es:bx+1],al +helicombatend: mov ax,[es:bx+3] + cmp ax,9 ;8 + jnc notwaitingheli + cmp combatcount,7 + jc notwaitingheli + mov pointermode,2 + mov watchingtime,0 + ret +notwaitingheli: mov pointermode,0 + mov watchingtime,2 + ret + +heliwon: mov pointermode,0 + ret + + endp + + +Mugger proc near + + mov ax,[es:bx+3] + cmp ax,138 + jz endmugger1 + cmp ax,176 + jz endmugger2 + cmp ax,2 + jnz havesetwatch + mov watchingtime,175*2 +havesetwatch: call checkspeed + jnz notmugger + inc word ptr [es:bx+3] +notmugger: call showgamereel + mov al,mapx + mov [es:bx+1],al + ret + +endmugger1: push es bx + call createpanel2 + call showicon + mov al,41 + call findpuztext + mov di,33+20 + mov bx,104 + mov dl,241 + mov ah,0 + call printdirect + call worktoscreen + mov cx,300 + call hangon + pop bx es + push es bx + mov word ptr [es:bx+3],140 + mov manspath,2 + mov finaldest,2 + call findxyfrompath + mov resetmanxy,1 + mov al,"W" + mov ah,"E" + mov cl,"T" + mov ch,"A" + call findexobject + mov command,al + mov objecttype,4 + call removeobfrominv + mov al,"W" + mov ah,"E" + mov cl,"T" + mov ch,"B" + call findexobject + mov command,al + mov objecttype,4 + call removeobfrominv + call makemainscreen + mov al,48 + mov bl,68-32 + mov bh,54+64 + mov cx,70 ; time on screen + mov dx,10 ; pause before show + call setuptimeduse + mov beenmugged,1 + pop bx es + ret + +endmugger2: ret + + + endp + + + + + + + + +Aide proc near + + call showgamereel + call addtopeoplelist + ret + + endp + + + + + + +Businessman proc near + + mov pointermode,0 + mov watchingtime,2 + mov ax,[es:bx+3] + cmp ax,2 + jnz notfirstbiz + push ax bx es + mov al,49 + mov cx,30 + mov dx,1 + mov bl,68 + mov bh,174 + call setuptimeduse + pop es bx ax + +notfirstbiz: cmp ax,95 + jz buscombatwonend + cmp ax,49 + jz buscombatend + + call checkspeed + jnz busspeed + + mov ax,[es:bx+3] + inc ax + cmp ax,48 + jnz notbeforedeadb + mov mandead,2 + jmp gotbusframe + +notbeforedeadb: cmp ax,15 + jnz buscombatwon + dec ax + cmp lastweapon,3 + jnz notshieldonbus + mov lastweapon,-1 + mov combatcount,0 + mov ax,51 + jmp gotbusframe +notshieldonbus: inc combatcount + cmp combatcount,20 + jnz gotbusframe + mov combatcount,0 + mov ax,15 + jmp gotbusframe + +buscombatwon: cmp ax,91 + jnz gotbusframe + push bx es + mov al,0 + call turnpathon + mov al,1 + call turnpathon + mov al,2 + call turnpathon + mov al,3 + call turnpathoff + mov manspath,5 + mov finaldest,5 + call findxyfrompath + mov resetmanxy,1 + pop es bx + mov ax,92 + jmp gotbusframe + +gotbusframe: mov [es:bx+3],ax +busspeed: call showgamereel + mov al,mapy + mov [es:bx+2],al + mov ax,[es:bx+3] + cmp ax,14 + jnz buscombatend + mov watchingtime,0 + mov pointermode,2 + ret + +buscombatend: ret + +buscombatwonend: mov pointermode,0 + mov watchingtime,0 + ret + + endp + + + + + + +Poolguard proc near + + mov ax,[es:bx+3] + cmp ax,214 + jz combatover2 + cmp ax,258 + jz combatover2 + cmp ax,185 + jz combatover1 + cmp ax,0 + jnz notfirstpool + mov al,0 + call turnpathon +notfirstpool: call checkspeed + jnz guardspeed + + mov ax,[es:bx+3] + inc ax + cmp ax,122 + jnz notendguard1 + dec ax + cmp lastweapon,2 + jnz notaxeonpool + mov lastweapon,-1 + mov ax,122 + jmp gotguardframe +notaxeonpool: inc combatcount + cmp combatcount,40 + jnz gotguardframe + mov combatcount,0 + mov ax,195 + jmp gotguardframe + +notendguard1: cmp ax,147 + jnz gotguardframe + dec ax + cmp lastweapon,1 + jnz notgunonpool + mov lastweapon,-1 + mov ax,147 + jmp gotguardframe +notgunonpool: inc combatcount + cmp combatcount,40 + jnz gotguardframe + mov combatcount,0 + mov ax,220 + +gotguardframe: mov [es:bx+3],ax +guardspeed: call showgamereel + mov ax,[es:bx+3] + cmp ax,121 + jz iswaitingpool + cmp ax,146 + jz iswaitingpool + mov pointermode,0 + mov watchingtime,2 + ret +iswaitingpool: mov pointermode,2 + mov watchingtime,0 + ret + +combatover1: mov watchingtime,0 + mov pointermode,0 + mov al,0 + call turnpathon + mov al,1 + call turnpathoff + ret + +combatover2: call showgamereel + mov watchingtime,2 + mov pointermode,0 + inc combatcount + cmp combatcount,100 + jc doneover2 + mov watchingtime,0 + mov mandead,2 +doneover2: ret + + endp + + + + + + + + + + +Security proc near + + cmp word ptr [es:bx+3],32 + jz securwait + cmp word ptr [es:bx+3],69 + jnz notaftersec + ret +notaftersec: mov watchingtime,10 + call checkspeed + jnz gotsecurframe + inc word ptr [es:bx+3] + jmp gotsecurframe +securwait: cmp lastweapon,1 + jnz gotsecurframe + mov watchingtime,10 + cmp manspath,9 + jnz gotsecurframe + cmp facing,0 + jnz gotsecurframe + mov lastweapon,-1 + inc word ptr [es:bx+3] +gotsecurframe: call showgamereel + call addtopeoplelist + ret + + endp + + + + + + +Heavy proc near + + mov al,[es:bx+7] + and al,127 + mov [es:bx+7],al + cmp word ptr [es:bx+3],43 + jz heavywait + mov watchingtime,10 + cmp word ptr [es:bx+3],70 + jnz notafterhshot + inc combatcount + cmp combatcount,80 + jnz gotheavyframe + mov mandead,2 + jmp gotheavyframe +notafterhshot: call checkspeed + jnz gotheavyframe + inc word ptr [es:bx+3] + jmp gotheavyframe +heavywait: cmp lastweapon,1 + jnz gotheavyframe + cmp manspath,5 + jnz gotheavyframe + cmp facing,4 + jnz gotheavyframe + mov lastweapon,-1 + inc word ptr [es:bx+3] + mov combatcount,0 +gotheavyframe: call showgamereel + call addtopeoplelist + ret + + endp + + + + +Bossman proc near + + call checkspeed + jnz notboss + mov ax,[es:bx+3] + inc ax + cmp ax,4 + jz firstdes + cmp ax,20 + jz secdes + cmp ax,41 + jnz gotallboss + mov ax,0 + inc gunpassflag + mov byte ptr [es:bx+7],10 + jmp gotallboss +firstdes: cmp gunpassflag,1 + jz gotallboss + push ax + call randomnumber + mov cl,al + pop ax + cmp cl,10 + jc gotallboss + mov ax,0 + jmp gotallboss +secdes: cmp gunpassflag,1 + jz gotallboss + mov ax,0 +gotallboss: mov [es:bx+3],ax +notboss: call showgamereel + call addtopeoplelist + + mov al,[es:bx+7] + and al,128 + jz nottalkedboss + mov talkedtoboss,1 +nottalkedboss: ret + + endp + + + + + +Gamer proc near + + call checkspeed + jnz gamerfin +gameragain: call randomnum1 + and al,7 + cmp al,5 + jnc gameragain + add al,20 + cmp al,[es:bx+3] + jz gameragain + mov ah,0 + mov [es:bx+3],ax +gamerfin: call showgamereel + call addtopeoplelist + ret + + endp + + + + + +Sparkydrip proc near + + call checkspeed + jnz cantdrip + mov al,14 + mov ah,0 + call playchannel0 +cantdrip: ret + + endp + + + +Carparkdrip proc near + + call checkspeed + jnz cantdrip2 + mov al,14 + call playchannel1 +cantdrip2: ret + + endp + + + +Keeper proc near + + cmp keeperflag,0 + jnz notwaiting + cmp reeltowatch,190 + jc waiting + inc keeperflag + mov ah,[es:bx+7] + and ah,127 + cmp ah,dreamnumber + jz notdiff + mov al,dreamnumber + mov [es:bx+7],al +notdiff: ret +notwaiting: call addtopeoplelist + call showgamereel +waiting: ret + + endp + + + +Candles1 proc near + + call checkspeed + jnz candle1 + mov ax,[es:bx+3] + inc ax + cmp ax,44 + jnz notendcandle1 + mov ax,39 +notendcandle1: mov [es:bx+3],ax +candle1: call showgamereel + ret + + endp + + + +Smallcandle proc near + + call checkspeed + jnz smallcandlef + mov ax,[es:bx+3] + inc ax + cmp ax,37 + jnz notendsmallcandle + mov ax,25 +notendsmallcandle: mov [es:bx+3],ax +smallcandlef: call showgamereel + ret + + endp + + + + + + + + + + + +Intromagic1 proc near + + call checkspeed + jnz introm1fin + mov ax,[es:bx+3] + inc ax + cmp ax,145 + jnz gotintrom1 + mov ax,121 +gotintrom1: mov [es:bx+3],ax + cmp ax,121 + jnz introm1fin + inc introcount + push es bx + call intro1text + pop bx es + cmp introcount,8 ; was 7 + jnz introm1fin + add mapy,10 + mov nowinnewroom,1 +introm1fin: call showgamereel + ret + + endp + + + + +Candles proc near + + call checkspeed + jnz candlesfin + mov ax,[es:bx+3] + inc ax + cmp ax,167 + jnz gotcandles + mov ax,162 +gotcandles: mov [es:bx+3],ax +candlesfin: call showgamereel + ret + + endp + + + +Candles2 proc near + + call checkspeed + jnz candles2fin + mov ax,[es:bx+3] + inc ax + cmp ax,238 + jnz gotcandles2 + mov ax,233 +gotcandles2: mov [es:bx+3],ax +candles2fin: call showgamereel + ret + + endp + + + +Gates proc near + + call checkspeed + jnz gatesfin + mov ax,[es:bx+3] + inc ax + cmp ax,116 + jnz notbang + push ax bx es + mov al,17 ;12 + call playchannel1 + pop es bx ax +notbang: cmp ax,110 + jc slowgates + mov byte ptr [es:bx+5],2 +slowgates: cmp ax,120 + jnz gotgates + mov getback,1 + mov ax,119 +gotgates: mov [es:bx+3],ax + push es bx + call intro3text + pop bx es +gatesfin: call showgamereel + ret + + endp + + + + +Intromagic2 proc near + + call checkspeed + jnz introm2fin + mov ax,[es:bx+3] + inc ax + cmp ax,216 + jnz gotintrom2 + mov ax,192 +gotintrom2: mov [es:bx+3],ax +introm2fin: call showgamereel + ret + + endp + + + + +Intromagic3 proc near + + call checkspeed + jnz introm3fin + mov ax,[es:bx+3] + inc ax + cmp ax,218 + jnz gotintrom3 + mov getback,1 +gotintrom3: mov [es:bx+3],ax +introm3fin: call showgamereel + mov al,mapx + mov [es:bx+1],al + ret + + endp + + + + + + + +Intromonks1 proc near + + call checkspeed + jnz intromonk1fin + mov ax,[es:bx+3] + inc ax + cmp ax,80 + jnz notendmonk1 + add mapy,10 + mov nowinnewroom,1 + call showgamereel + ret +notendmonk1: cmp ax,30 + jnz gotintromonk1 + sub mapy,10 + mov nowinnewroom,1 + mov ax,51 +gotintromonk1: mov [es:bx+3],ax + cmp ax,5 + jz waitstep + cmp ax,15 + jz waitstep + cmp ax,25 + jz waitstep + cmp ax,61 + jz waitstep + cmp ax,71 + jz waitstep + jmp intromonk1fin +waitstep: push es bx + call intro2text + pop bx es + mov byte ptr [es:bx+6],-20 +intromonk1fin: call showgamereel + mov al,mapy + mov [es:bx+2],al + ret + + endp + + + + +Intromonks2 proc near + + call checkspeed + jnz intromonk2fin + mov ax,[es:bx+3] + inc ax + cmp ax,87 + jnz nottalk1 + inc introcount + push es bx + call monks2text + pop bx es + cmp introcount,19 + jnz notlasttalk1 + mov ax,87 + jmp gotintromonk2 +notlasttalk1: mov ax,74 + jmp gotintromonk2 + +nottalk1: cmp ax,110 + jnz notraisearm + inc introcount + push es bx + call monks2text + pop bx es + if cd + if german + cmp introcount,42 + else + cmp introcount,35 + endif + else + cmp introcount,35 + endif + jnz notlastraise + mov ax,111 + jmp gotintromonk2 +notlastraise: mov ax,98 + jmp gotintromonk2 + +notraisearm: cmp ax,176 + jnz notendmonk2 + mov getback,1 + jmp gotintromonk2 +notendmonk2: cmp ax,125 + jnz gotintromonk2 + mov ax,140 +gotintromonk2: mov [es:bx+3],ax +intromonk2fin: call showgamereel + ret + + endp + + + + + +Handclap proc near + + ret + + endp + + + + + if german + if cd + +Monks2text proc near + + cmp introcount,1 + jnz notmonk2text1 + mov al,8 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text1: cmp introcount,5 + jnz notmonk2text2 + mov al,9 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text2: cmp introcount,9 + jnz notmonk2text3 + mov al,10 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text3: cmp introcount,13 + jnz notmonk2text4 + mov introcount,14 + mov al,11 + mov bl,0 + mov bh,105 + mov cx,100 + jmp gotmonks2text +notmonk2text4: cmp introcount,19 + jnz notmonk2text7 + mov al,14 + mov bl,36 + mov bh,160 + mov cx,100 ;32 + mov dx,1 + mov ah,82 + jmp setuptimedtemp +notmonk2text7: cmp introcount,23 + jnz notmonk2text8 + mov al,15 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text8: cmp introcount,27 + jnz notmonk2text9 + mov al,16 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text9: cmp introcount,30 + jnz notmonk2text10 + mov al,17 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text10: cmp introcount,35 + jnz notmonk2text11 + mov al,18 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text11: ret + +gotmonks2text: mov dx,1 + mov cx,120 + mov ah,82 + call setuptimedtemp + ret + + endp + + else + +Monks2text proc near + + cmp introcount,1 + jnz notmonk2text1 + mov al,8 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text1: cmp introcount,4 + jnz notmonk2text2 + mov al,9 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text2: cmp introcount,7 + jnz notmonk2text3 + mov al,10 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text3: cmp introcount,10 + jnz notmonk2text4 + if cd + mov introcount,12 + endif + mov al,11 + mov bl,0 + mov bh,105 + mov cx,100 + jmp gotmonks2text +notmonk2text4: cmp introcount,13 + jnz notmonk2text5 + if cd + mov introcount,17; 18 + ret + endif + mov al,12 + mov bl,0 + mov bh,120 + mov cx,100 + jmp gotmonks2text +notmonk2text5: cmp introcount,16 + jnz notmonk2text6 + mov al,13 + mov bl,0 + mov bh,135 + mov cx,100 + jmp gotmonks2text +notmonk2text6: cmp introcount,19 + jnz notmonk2text7 + mov al,14 + mov bl,36 + mov bh,160 + mov cx,100 ;32 + mov dx,1 + mov ah,82 + jmp setuptimedtemp +notmonk2text7: cmp introcount,22 + jnz notmonk2text8 + mov al,15 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text8: cmp introcount,25 + jnz notmonk2text9 + mov al,16 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text9: if cd + cmp introcount,27 + else + cmp introcount,28 + endif + jnz notmonk2text10 + mov al,17 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text10: cmp introcount,31 + jnz notmonk2text11 + mov al,18 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text11: ret + +gotmonks2text: mov dx,1 + mov cx,120 + mov ah,82 + call setuptimedtemp + ret + + endp + + + endif + else + +Monks2text proc near + + cmp introcount,1 + jnz notmonk2text1 + mov al,8 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text1: cmp introcount,4 + jnz notmonk2text2 + mov al,9 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text2: cmp introcount,7 + jnz notmonk2text3 + mov al,10 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text3: cmp introcount,10 + jnz notmonk2text4 + if cd + mov introcount,12 + endif + mov al,11 + mov bl,0 + mov bh,105 + mov cx,100 + jmp gotmonks2text +notmonk2text4: cmp introcount,13 + jnz notmonk2text5 + if cd + mov introcount,17; 18 + ret + endif + mov al,12 + mov bl,0 + mov bh,120 + mov cx,100 + jmp gotmonks2text +notmonk2text5: cmp introcount,16 + jnz notmonk2text6 + mov al,13 + mov bl,0 + mov bh,135 + mov cx,100 + jmp gotmonks2text +notmonk2text6: cmp introcount,19 + jnz notmonk2text7 + mov al,14 + mov bl,36 + mov bh,160 + mov cx,100 ;32 + mov dx,1 + mov ah,82 + jmp setuptimedtemp +notmonk2text7: cmp introcount,22 + jnz notmonk2text8 + mov al,15 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text8: cmp introcount,25 + jnz notmonk2text9 + mov al,16 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text9: if cd + cmp introcount,27 + else + cmp introcount,28 + endif + jnz notmonk2text10 + mov al,17 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text10: cmp introcount,31 + jnz notmonk2text11 + mov al,18 + mov bl,36 + mov bh,160 + mov cx,100 + jmp gotmonks2text +notmonk2text11: ret + +gotmonks2text: mov dx,1 + mov cx,120 + mov ah,82 + call setuptimedtemp + ret + + endp + + endif + + + + + + +Intro1text proc near + + cmp introcount,2 + jnz notintro1text1 + mov al,40 + mov bl,34 + mov bh,130 + mov cx,90 + jmp gotintro1text +notintro1text1: cmp introcount,4 + jnz notintro1text2 + mov al,41 + mov bl,34 + mov bh,130 + mov cx,90 + jmp gotintro1text +notintro1text2: cmp introcount,6 + jnz notintro1text3 + mov al,42 + mov bl,34 + mov bh,130 + mov cx,90 + jmp gotintro1text +notintro1text3: ret + +gotintro1text: mov dx,1 + mov ah,82 + if cd + cmp ch1playing,255 + jz oktalk2 + dec introcount + ret + endif +oktalk2: call setuptimedtemp + ret + + endp + + + +Intro2text proc near + + cmp ax,5 + jnz notintro2text1 + mov al,43 + mov bl,34 + mov bh,40 + mov cx,90 + jmp gotintro2text +notintro2text1: cmp ax,15 + jnz notintro2text2 + mov al,44 + mov bl,34 + mov bh,40 + mov cx,90 + jmp gotintro2text +notintro2text2: ret + +gotintro2text: mov dx,1 + mov ah,82 + call setuptimedtemp + ret + + endp + + + + + + +Intro3text proc near + + cmp ax,107 + jnz notintro3text1 + mov al,45 + mov bl,36 + mov bh,56 + mov cx,100 + jmp gotintro3text +notintro3text1: if cd + cmp ax,108 + else + cmp ax,109 + endif + jnz notintro3text2 + mov al,46 + mov bl,36 + mov bh,56 + mov cx,100 + jmp gotintro3text +notintro3text2: ret + +gotintro3text: mov dx,1 + mov ah,82 + call setuptimedtemp + ret + + endp + + + + + + + +Monkandryan proc near + + call checkspeed + jnz notmonkryan + mov ax,[es:bx+3] + inc ax + cmp ax,83 + jnz gotmonkryan + inc introcount + push es bx + call textformonk + pop bx es + mov ax,77 + cmp introcount,57 + jnz gotmonkryan + mov getback,1 + ret +gotmonkryan: mov [es:bx+3],ax +notmonkryan: call showgamereel + ret + + endp + + + + + +Endgameseq proc near + + call checkspeed + jnz notendseq + mov ax,[es:bx+3] + inc ax + cmp ax,51 + jnz gotendseq + cmp introcount,140 + jz gotendseq + inc introcount + push es bx + call textforend + pop bx es + mov ax,50 +gotendseq: mov [es:bx+3],ax + cmp ax,134 + jnz notfadedown + push es bx ax + call fadescreendownhalf + pop ax bx es + jmp notendseq +notfadedown: cmp ax,324 + jnz notfadeend + push es bx ax + call fadescreendowns + mov volumeto,7 + mov volumedirection,1 + pop ax bx es +notfadeend: cmp ax,340 + jnz notendseq + mov getback,1 +notendseq: call showgamereel + mov al,mapy + mov [es:bx+2],al + mov ax,[es:bx+3] + cmp ax,145 + jnz notendcreds + mov word ptr [es:bx+3],146 + call rollendcredits +notendcreds: ret + + endp + + + + + + +Rollendcredits proc near + + mov al,16 + mov ah,255 + call playchannel0 + mov volume,7 + mov volumeto,0 + mov volumedirection,-1 + + mov cl,160 + mov ch,160 + mov di,75 + mov bx,20 + mov ds,mapstore + mov si,0 + call multiget + + mov es,textfile1 + mov si,3*2 + mov ax,[es:si] + mov si,ax + add si,textstart + + mov cx,254 +endcredits1: push cx + + mov bx,10 + mov cx,linespacing +endcredits2: push cx si di es bx + + call vsync + mov cl,160 + mov ch,160 + mov di,75 + mov bx,20 + mov ds,mapstore + mov si,0 + call multiput + call vsync + pop bx es di si + push si di es bx + + mov cx,18 +onelot: push cx + mov di,75 + mov dx,161 + mov ax,0 + call printdirect + add bx,linespacing + pop cx + loop onelot + + call vsync + mov cl,160 + mov ch,160 + mov di,75 + mov bx,20 + call multidump + + pop bx es di si cx + dec bx + loop endcredits2 + pop cx +looknext: mov al,[es:si] + inc si + cmp al,":" + jz gotnext + cmp al,0 + jz gotnext + jmp looknext +gotnext: loop endcredits1 + + mov cx,100 + call hangon + call paneltomap + call fadescreenuphalf + ret + + endp + + + + + + +Priest proc near + + cmp word ptr [es:bx+3],8 + jz priestspoken + mov pointermode,0 + mov watchingtime,2 + call checkspeed + jnz priestwait + inc word ptr [es:bx+3] + push es bx + call priesttext + pop bx es +priestwait: ret + +priestspoken: ret + + endp + + + + + + +Madmanstelly proc near + + mov ax,[es:bx+3] + inc ax + cmp ax,307 + jnz notendtelly + mov ax,300 +notendtelly: mov [es:bx+3],ax + call showgamereel + ret + + endp + + + + + +Madman proc near + + mov watchingtime,2 + call checkspeed + jnz nomadspeed + mov ax,[es:bx+3] + cmp ax,364 + jnc ryansded + cmp ax,10 + jnz notfirstmad + push es bx ax + mov dx,offset cs:introtextname + call loadtemptext + pop ax bx es + mov combatcount,-1 + mov speechcount,0 +notfirstmad: inc ax + cmp ax,294 + jz madmanspoken + cmp ax,66 + jnz nomadspeak + inc combatcount + push es bx + call madmantext + pop bx es + mov ax,53 + if cd + cmp combatcount,64 + else + cmp combatcount,62 + endif + jc nomadspeak + if cd + cmp combatcount,70 + else + cmp combatcount,68 + endif + jz killryan + cmp lastweapon,8 + jnz nomadspeak + if cd + mov combatcount,72 + else + mov combatcount,70 + endif + mov lastweapon,-1 + mov madmanflag,1 + mov ax,67 + jmp nomadspeak +killryan: mov ax,310 +nomadspeak: mov [es:bx+3],ax +nomadspeed: call showgamereel + mov al,mapx + mov [es:bx+1],al + call madmode + ret +madmanspoken: cmp wongame,1 + jz alreadywon + mov wongame,1 + push es bx + call getridoftemptext + pop bx es +alreadywon: ret + +ryansded: mov mandead,2 + call showgamereel + ret + + endp + + + + + + + + + + if cd +Madmantext proc near + + cmp speechcount,63 + jnc nomadtext + cmp ch1playing,255 + jnz nomadtext + + mov al,speechcount + inc speechcount + add al,47 + mov bl,72 + mov bh,80 + mov cx,90 + mov dx,1 + mov ah,82 + call setuptimedtemp +nomadtext: ret + + endp + + else + +Madmantext proc near + + cmp combatcount,61 + jnc nomadtext + mov al,combatcount + and al,3 + jnz nomadtext + mov al,combatcount + shr al,1 + shr al,1 + add al,47 + mov bl,72 + mov bh,80 + mov cx,90 + mov dx,1 + mov ah,82 + call setuptimedtemp +nomadtext: ret + + endp + endif + + + + +Madmode proc near + + mov watchingtime,2 + mov pointermode,0 + if cd + cmp combatcount,65 + else + cmp combatcount,63 + endif + jc iswatchmad + if cd + cmp combatcount,70 + else + cmp combatcount,68 + endif + jnc iswatchmad + mov pointermode,2 +iswatchmad: ret + + endp + + + + + +Priesttext proc near + + cmp word ptr [es:bx+3],2 + jc nopriesttext + cmp word ptr [es:bx+3],7 + jnc nopriesttext + mov al,[es:bx+3] + and al,1 + jnz nopriesttext + mov al,[es:bx+3] + shr al,1 + add al,50 + mov bl,72 + mov bh,80 + mov cx,54 + mov dx,1 + call setuptimeduse +nopriesttext: ret + + endp + + + + +Textforend proc near + + cmp introcount,20 + jnz notendtext1 + mov al,0 + mov bl,34 + mov bh,20 + mov cx,60 + jmp gotendtext +notendtext1: if cd + cmp introcount,50 + else + cmp introcount,65 + endif + jnz notendtext2 + mov al,1 + mov bl,34 + mov bh,20 + mov cx,60 + jmp gotendtext +notendtext2: if cd + cmp introcount,85 + else + cmp introcount,110 + endif + jnz notendtext3 + mov al,2 + mov bl,34 + mov bh,20 + mov cx,60 + jmp gotendtext +notendtext3: ret + +gotendtext: mov dx,1 + mov ah,83 + call setuptimedtemp + ret + + endp + + + + + + + + +Textformonk proc near + + cmp introcount,1 + jnz notmonktext1 + mov al,19 + mov bl,68 + mov bh,154 + mov cx,120 + jmp gotmonktext +notmonktext1: cmp introcount,5 + jnz notmonktext2 + mov al,20 + mov bl,68 + mov bh,38 + mov cx,120 + jmp gotmonktext +notmonktext2: cmp introcount,9 + jnz notmonktext3 + mov al,21 + mov bl,48 + mov bh,154 + mov cx,120 + jmp gotmonktext +notmonktext3: cmp introcount,13 + jnz notmonktext4 + mov al,22 + mov bl,68 + mov bh,38 + mov cx,120 + jmp gotmonktext +notmonktext4: if cd + cmp introcount,15 + else + cmp introcount,17 + endif + jnz notmonktext5 + mov al,23 + mov bl,68 + mov bh,154 + mov cx,120 + jmp gotmonktext +notmonktext5: cmp introcount,21 + jnz notmonktext6 + mov al,24 + mov bl,68 + mov bh,38 + mov cx,120 + jmp gotmonktext +notmonktext6: cmp introcount,25 + jnz notmonktext7 + mov al,25 + mov bl,68 + mov bh,154 + mov cx,120 + jmp gotmonktext +notmonktext7: cmp introcount,29 + jnz notmonktext8 + mov al,26 + mov bl,68 + mov bh,38 + mov cx,120 + jmp gotmonktext +notmonktext8: cmp introcount,33 + jnz notmonktext9 + mov al,27 + mov bl,68 + mov bh,154 + mov cx,120 + jmp gotmonktext +notmonktext9: cmp introcount,37 + jnz notmonktext10 + mov al,28 + mov bl,68 + mov bh,154 + mov cx,120 + jmp gotmonktext +notmonktext10: cmp introcount,41 + jnz notmonktext11 + mov al,29 + mov bl,68 + mov bh,38 + mov cx,120 + jmp gotmonktext +notmonktext11: cmp introcount,45 + jnz notmonktext12 + mov al,30 + mov bl,68 + mov bh,154 + mov cx,120 + jmp gotmonktext +notmonktext12: if cd + cmp introcount,52 + else + cmp introcount,49 + endif + jnz notmonktext13 + mov al,31 + mov bl,68 + mov bh,154 + mov cx,220 ;132 + jmp gotmonktext +notmonktext13: cmp introcount,53 + jnz notendtitles + call fadescreendowns + if cd + mov volumeto,7 + mov volumedirection,1 + endif +notendtitles: ret + +gotmonktext: mov dx,1 + mov ah,82 + if cd + cmp ch1playing,255 + jz oktalk + dec introcount + ret + endif +oktalk: call setuptimedtemp + ret + + endp + + + + + + + + + + +Drunk proc near + + cmp generaldead,0 + jnz trampgone + mov al,[es:bx+7] + and al,127 + mov [es:bx+7],al + call showgamereel + call addtopeoplelist +trampgone: ret + + endp + + +Advisor proc near + + call checkspeed + jnz noadvisor + jmp noadvisor + mov ax,[es:bx+3] + inc ax + cmp ax,123 + jnz notendadvis + mov ax,106 + jmp gotadvframe +notendadvis: cmp ax,108 + jnz gotadvframe + push ax + call randomnumber + mov cl,al + pop ax + cmp cl,3 + jc gotadvframe + mov ax,106 +gotadvframe: mov [es:bx+3],ax +noadvisor: call showgamereel + call addtopeoplelist + ret + + endp + + + +Copper proc near + + call checkspeed + jnz nocopper + mov ax,[es:bx+3] + inc ax + cmp ax,94 + jnz notendcopper + mov ax,64 + jmp gotcopframe +notendcopper: cmp ax,81 + jz mightwait + cmp ax,66 + jnz gotcopframe +mightwait: push ax + call randomnumber + mov cl,al + pop ax + cmp cl,7 + jc gotcopframe + dec ax +gotcopframe: mov [es:bx+3],ax +nocopper: call showgamereel + call addtopeoplelist + ret + + endp + + + + + + + + + + +Sparky proc near + + cmp card1money,0 + jz animsparky + mov byte ptr [es:bx+7],3 + jmp animsparky + +animsparky: call checkspeed + jnz finishsparky + cmp word ptr [es:bx+3],34 + jnz notsparky1 + call randomnumber + cmp al,30 + jc dosparky + mov word ptr [es:bx+3],27 + jmp finishsparky + +notsparky1: cmp word ptr [es:bx+3],48 + jnz dosparky + mov word ptr [es:bx+3],27 + jmp finishsparky + +dosparky: inc word ptr [es:bx+3] +finishsparky: call showgamereel + call addtopeoplelist + + mov al,[es:bx+7] + and al,128 + jz nottalkedsparky + mov talkedtosparky,1 +nottalkedsparky: ret + + endp + + + + + +Train proc near + + ret + mov ax,[es:bx+3] + cmp ax,21 + jnc notrainyet + inc ax + jmp gottrainframe +notrainyet: call randomnumber + cmp al,253 + jc notrainatall + cmp manspath,5 + jnz notrainatall + cmp finaldest,5 + jnz notrainatall + mov ax,5 +gottrainframe: mov [es:bx+3],ax + call showgamereel +notrainatall: ret + + endp + + + + + + + +Addtopeoplelist proc near + + push es bx bx + mov cl,[es:bx+7] + mov ax,[es:bx+3] + mov bx,listpos + mov es,buffers + mov [es:bx],ax ;reel pointer position + pop ax + mov [es:bx+2],ax + mov [es:bx+4],cl ;coversation number + pop bx es + add listpos,5 + ret + + endp + + + +Showgamereel proc near + + mov ax,[es:bx+3] + cmp ax,512 + jnc noshow + mov reelpointer,ax + push es bx + call plotreel + pop bx es + mov ax,reelpointer + mov [es:bx+3],ax +noshow: ret + + endp + + + + + + +Checkspeed proc near + + cmp lastweapon,-1 + jnz forcenext + inc byte ptr [es:bx+6] + mov al,[es:bx+6] + cmp al,[es:bx+5] + jnz notspeed + mov al,0 + mov [es:bx+6],al + cmp al,al +notspeed: ret + +forcenext: cmp al,al + ret + + endp + + + + + + + + + + +;------------------------------------------------------------Sprite Routines---- + + + +Clearsprites proc near + + mov es,buffers + mov di,spritetable + mov al,255 + mov cx,tablesize*16 + rep stosb + ret + + endp + + + + +Makesprite proc near ;si holds x,y cx holds update + ;di,dx holds data offset,seg + mov es,buffers + mov bx,spritetable +$17: cmp byte ptr [es:bx+15],255 + jz $17a + add bx,tablesize + jmp $17 + +$17a: mov [es:bx],cx + mov [es:bx+10],si + mov [es:bx+6],dx + mov [es:bx+8],di + mov [es:bx+2],0ffffh + mov byte ptr [es:bx+15],0 + mov byte ptr [es:bx+18],0 + ret + + endp + + + + + + + + + + +Delsprite proc near + + mov di,bx + mov cx,tablesize + mov al,255 + rep stosb + ret + + endp + + + + + + + + + + +Spriteupdate proc near + + mov es,buffers + mov bx,spritetable + mov al,ryanon + mov byte ptr [es:bx+31],al + + mov es,buffers + mov bx,spritetable + mov cx,16 +$18: push cx bx + mov ax,[es:bx] + cmp ax,0ffffh + jz $18a + push es ds + mov cx,[es:bx+2] + mov [es:bx+24],cx + call ax + pop ds es +$18a: pop bx cx + cmp nowinnewroom,1 + jz $18b + add bx,tablesize + loop $18 + +$18b: ret + + endp + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Printsprites proc near + + mov es,buffers + mov cx,0 +priorityloop: push cx + mov priority,cl + mov bx,spritetable + mov cx,16 +prtspriteloop: push cx bx + mov ax,[es:bx] + cmp ax,0ffffh + jz skipsprite + mov al,priority + cmp al,[es:bx+23] + jnz skipsprite + cmp byte ptr [es:bx+31],1 + jz skipsprite + call printasprite +skipsprite: pop bx cx + add bx,tablesize + loop prtspriteloop + pop cx + inc cx + cmp cx,7 + jnz priorityloop + ret + + endp + + + + + + + + + + +Printasprite proc near + + push es bx + mov si,bx + mov ds,[es:si+6] + mov al,[es:si+11] + mov ah,0 + cmp al,220 + jc notnegative1 + mov ah,255 +notnegative1: mov bx,ax + add bx,mapady + mov al,[es:si+10] + mov ah,0 + cmp al,220 + jc notnegative2 + mov ah,255 +notnegative2: mov di,ax + add di,mapadx + mov al,[es:si+15] + mov ah,0 + cmp byte ptr [es:si+30],0 + jz steadyframe + mov ah,8 +steadyframe: cmp priority,6 + jnz notquickp +notquickp: call showframe + pop bx es + ret + + endp + + + + +;cmp priority,6 +; ;jz quicksprite ; WIll NEED TO DO THIS LATER!!!!! +;Quicksprite: mov cl,al +; mov ch,0 +; mov dx,[es:bx+6] +; mov es,workspace +; mov ds,dx +; mov bx,ax +; mov dx,vgawidth +; +;printquickloop: push di si +; +; push si +; add si,cx +; dec si +; jmp startzero +;zeroloop: dec si +; dec cl +;startzero: cmp [si],ch +; jz zeroloop +; pop si +; +;;printquickline: cmp [si],ch +; jnz foundfirstpix +; inc si +; inc di +; dec cl +; jnz printquickline +; +;foundfirstpix: cmp cl,0 +; jz finquickspr +; rep movsb +; +;finquickspr: pop si di +; mov cl,bl +; add si,cx +; add di,dx +; dec bh +; jnz printquickloop +; +; pop bx ds es +; ret + + + + + + + +;Calcframe proc near +; +; ret +; +; mov al,[es:bx+15] +; mov ah,0 +; mov cx,6 +; mul cx +; add ax,[es:bx+8] +; +; mov dx,[es:bx+6] +; push bx +; mov ds,dx +; mov bx,ax +; mov ax,[bx] +; mov cx,[bx+2] +; mov dx,[bx+4] +; pop bx +; mov [es:bx+2],ax +; add cx,[es:bx+8] +; add cx,2080 +; mov [es:bx+4],cx ;calculates frame data +; +; mov al,[es:bx+10] ;this bit calculates the actual +; add al,dl ;x and y (including any offset) +; mov [es:bx+12],al +; mov al,[es:bx+11] +; add al,dh +; mov [es:bx+13],al +; ret +; +; endp + + + + + + + + + + + + + + + + + + + + +Checkone proc near ;cx=x,y to check + + push cx + mov al,ch + mov ah,0 + mov cl,4 + shr ax,cl + mov dl,al + pop cx + mov al,cl + mov ah,0 + mov cl,4 + shr ax,cl + mov ah,dl ; al,ah holds x,y in blocks + + push ax + mov ch,0 + mov cl,al + push cx + mov al,ah + mov ah,0 + mov cx,11 + mul cx + pop cx + add ax,cx + + mov cx,3 + mul cx + mov si,ax + + mov ds,buffers + add si,mapflags + lodsw + mov cx,ax + lodsb + pop dx + ret + + + endp + + + + + + + + + + + + + + + + + + +Findsource proc near + + mov ax,currentframe + cmp ax,160 + jnc over1000 + mov ds,reel1 + mov takeoff,0 + ret +over1000: cmp ax,320 + jnc over1001 + mov ds,reel2 + mov takeoff,160 + ret +over1001: mov ds,reel3 + mov takeoff,320 + ret + + endp + + + + + + + + + + + +;---------------------------------------------------------Routines for Ryan---- + + +Initman proc near + + ;mov linepointer,254 + mov al,ryanx + mov ah,ryany + mov si,ax + mov cx,offset cs:mainman + mov dx,mainsprites + mov di,0 + call makesprite + mov byte ptr [es:bx+23],4 + mov byte ptr [es:bx+22],0 + mov byte ptr [es:bx+29],0 + ret + + endp + + + + + + + +Mainman proc near + + cmp resetmanxy,1 + jnz notinnewroom + mov resetmanxy,0 + mov al,ryanx + mov ah,ryany + mov [es:bx+10],ax + mov byte ptr [es:bx+29],0 + jmp executewalk +notinnewroom: dec byte ptr [es:bx+22] + cmp byte ptr [es:bx+22],-1 + jz executewalk + ret + + +executewalk: mov byte ptr [es:bx+22],0 ; speed + mov al,turntoface + cmp al,facing + jz facingok + call aboutturn + jmp notwalk + +facingok: cmp turndirection,0 + jz alreadyturned + cmp linepointer,254 + jnz alreadyturned + mov reasseschanges,1 + mov al,facing + cmp al,leavedirection + jnz alreadyturned + call checkforexit +alreadyturned: mov turndirection,0 + cmp linepointer,254 + jnz walkman + mov byte ptr [es:bx+29],0 + jmp notwalk + +walkman: mov al,[es:bx+29] + inc al + cmp al,11 + jnz notanimend1 + mov al,1 +notanimend1: mov [es:bx+29],al + + call walking + cmp linepointer,254 + jz afterwalk + + mov al,facing + and al,1 + jz isdouble + mov al,[es:bx+29] + cmp al,2 + jz afterwalk + cmp al,7 + jz afterwalk +isdouble: call walking +afterwalk: cmp linepointer,254 + jnz notwalk + mov al,turntoface + cmp al,facing + jnz notwalk + mov reasseschanges,1 + mov al,facing + cmp al,leavedirection + jnz notwalk + call checkforexit + +notwalk: mov al,facing + mov ah,0 + mov di,offset cs:facelist + add di,ax + mov al,[cs:di] + add al,[es:bx+29] + mov [es:bx+15],al + mov ax,[es:bx+10] + mov ryanx,al + mov ryany,ah + ret + +facelist: db 0,60,33,71,11,82,22,93 + + endp + + + + + + + + + + +Aboutturn proc near + + cmp turndirection,1 + jz incdir + cmp turndirection,-1 + jz decdir + mov al,facing + sub al,turntoface + jnc higher + neg al + cmp al,4 + jnc decdir + jmp incdir +higher: cmp al,4 + jnc incdir + jmp decdir + +incdir: mov turndirection,1 + mov al,facing + inc al + and al,7 + mov facing,al + mov byte ptr [es:bx+29],0 + ret + +decdir: mov turndirection,-1 + mov al,facing + dec al + and al,7 + mov facing,al + mov byte ptr [es:bx+29],0 + ret + + endp + + + + + + + + +Walking proc near + + cmp linedirection,0 + jz normalwalk + mov al,linepointer + dec al + mov linepointer,al + cmp al,200 + jnc endofline + jmp continuewalk + +normalwalk: mov al,linepointer + inc al + mov linepointer,al + cmp al,linelength + jnc endofline + +continuewalk: mov ah,0 + add ax,ax + push es bx + mov dx,seg linedata + mov es,dx + mov bx,offset es:linedata + add bx,ax + mov ax,[es:bx] + pop bx es +stillline: mov [es:bx+10],ax + ret + +endofline: mov linepointer,254 + mov al,destination + mov manspath,al + cmp al,finaldest + jz finishedwalk + mov al,finaldest + mov destination,al + push es bx + call autosetwalk + pop bx es + ret + +finishedwalk: call facerightway + ret + + endp + + + + + + + +Facerightway proc near + + push es bx ;Face object when finished + call getroomspaths ;walking + mov al,manspath + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + add bx,ax + mov al,[es:bx+7] + mov turntoface,al + mov leavedirection,al + pop bx es + ret + + endp + + + + + + + +Checkforexit proc near + + mov cl,ryanx ;look under feet to see if + add cl,12 ;any flags are there + mov ch,ryany + add ch,12 + call checkone + mov lastflag,cl + mov lastflagex,ch + mov flagx,dl + mov flagy,dh + mov al,lastflag + + test al,64 + jz notnewdirect + mov al,lastflagex + mov autolocation,al + ret + +notnewdirect: test al,32 + jz notleave + push es bx + cmp reallocation,2 + jnz notlouis + mov bl,0 + push bx + mov al,"W" + mov ah,"E" + mov cl,"T" + mov ch,"A" + call isryanholding + pop bx + jz noshoe1 + inc bl +noshoe1: push bx + mov al,"W" + mov ah,"E" + mov cl,"T" + mov ch,"B" + call isryanholding + pop bx + jz noshoe2 + inc bl +noshoe2: cmp bl,2 + jz notlouis + mov al,42 + cmp bl,0 + jz notravmessage + inc al +notravmessage: mov cx,80 + mov dx,10 + mov bl,68 + mov bh,64 + call setuptimeduse + mov al,facing + add al,4 + and al,7 + mov turntoface,al + pop bx es + ret + +notlouis: pop bx es + mov needtotravel,1 + ret + + + +notleave: test al,4 + jz notaleft + call adjustleft + ret + +notaleft: test al,2 + jz notaright + call adjustright + ret + +notaright: test al,8 + jz notadown + call adjustdown + ret + +notadown: test al,16 + jz notanup + call adjustup + ret + +notanup: ret + + endp + + + + + +Adjustdown proc near + + push es bx + add mapy,10 + mov al,lastflagex + mov cl,16 + mul cl + mov [es:bx+11],al + mov nowinnewroom,1 + pop bx es + ret + + endp + + + + +Adjustup proc near + + push es bx + sub mapy,10 + mov al,lastflagex + mov cl,16 + mul cl + mov [es:bx+11],al + mov nowinnewroom,1 + pop bx es + ret + + endp + + + + + +Adjustleft proc near + + push es bx + mov lastflag,0 + sub mapx,11 + mov al,lastflagex + mov cl,16 + mul cl + mov [es:bx+10],al + mov nowinnewroom,1 + pop bx es + ret + + endp + + + + + + +Adjustright proc near + + push es bx + add mapx,11 + mov al,lastflagex + mov cl,16 + mul cl + sub al,2 + mov [es:bx+10],al + mov nowinnewroom,1 + pop bx es + ret + + endp + + + + + +Reminders proc nar + + cmp reallocation,24 + jnz notinedenslift + cmp mapx,44 + jnz notinedenslift + cmp progresspoints,0 + jnz notfirst + mov al,"D" + mov ah,"K" + mov cl,"E" + mov ch,"Y" + call isryanholding + jz forgotone + mov al,"C" + mov ah,"S" + mov cl,"H" + mov ch,"R" + call findexobject + cmp al,numexobjects + jz forgotone + mov ax,[es:bx+2] + cmp al,4 + jnz forgotone ;card is in inventory + cmp ah,255 + jz havegotcard ;card must be in an ex + mov cl,"P" ;object + mov ch,"U" + mov dl,"R" + mov dh,"S" + xchg al,ah + call compare + jnz forgotone ;is it in wallet? +havegotcard: inc progresspoints +notfirst: ret + +forgotone: mov al,50 ;message number + mov bl,54 ;x pos of message + mov bh,70 ;and y pos + mov cx,48 ;time on screen + mov dx,8 ;pause before show + call setuptimeduse + ret +notinedenslift: ret + + endp + + + + + +;--------------------------------------------------------------------------- +; +; Sprite update routines for rain effect +; +;--------------------------------------------------------------------------- + + + + +Initrain proc near + + mov es,buffers + mov di,rainlist + mov bx,offset cs:rainlocations +checkmorerain: mov al,[cs:bx] + cmp al,255 + jz finishinitrain + cmp al,reallocation + jnz checkrain + mov al,[cs:bx+1] + cmp al,mapx + jnz checkrain + mov al,[cs:bx+2] + cmp al,mapy + jnz checkrain + mov al,[cs:bx+3] + mov rainspace,al + jmp dorain +checkrain: add bx,4 + jmp checkmorerain + +dorain: mov cx,4 +initraintop: call randomnumber + and al,31 + add al,3 + cmp al,rainspace + jnc initraintop + add cl,al + cmp cl,mapxsize + jnc initrainside + push cx + call splitintolines + pop cx + jmp initraintop + +initrainside: mov cl,mapxsize + dec cl +initrainside2: call randomnumber + and al,31 + add al,3 + cmp al,rainspace + jnc initrainside2 + add ch,al + cmp ch,mapysize + jnc finishinitrain + push cx + call splitintolines + pop cx + jmp initrainside2 +finishinitrain: mov al,255 + stosb + ret + +rainlocations: db 1,44,10,16 ;location,map x,y,seed + db 4,11,30,14 + db 4,22,30,14 + db 3,33,10,14 + db 10,33,30,14 + db 10,22,30,24 + db 9,22,10,14 + db 2,33,0,14 + db 2,22,0,14 + db 6,11,30,14 + db 7,11,20,18 + db 7,0,20,18 + db 7,0,30,18 + db 55,44,0,14 + db 5,22,30,14 + + db 8,0,10,18 + db 8,11,10,18 + db 8,22,10,18 + db 8,33,10,18 + db 8,33,20,18 + db 8,33,30,18 + db 8,33,40,18 + db 8,22,40,18 + db 8,11,40,18 + + db 21,44,20,18 + db 255 + + endp + + + + + + + + + + +Splitintolines proc near + + +lookforlinestart: call getblockofpixel + cmp al,0 + jnz foundlinestart + dec cl + inc ch + cmp cl,0 + jz endofthisline + cmp ch,mapysize + jnc endofthisline + jmp lookforlinestart + +foundlinestart: mov [es:di],cx + mov bh,1 +lookforlineend: call getblockofpixel + cmp al,0 + jz foundlineend + dec cl + inc ch + cmp cl,0 + jz foundlineend + cmp ch,mapysize + jnc foundlineend + inc bh + jmp lookforlineend + +foundlineend: push cx + mov [es:di+2],bh + call randomnumber + mov [es:di+3],al + call randomnumber + mov [es:di+4],al + call randomnumber + and al,3 + add al,4 + mov [es:di+5],al + add di,6 + pop cx + cmp cl,0 + jz endofthisline + cmp ch,mapysize + jnc endofthisline + jmp lookforlinestart + +endofthisline: ret + + endp + + + + +Getblockofpixel proc near + + push cx es di + mov ax,mapxstart + add cl,al + mov ax,mapystart + add ch,al + call checkone + and cl,1 + jnz failrain + pop di es cx + ret +failrain: pop di es cx + mov al,0 + ret + + endp + + + + +Showrain proc near + + mov ds,mainsprites + mov si,6*58 + mov ax,[si+2] + mov si,ax + add si,2080 + + mov bx,rainlist + mov es,buffers + cmp byte ptr [es:bx],255 + jz nothunder + +morerain: mov es,buffers + cmp byte ptr [es:bx],255 + jz finishrain + + mov al,[es:bx+1] + mov ah,0 + add ax,mapady + add ax,mapystart + mov cx,320 + mul cx + mov cl,[es:bx] + mov ch,0 + add ax,cx + add ax,mapadx + add ax,mapxstart + mov di,ax + + mov cl,[es:bx+2] + mov ch,0 + mov ax,[es:bx+3] + mov dl,[es:bx+5] + mov dh,0 + sub ax,dx + and ax,511 + mov [es:bx+3],ax + add bx,6 + + push si + add si,ax + mov es,workspace + mov ah,0 + mov dx,320-2 +rainloop: lodsb + cmp al,ah + jz noplot + stosb + add di,dx + loop rainloop + pop si + jmp morerain +noplot: add di,320-1 + loop rainloop + pop si + jmp morerain + +finishrain: cmp ch1blockstocopy,0 + jnz nothunder + cmp reallocation,2 + jnz notlouisthund + cmp beenmugged,1 + jnz nothunder +notlouisthund: cmp reallocation,55 + jz nothunder + call randomnum1 + cmp al,1 + jnc nothunder + mov al,7 + cmp ch0playing,6 + jz isthunder1 + mov al,4 +isthunder1: call playchannel1 +nothunder: ret + + endp + + + + + + + +;--------------------------------------------------------------------------- +; +; Sprite update routines for background objects +; +;--------------------------------------------------------------------------- + + + + + + +Backobject proc near + + mov ds,setdat + mov di,[es:bx+20] + + mov al,[es:bx+18] + cmp al,0 + jz $48z + dec al + mov [es:bx+18],al + jmp finishback + +$48z: mov al,[di+7] + mov [es:bx+18],al + mov al,[di+8] + cmp al,6 + jnz notwidedoor + call widedoor + jmp finishback + +notwidedoor: cmp al,5 + jnz notrandom + call random + jmp finishback + +notrandom: cmp al,4 + jnz notlockdoor + call lockeddoorway + jmp finishback + +notlockdoor: cmp al,3 + jnz notlift + call liftsprite + jmp finishback + +notlift: cmp al,2 + jnz notdoor + call doorway + jmp finishback + +notdoor: cmp al,1 + jnz steadyob + call constant + jmp finishback + +steadyob: call steady + +finishback: ;call calcframe + ret + + endp + + + + + + + + + +Liftsprite proc near + + mov al,liftflag + cmp al,0 + jz liftclosed + cmp al,1 + jz liftopen + cmp al,3 + jz openlift + + mov al,[es:bx+19] + cmp al,0 + jz finishclose + dec al + cmp al,11 + jnz pokelift + push ax + mov al,3 + call liftnoise + pop ax + jmp pokelift +finishclose: mov liftflag,0 + ret + +openlift: mov al,[es:bx+19] + cmp al,12 + jz endoflist + inc al + cmp al,1 + jnz pokelift + push ax + mov al,2 + call liftnoise + pop ax +pokelift: mov [es:bx+19],al + mov ah,0 + push di + add di,ax + mov al,[di+18] + pop di + mov [es:bx+15],al + mov [di+17],al + ret + +endoflist: mov liftflag,1 + ret + +liftopen: mov al,liftpath + push es bx + call turnpathon + pop bx es + cmp counttoclose,0 + jz nocountclose + dec counttoclose + cmp counttoclose,0 + jnz nocountclose + mov liftflag,2 +nocountclose: mov al,12 + jmp pokelift + +liftclosed: mov al,liftpath + push es bx + call turnpathoff + pop bx es + cmp counttoopen,0 + jz nocountopen + dec counttoopen + cmp counttoopen,0 + jnz nocountopen + mov liftflag,3 +nocountopen: mov al,0 + jmp pokelift + + endp + + +Liftnoise proc near + + cmp reallocation,5 + jz hissnoise + cmp reallocation,21 + jz hissnoise + call playchannel1 + ret +hissnoise: if demo + mov al,25 + else + mov al,13 + endif + call playchannel1 + ret + + endp + + + + +Random proc near + + call randomnum1 + push di + and ax,7 + add di,18 + add di,ax + mov al,[di] + pop di + mov [es:bx+15],al + ret + + endp + + + + + + + + +Steady proc near + + mov al,[di+18] + mov [di+17],al + mov [es:bx+15],al + ret + + endp + + + + + +Constant proc near + + inc byte ptr [es:bx+19] + mov cl,[es:bx+19] + mov ch,0 + add di,cx + cmp byte ptr [di+18],255 + jnz gotconst + sub di,cx + mov cx,0 + mov [es:bx+19],cl +gotconst: mov al,[di+18] + sub di,cx + mov [es:bx+15],al + mov [di+17],al + ret + + endp + + + + + + + + + + + + + + +Doorway proc near + + mov doorcheck1,-24 + mov doorcheck2,10 + mov doorcheck3,-30 + mov doorcheck4,10 + call dodoor + ret + + endp + + + +Widedoor proc near + + mov doorcheck1,-24 + mov doorcheck2,24 + mov doorcheck3,-30 + mov doorcheck4,24 + call dodoor + ret + + endp + + + + + + + + + +Dodoor proc near + + mov al,ryanx + mov ah,ryany + mov cl,[es:bx+10] + mov ch,[es:bx+11] + + cmp al,cl + jnc rtofdoor + sub al,cl + cmp al,doorcheck1 + jnc upordown + jmp shutdoor +rtofdoor: sub al,cl + cmp al,doorcheck2 + jnc shutdoor + +upordown: cmp ah,ch + jnc botofdoor + sub ah,ch + cmp ah,doorcheck3 + jc shutdoor + jmp opendoor +botofdoor: sub ah,ch + cmp ah,doorcheck4 + jnc shutdoor + +opendoor: mov cl,[es:bx+19] + cmp throughdoor,1 + jnz notthrough + cmp cl,0 + jnz notthrough + mov cl,6 +notthrough: inc cl + cmp cl,1 + jnz notdoorsound2 + mov al,0 + cmp reallocation,5 + jnz nothoteldoor2 + if demo + mov al,25 + else + mov al,13 + endif +nothoteldoor2: call playchannel1 +notdoorsound2: mov ch,0 + + push di + add di,cx + mov al,[di+18] ; must be a better way than this + cmp al,255 + jnz atlast1 + dec di + dec cl +atlast1: mov [es:bx+19],cl + mov al,[di+18] + pop di + mov [es:bx+15],al + mov [di+17],al + mov throughdoor,1 + ret + + +shutdoor: mov cl,[es:bx+19] + cmp cl,5 + jnz notdoorsound1 + mov al,1 + cmp reallocation,5 + jnz nothoteldoor1 + if demo + mov al,25 + else + mov al,13 + endif +nothoteldoor1: call playchannel1 +notdoorsound1: cmp cl,0 + jz atlast2 + dec cl + mov [es:bx+19],cl +atlast2: mov ch,0 + push di + add di,cx + mov al,[di+18] + pop di + mov [es:bx+15],al + mov [di+17],al + cmp cl,5 + jnz notnearly + mov throughdoor,0 +notnearly: ret + + endp + + + + + + + + +Lockeddoorway proc near + + mov al,ryanx + mov ah,ryany + mov cl,[es:bx+10] + mov ch,[es:bx+11] + + cmp al,cl + jnc rtofdoor2 + sub al,cl + cmp al,-24 + jnc upordown2 + jmp shutdoor2 +rtofdoor2: sub al,cl + cmp al,10 + jnc shutdoor2 + +upordown2: cmp ah,ch + jnc botofdoor2 + sub ah,ch + cmp ah,-30 + jc shutdoor2 + jmp opendoor2 +botofdoor2: sub ah,ch + cmp ah,12 + jnc shutdoor2 + +opendoor2: cmp throughdoor,1 + jz mustbeopen + cmp lockstatus,1 + jz shutdoor +mustbeopen: mov cl,[es:bx+19] + cmp cl,1 + jnz notdoorsound4 + mov al,0 + call playchannel1 +notdoorsound4: cmp cl,6 ; was 3 + jnz noturnonyet + mov al,doorpath + push es bx + call turnpathon + pop bx es + +noturnonyet: mov cl,[es:bx+19] + cmp throughdoor,1 + jnz notthrough2 + cmp cl,0 + jnz notthrough2 + mov cl,6 +notthrough2: inc cl + mov ch,0 + + push di + add di,cx + mov al,[di+18] + cmp al,255 + jnz atlast3 + dec di + dec cl +atlast3: mov [es:bx+19],cl + mov al,[di+18] + pop di + mov [es:bx+15],al + mov [di+17],al + cmp cl,5 + jnz justshutting + mov throughdoor,1 +justshutting: ret + + + +shutdoor2: mov cl,[es:bx+19] + cmp cl,5 + jnz notdoorsound3 + mov al,1 + call playchannel1 +notdoorsound3: cmp cl,0 + jz atlast4 + dec cl + mov [es:bx+19],cl +atlast4: mov ch,0 + mov throughdoor,0 + push di + add di,cx + mov al,[di+18] + pop di + mov [es:bx+15],al + mov [di+17],al + cmp cl,0 ;1 + jnz notlocky + mov al,doorpath + push es bx + call turnpathoff + pop bx es + mov lockstatus,1 +notlocky: ret + + endp + + + + + + + + + + +;------------------------------------------------------------People handler---- + +Updatepeople proc near + + mov es,buffers + mov di,peoplelist + mov listpos,di + mov cx,12*5 + mov al,255 + rep stosb + + inc maintimer + push cs + pop es + mov bx,offset cs:reelroutines + mov di,offset cs:reelcalls +updateloop: mov al,[es:bx] + cmp al,255 + jz endupdate + cmp al,reallocation + jnz notinthisroom + mov cx,[es:bx+1] + cmp cl,mapx + jnz notinthisroom + cmp ch,mapy + jnz notinthisroom + push di + mov ax,[cs:di] + call ax + pop di +notinthisroom: add bx,8 + add di,2 + jmp updateloop +endupdate: ret + + endp + + + + + + + + + + + + + + +Getreelframeax proc near + + push ds + mov currentframe,ax + call findsource + push ds + pop es + pop ds + mov ax,currentframe + sub ax,takeoff + add ax,ax + mov cx,ax + add ax,ax + add ax,cx + mov bx,ax + ret + + endp + + + + + + + + + + +Reelsonscreen proc near + + call reconstruct + call updatepeople + call watchreel + call showrain + call usetimedtext + ret + + endp + + + + + + +Plotreel proc near + + call getreelstart +retryreel: push es si + mov ax,[es:si+2] + cmp al,220 + jc normalreel + cmp al,255 + jz normalreel + call dealwithspecial + inc reelpointer + pop si es + add si,40 + jmp retryreel + +normalreel: mov cx,8 +plotloop: push cx es si + mov ax,[es:si] + cmp ax,0ffffh + jz notplot + call showreelframe +notplot: pop si es cx + add si,5 + loop plotloop + call soundonreels + pop bx es + ret + + endp + + + + + +Soundonreels proc near + + mov bl,reallocation + add bl,bl + xor bh,bh + add bx,offset cs:roombyroom + mov si,[cs:bx] + +reelsoundloop: mov al,[cs:si] + cmp al,255 + jz endreelsound + mov ax,[cs:si+1] + cmp ax,reelpointer + jnz skipreelsound + + cmp ax,lastsoundreel + jz skipreelsound + + mov lastsoundreel,ax + mov al,[cs:si] + cmp al,64 + jc playchannel1 + cmp al,128 + jc channel0once + and al,63 + mov ah,255 + jmp playchannel0 +channel0once: and al,63 + mov ah,0 + jmp playchannel0 +skipreelsound: add si,3 + jmp reelsoundloop +endreelsound: mov ax,lastsoundreel + cmp ax,reelpointer + jz nochange2 + mov lastsoundreel,-1 +nochange2: ret + +roombyroom dw r0,r1,r2,r0,r0,r0,r6,r0,r8,r9,r10,r11,r12,r13,r14,r0,r0,r0,r0,r0 + dw r20,r0,r22,r23,r0,r25,r26,r27,r28,r29,r0,r0,r0,r0,r0 + dw r0,r0,r0,r0,r0,r0,r0,r0,r0,r0,r45,r46,r47,r0,r0,r0,r0,r52,r53,r0,r55 + +r0 db 255 + +r1 db 15 + dw 257 + db 255 + +r2 db 12 + dw 5 + db 13 + dw 21 + db 15 ;hitting floor? + dw 35 + db 17 + dw 50 + db 18 + dw 103 + db 19 + dw 108 + db 255 + +r6 db 18 + dw 19 + db 19 + dw 23 + db 255 + +r8 db 12 + dw 51 + db 13 + dw 53 + db 14 + dw 14 + db 15 + dw 20 + db 0 + dw 78 + db 255 + +r9 db 12 + dw 119 + db 12 + dw 145 + db 255 + +r10 db 13 + dw 16 + db 255 + +r11 db 13 + dw 20 + db 255 + +r12 db 14 + dw 16 + db 255 + +r13 db 15 + dw 4 + db 16 + dw 8 + db 17 + dw 134 + db 18 + dw 153 + db 255 + +r14 db 13 + dw 108 + db 15 + dw 326 + db 15 + dw 331 + db 15 + dw 336 + db 15 + dw 342 + db 15 + dw 348 + db 15 + dw 354 + db 18 + dw 159 + db 18 + dw 178 + db 19+128 + dw 217 + db 20+64 + dw 228 + db 255 + +r20 db 13 + dw 20 + db 13 + dw 21 + db 15 + dw 34 + db 13 + dw 52 + db 13 + dw 55 + db 25 + dw 57 + db 21 + dw 73 + db 255 + +r22 db 13 ;room,sample + dw 196 ;reelpointer + db 13 + dw 234 + db 13 + dw 156 + db 14 + dw 129 + db 13 + dw 124 + db 15 + dw 162 + db 15 + dw 200 + db 15 + dw 239 + db 17 + dw 99 + db 12 + dw 52 + db 255 + +r23 db 15 + dw 56 + db 16 + dw 64 + db 19 + dw 22 + db 20 + dw 33 + db 255 + +r25 db 20 + dw 11 + db 20 + dw 15 + db 15 + dw 28 + db 13 + dw 80 + db 21 + dw 82 + db 19+128 + dw 87 + db 23+64 + dw 128 + db 255 + +r26 db 12 + dw 13 + db 14 + dw 39 + db 12 + dw 67 + db 12 + dw 75 + db 12 + dw 83 + db 12 + dw 91 + db 15 + dw 102 ; was 90, should be mine cart + db 255 + +r27 db 22 + dw 36 + db 13 + dw 125 + db 18 + dw 88 + db 15 + dw 107 + db 14 + dw 127 + db 14 + dw 154 + db 19+128 + dw 170 + db 23+64 + dw 232 + db 255 + +r28 db 21 + dw 16 + db 21 + dw 72 + db 21 + dw 205 + db 22 + dw 63 ;65 + db 23+128 + dw 99 + db 24+64 + dw 158 + db 255 + +r29 db 13 + dw 21 + db 14 + dw 24 + db 19+128 + dw 50 + db 23+64 + dw 75 + if german + else + db 24 + dw 128 + endif + db 255 + +r45 db 19+64 + dw 46 + db 16 + dw 167 + db 255 + +r46 db 16 + dw 19 + db 14 + dw 36 + db 16 + dw 50 + db 14 + dw 65 + db 16 + dw 81 + db 14 + dw 96 + db 16 + dw 114 + db 14 + dw 129 + db 16 + dw 147 + db 14 + dw 162 + db 16 + dw 177 + db 14 + dw 191 + db 255 + +r47 db 13 + dw 48 + db 14 + dw 41 + db 15 + dw 78 + db 16 + dw 92 + db 255 + +r52 db 16 + dw 115 + db 255 + +r53 db 21 + dw 103 + db 20 + dw 199 + db 255 + +r55 db 17 + dw 53 + db 17 + dw 54 + db 17 + dw 55 + db 17 + dw 56 + db 17 + dw 57 + db 17 + dw 58 + db 17 + dw 59 + db 17 + dw 61 + db 17 + dw 63 + db 17 + dw 64 + db 17 + dw 65 + db 255 + + endp + + + + + + + + + +Reconstruct proc near + + cmp havedoneobs,0 + jz noneedtorecon + mov newobs,1 + call drawfloor + call spriteupdate + call printsprites + if foreign + cmp reallocation,20 + jnz notfudge + call undertextline +notfudge: + endif + mov havedoneobs,0 +noneedtorecon: ret + + endp + + + + + + + + + + +Dealwithspecial proc near + + sub al,220 + cmp al,0 + jnz notplset + mov al,ah + call placesetobject + mov havedoneobs,1 + ret +notplset: cmp al,1 + jnz notremset + mov al,ah + call removesetobject + mov havedoneobs,1 + ret +notremset: cmp al,2 + jnz notplfree + mov al,ah + call placefreeobject + mov havedoneobs,1 + ret +notplfree: cmp al,3 + jnz notremfree + mov al,ah + call removefreeobject + mov havedoneobs,1 + ret +notremfree: cmp al,4 + jnz notryanoff + call switchryanoff + ret +notryanoff: cmp al,5 + jnz notryanon + mov turntoface,ah + mov facing,ah + call switchryanon + ret +notryanon: cmp al,6 + jnz notchangeloc + mov newlocation,ah ; was new loc in watch + ;call switchryanon + ret +notchangeloc: call movemap + ret + + endp + + + +Movemap proc near + + cmp ah,32 + jnz notmapup2 + sub mapy,20 + mov nowinnewroom,1 + ret + +notmapup2: cmp ah,16 + jnz notmapupspec + sub mapy,10 + mov nowinnewroom,1 + ret + +notmapupspec: cmp ah,8 + jnz notmapdownspec + add mapy,10 + mov nowinnewroom,1 + ret + +notmapdownspec: cmp ah,2 + jnz notmaprightspec + add mapx,11 + mov nowinnewroom,1 + ret + +notmaprightspec: sub mapx,11 + mov nowinnewroom,1 + ret + + endp + + + + +Getreelstart proc near + + mov ax,reelpointer + mov cx,40 + mul cx + mov es,reels + mov si,ax + add si,reellist + ret + + endp + + + + + +;------------------------------------------------------Printing a reel frame---- + + + +Showreelframe proc near + + mov al,[es:si+2] + mov ah,0 + mov di,ax + add di,mapadx + mov al,[es:si+3] + mov bx,ax + add bx,mapady + mov ax,[es:si] + mov currentframe,ax + call findsource + mov ax,currentframe + sub ax,takeoff + mov ah,8 + call showframe + ret + + endp + + + + + + +;------------------------------------------------------------------------------- + + + + + + + + + +Deleverything proc near + + mov al,mapysize + mov ah,0 + add ax,mapoffsety + cmp ax,182 + jnc bigroom + call maptopanel + ret +bigroom: sub mapysize,8 + call maptopanel + add mapysize,8 + ret + + endp + + + + + + + + + + + +Dumpeverything proc near + + mov es,buffers + mov bx,printedlist +dumpevery1: mov ax,[es:bx] + mov cx,[es:bx+2] + cmp ax,0ffffh + jz finishevery1 + cmp ax,[es:bx+(40*5)] + jnz notskip1 + cmp cx,[es:bx+(40*5)+2] + jz skip1 + +notskip1: push bx es ds + mov bl,ah + mov bh,0 + mov ah,0 + mov di,ax + add di,mapadx + add bx,mapady + call multidump + pop ds es bx + +skip1: add bx,5 + jmp dumpevery1 + +finishevery1: mov bx,printedlist+(40*5) +dumpevery2: mov ax,[es:bx] + mov cx,[es:bx+2] + cmp ax,0ffffh + jz finishevery2 + + push bx es ds + mov bl,ah + mov bh,0 + mov ah,0 + mov di,ax + add di,mapadx + add bx,mapady + call multidump + pop ds es bx + add bx,5 + jmp dumpevery2 + +finishevery2: ret + + endp + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/talk.asm b/devtools/tasmrecover/dreamweb/talk.asm new file mode 100644 index 0000000000..cb100f6602 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/talk.asm @@ -0,0 +1,580 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +Talk proc near + + mov talkpos,0 + mov inmaparea,0 + mov al,command + mov character,al + call createpanel + call showpanel + call showman + call showexit + call undertextline + call convicons + call starttalk + mov commandtype,255 + call readmouse + call showpointer + call worktoscreen +waittalk: call delpointer + call readmouse + call animpointer + call showpointer + call vsync + call dumppointer + call dumptextline + mov getback,0 + mov bx,offset cs:talklist + call checkcoords + cmp getback,0 + jz waittalk +finishtalk: mov bx,persondata + push cs + pop es + cmp talkpos,4 + jc notnexttalk + mov al,[es:bx+7] + or al,128 + mov [es:bx+7],al +notnexttalk: call redrawmainscrn + call worktoscreenm + cmp speechloaded,1 + jnz nospeech + call cancelch1 + mov volumedirection,-1 ;fade (louder) + mov volumeto,0 ;up to 0 (max) +nospeech: ret + +talklist: dw 273,320,157,198,getback1 + dw 240,290,2,44,moretalk + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + + + + + + + + +Convicons proc near + + mov al,character + and al,127 + call getpersframe + mov di,234 + mov bx,2 + mov currentframe,ax + call findsource + mov ax,currentframe + sub ax,takeoff + mov ah,0 + call showframe + ret + + endp + + + + + + + + +Getpersframe proc near + + mov ah,0 + add ax,ax + mov bx,ax + mov es,people + add bx,personframes + mov ax,[es:bx] + ret + + endp + + + + + +Starttalk proc near + + mov talkmode,0 + mov al,character + and al,127 + call getpersontext + mov charshift,91+91 + mov di,66 + mov bx,64 + mov dl,241 + mov al,0 + mov ah,79 + call printdirect + mov charshift,0 + mov di,66 + mov bx,80 + mov dl,241 + mov al,0 + mov ah,0 + call printdirect + + if cd + mov speechloaded,0 + mov al,character + and al,127 + mov ah,0 + mov cx,64 + mul cx + mov cl,"C" + mov dl,"R" + mov dh,reallocation + call loadspeech + cmp speechloaded,1 + jnz nospeech1 + mov volumedirection,1 ;quieter + mov volumeto,6 ;quite quiet! + mov al,50+12 + call playchannel1 + endif +nospeech1: ret + + endp + + + + + +Getpersontext proc near + + mov ah,0 + mov cx,64*2 + mul cx + mov si,ax + mov es,people + add si,persontxtdat + mov cx,persontext + mov ax,[es:si] + add ax,cx + mov si,ax + ret + + endp + + + + + + + +Moretalk proc near + + ;cmp ch1playing,255 + ;jnz cantredes + cmp talkmode,0 + jz canmore + call redes + ret + +canmore: cmp commandtype,215 + jz alreadymore + mov commandtype,215 + mov al,49 + call commandonly +alreadymore: mov ax,mousebutton + cmp ax,oldbutton + jz nomore + and ax,1 + jnz domoretalk +nomore: ret + +domoretalk: mov talkmode,2 + mov talkpos,4 + cmp character,100 + jc notsecondpart + mov talkpos,48 +notsecondpart: call dosometalk + ret + + endp + + + + + + + + + + + + + + +Dosometalk proc near + + if cd +dospeech: mov al,talkpos + mov al,character + and al,127 + mov ah,0 + mov cx,64 + mul cx + mov cx,ax + mov al,talkpos + mov ah,0 + add ax,cx + add ax,ax + mov si,ax + + mov es,people + add si,persontxtdat + mov cx,persontext + + mov ax,[es:si] + add ax,cx + mov si,ax + cmp byte ptr [es:si],0 + jz endheartalk + + push es si + call createpanel + call showpanel + call showman + call showexit + call convicons + pop si es + + mov di,164 + mov bx,64 + mov dl,144 + mov al,0 + mov ah,0 + call printdirect + + mov al,character + and al,127 + mov ah,0 + mov cx,64 + mul cx + mov cl,talkpos + mov ch,0 + add ax,cx + mov cl,"C" + mov dl,"R" + mov dh,reallocation + call loadspeech + cmp speechloaded,0 + jz noplay1 + mov al,62 + call playchannel1 + +noplay1: mov pointermode,3 + call worktoscreenm + mov cx,180 + call hangonpq + jnc $1 + ret + +$1: + inc talkpos + + mov al,talkpos + mov al,character + and al,127 + mov ah,0 + mov cx,64 + mul cx + mov cx,ax + mov al,talkpos + mov ah,0 + add ax,cx + add ax,ax + mov si,ax + + mov es,people + add si,persontxtdat + mov cx,persontext + + mov ax,[es:si] + add ax,cx + mov si,ax + cmp byte ptr [es:si],0 + jz endheartalk + cmp byte ptr [es:si],":" + jz skiptalk2 + cmp byte ptr [es:si],32 + jz skiptalk2 + + push es si + call createpanel + call showpanel + call showman + call showexit + call convicons + pop si es + + mov di,48 + mov bx,128 + mov dl,144 + mov al,0 + mov ah,0 + call printdirect + + mov al,character + and al,127 + mov ah,0 + mov cx,64 + mul cx + mov cl,talkpos + mov ch,0 + add ax,cx + mov cl,"C" + mov dl,"R" + mov dh,reallocation + call loadspeech + cmp speechloaded,0 + jz noplay2 + mov al,62 + call playchannel1 + +noplay2: mov pointermode,3 + call worktoscreenm + mov cx,180 + call hangonpq + jnc skiptalk2 + ret + +skiptalk2: inc talkpos + jmp dospeech + +endheartalk: mov pointermode,0 + ret + + else + +watchtalk: mov al,talkpos + mov al,character + and al,127 + mov ah,0 + mov cx,64 + mul cx + mov cx,ax + mov al,talkpos + mov ah,0 + add ax,cx + add ax,ax + mov si,ax + + mov es,people + add si,persontxtdat + mov cx,persontext + + mov ax,[es:si] + add ax,cx + mov si,ax + cmp byte ptr [es:si],0 + jz endwatchtalk + + push es si + call createpanel + call showpanel + call showman + call showexit + call convicons + pop si es + + mov di,164 + mov bx,64 + mov dl,144 + mov al,0 + mov ah,0 + call printdirect + + mov pointermode,3 + call worktoscreenm + mov cx,180 + call hangonpq + jnc $1 + ret +$1: + + inc talkpos + + mov al,talkpos + mov al,character + and al,127 + mov ah,0 + mov cx,64 + mul cx + mov cx,ax + mov al,talkpos + mov ah,0 + add ax,cx + add ax,ax + mov si,ax + + mov es,people + add si,persontxtdat + mov cx,persontext + + mov ax,[es:si] + add ax,cx + mov si,ax + cmp byte ptr [es:si],0 + jz endwatchtalk + cmp byte ptr [es:si],":" + jz skiptalk + cmp byte ptr [es:si],32 + jz skiptalk + + push es si + call createpanel + call showpanel + call showman + call showexit + call convicons + pop si es + + mov di,48 + mov bx,128 + mov dl,144 + mov al,0 + mov ah,0 + call printdirect + + mov pointermode,3 + call worktoscreenm + mov cx,180 + call hangonpq + jnc skiptalk + ret + +skiptalk: inc talkpos + jmp watchtalk + +endwatchtalk: mov pointermode,0 + ret + + endif + + endp + + + + + + + +Hangonpq proc near + + mov getback,0 + mov bx,0 +hangloopq: push cx bx + call delpointer + call readmouse + call animpointer + call showpointer + call vsync + call dumppointer + call dumptextline + mov bx,offset cs:quitlist + call checkcoords + pop bx cx + cmp getback,1 + jz quitconv + cmp speechloaded,1 + jnz notspeaking + cmp ch1playing,255 + jnz notspeaking + inc bx + cmp bx,40 ;pause after speech ends + jz finishconv +notspeaking: cmp mousebutton,0 + jz hangloopq + cmp oldbutton,0 + jnz hangloopq +finishconv: call delpointer + mov pointermode,0 + clc + ret + +quitconv: call delpointer + mov pointermode,0 + call cancelch1 + stc + ret + +quitlist: dw 273,320,157,198,getback1 + dw 0,320,0,200,blank + dw 0ffffh + + endp + + + + + + + + + +Redes proc near + + cmp ch1playing,255 + jnz cantredes + cmp talkmode,2 + jz canredes +cantredes: call blank + ret + +canredes: cmp commandtype,217 + jz alreadyreds + mov commandtype,217 + mov al,50 + call commandonly +alreadyreds: mov ax,mousebutton + and ax,1 + jnz doredes + ret + +doredes: call delpointer + call createpanel + call showpanel + call showman + call showexit + call convicons + call starttalk + call readmouse + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/titles.asm b/devtools/tasmrecover/dreamweb/titles.asm new file mode 100644 index 0000000000..b4ca4d1c49 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/titles.asm @@ -0,0 +1,583 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text + +Titles proc near + + if demo + ret + else + call clearpalette + call biblequote + call intro + ret + endif + + endp + + + + +Endgame proc near + + mov dx,offset cs:endtextname + call loadtemptext + call monkspeaking + call gettingshot + call getridoftemptext + mov volumeto,7 + mov volumedirection,1 + mov cx,200 + call hangon + ret + + endp + + + if cd + +Monkspeaking proc near + + mov roomssample,35 + call loadroomssample + mov dx,offset cs:monkface + call loadintotemp + call clearwork ;createpanel2 + call showmonk + call worktoscreen + mov volume,7 + mov volumedirection,-1 + mov volumeto,5 + mov al,12 + mov ah,255 + call playchannel0 + call fadescreenups + mov cx,300 + call hangon + + mov al,40 +loadspeech2: push ax + mov dl,"T" + mov dh,83 + mov cl,"T" + mov ah,0 + call loadspeech + mov al,50+12 + call playchannel1 +notloadspeech2: + call vsync + cmp ch1playing,255 + jnz notloadspeech2 + pop ax + inc al + cmp al,48 + jnz loadspeech2 + + mov volumedirection,1 + mov volumeto,7 + call fadescreendowns + mov cx,300 + call hangon + call getridoftemp + ret + + endp + + else + +Monkspeaking proc near + + mov roomssample,35 + call loadroomssample + mov dx,offset cs:monkface + call loadintotemp + call clearwork ;createpanel2 + call showmonk + call worktoscreen + mov volume,7 + mov volumedirection,-1 + mov volumeto,0 + mov al,12 + mov ah,255 + call playchannel0 + call fadescreenups + mov cx,300 + call hangon + + mov al,40 +nextmonkspeak: push ax + mov ah,0 + mov si,ax + add si,si + mov es,textfile1 + mov ax,[es:si] + add ax,textstart + mov si,ax +nextbit: mov di,36 + mov bx,140 + mov dl,239 + call printdirect + push ax si es + call worktoscreen + call clearwork + call showmonk + mov cx,240 + call hangon + pop es si ax + cmp al,0 + jnz nextbit + pop ax + inc al + cmp al,44 + jnz nextmonkspeak + + mov volumedirection,1 + mov volumeto,7 + call fadescreendowns + mov cx,300 + call hangon + call getridoftemp + ret + + endp + + endif + + + + +Showmonk proc near + + mov al,0 + mov ah,128 + mov di,160 + mov bx,72 + mov ds,tempgraphics + call showframe + ret + + endp + + +Gettingshot proc near + + mov newlocation,55 + call clearpalette + call loadintroroom + call fadescreenups + mov volumeto,0 + mov volumedirection,-1 + call runendseq + call clearbeforeload + ret + + endp + + + + + + +Credits proc near + + call clearpalette + call realcredits + ret + + endp + + + +Biblequote proc near + + call mode640x480 + mov dx,offset cs:title0graphics + call showpcx + call fadescreenups + mov cx,80 + call hangone + cmp lasthardkey,1 + jz biblequotearly + mov cx,560 + call hangone + cmp lasthardkey,1 + jz biblequotearly + call fadescreendowns + mov cx,200 ;128 + call hangone + cmp lasthardkey,1 + jz biblequotearly + call cancelch0 +biblequotearly: + mov lasthardkey,0 + ret + + endp + + + + +Hangone proc near + +hangonloope: push cx + call vsync + pop cx + cmp lasthardkey,1 + jz hangonearly + loop hangonloope +hangonearly: + ret + + endp + + + + + + +Intro proc near + + mov dx,offset cs:introtextname + call loadtemptext + + call loadpalfromiff + call setmode + + mov newlocation,50 + call clearpalette + call loadintroroom + mov volume,7 + mov volumedirection,-1 + if cd + mov volumeto,4 + else + mov volumeto,0 + endif + mov al,12 ;4 + mov ah,255 + call playchannel0 + call fadescreenups + call runintroseq + cmp lasthardkey,1 + jz introearly + +;waitsound: cmp ch1blockstoplay,0 +; jnz waitsound + call clearbeforeload + + mov newlocation,52 + call loadintroroom + call runintroseq + cmp lasthardkey,1 + jz introearly + call clearbeforeload + + mov newlocation,53 + call loadintroroom + call runintroseq + cmp lasthardkey,1 + jz introearly + call clearbeforeload + + call allpalette + mov newlocation,54 + call loadintroroom + ;mov al,12 + ;mov ah,255 + ;call playchannel0 + call runintroseq + cmp lasthardkey,1 + jz introearly + + call getridoftemptext + call clearbeforeload +introearly: + mov lasthardkey, 0 + ret + + endp + + + + + + + + +Runintroseq proc near + + mov getback,0 + +moreintroseq: call vsync + cmp lasthardkey,1 + jz earlyendrun + call spriteupdate + call vsync + cmp lasthardkey,1 + jz earlyendrun + call deleverything + call printsprites + call reelsonscreen + call afterintroroom + call usetimedtext + call vsync + cmp lasthardkey,1 + jz earlyendrun + call dumpmap + call dumptimedtext + call vsync + cmp lasthardkey,1 + jz earlyendrun + cmp getback,1 + jnz moreintroseq + ret +earlyendrun: + call getridoftemptext + call clearbeforeload + ret + + endp + + + + + +Runendseq proc near + + call atmospheres + mov getback,0 +moreendseq: call vsync + call spriteupdate + call vsync + call deleverything + call printsprites + call reelsonscreen + call afterintroroom + call usetimedtext + call vsync + call dumpmap + call dumptimedtext + call vsync + cmp getback,1 + jnz moreendseq + ret + + endp + + + + +Loadintroroom proc near + + mov introcount,0 + mov location,255 + call loadroom + mov mapoffsetx,72 + mov mapoffsety,16 + call clearsprites + mov throughdoor,0 + mov currentkey,"0" + mov mainmode,0 + call clearwork + mov newobs,1 + call drawfloor + call reelsonscreen + call spriteupdate + call printsprites + call worktoscreen + ret + + endp + + + + + + +Mode640x480 proc near + + mov al,12h+128 + mov ah,0 + int 10h + ;call clearpalette + ret + + endp + + + +Set16colpalette proc near + + mov cx,16 + mov bl,0 + mov bh,0 + mov al,0 + mov ah,10h +set16palloop2: push ax bx cx + int 10h + pop cx bx ax + inc bl + inc bh + loop set16palloop2 + + mov bl,31h + mov al,1 + mov ah,12h + int 10h + ret + + endp + + + + + +RealCredits proc near + + mov roomssample,33 + call loadroomssample + mov volume,0 + + call mode640x480 + mov cx,35 + call hangon + + mov dx,offset cs:title1graphics + call showpcx + mov al,12 + mov ah,0 + call playchannel0 + mov cx,2 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call allpalette + mov cx,80 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call fadescreendowns + mov cx,256 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + + mov dx,offset cs:title2graphics + call showpcx + mov al,12 + mov ah,0 + call playchannel0 + mov cx,2 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call allpalette + mov cx,80 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call fadescreendowns + mov cx,256 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + + if demo + else + mov dx,offset cs:title3graphics + call showpcx + mov al,12 + mov ah,0 + call playchannel0 + mov cx,2 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call allpalette + mov cx,80 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call fadescreendowns + mov cx,256 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + + mov dx,offset cs:title4graphics + call showpcx + mov al,12 + mov ah,0 + call playchannel0 + mov cx,2 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call allpalette + mov cx,80 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call fadescreendowns + mov cx,256 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + + mov dx,offset cs:title5graphics + call showpcx + mov al,12 + mov ah,0 + call playchannel0 + mov cx,2 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call allpalette + mov cx,80 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call fadescreendowns + mov cx,256 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + endif + + mov dx,offset cs:title6graphics + call showpcx + call fadescreenups + mov cx,60 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + mov al,13 + mov ah,0 + call playchannel0 + mov cx,350 + call hangone + cmp lasthardkey,1 + jz realcreditsearly + call fadescreendowns + mov cx,256 + call hangone +realcreditsearly: + mov lasthardkey, 0 + ret + + endp + + + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/use.asm b/devtools/tasmrecover/dreamweb/use.asm new file mode 100644 index 0000000000..4b82f946f0 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/use.asm @@ -0,0 +1,3810 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text + +Useobject proc near + + mov withobject,255 + + cmp commandtype,229 + jz alreadyuse + mov commandtype,229 + + mov bl,command + mov bh,objecttype + mov al,51 + call commandwithob +alreadyuse: mov ax,mousebutton + cmp ax,oldbutton + jz nouse + and ax,1 + jnz douse +nouse: ret + +douse: call useroutine + ret + + endp + + + + + + + +Useroutine proc near + + cmp reallocation,50 + jc nodream7 + cmp pointerpower,0 + jnz powerok + ret +powerok: mov pointerpower,0 + +nodream7: call getanyad + mov dx,seg uselist + mov ds,dx + mov si,offset uselist +checkuselist: push si + lodsb + sub al,"A" + cmp al,[es:bx+12] + jnz failed + lodsb + sub al,"A" + cmp al,[es:bx+13] + jnz failed + lodsb + sub al,"A" + cmp al,[es:bx+14] + jnz failed + lodsb + sub al,"A" + cmp al,[es:bx+15] + jnz failed + lodsw + pop si + call ax + ret +failed: pop si + add si,6 + cmp byte ptr [si],140 + jnz checkuselist + + call delpointer + call getobtextstart + call findnextcolon + cmp al,0 + jz cantuse2 + call findnextcolon + cmp al,0 + jz cantuse2 + mov al,[es:si] + cmp al,0 + jz cantuse2 + call usetext + mov cx,400 + call hangonp + call putbackobstuff + ret +cantuse2: call createpanel + call showpanel + call showman + call showexit + call obicons + mov di,33 + mov bx,100 + mov al,63 + mov dl,241 + call printmessage + call worktoscreenm + mov cx,50 + call hangonp + call putbackobstuff + mov commandtype,255 + ret + +Uselist: db "NETW" + dw usemon + db "ELVA" + dw useelevator1 + db "ELVB" + dw useelevator2 + db "ELVC" + dw useelevator3 + db "ELVE" + dw useelevator4 + db "ELVF" + dw useelevator5 + db "CGAT" + dw usechurchgate + db "REMO" + dw usestereo + db "BUTA" + dw usebuttona + db "CBOX" + dw usewinch + db "LITE" + dw uselighter + db "PLAT" + dw useplate + db "LIFT" + dw usecontrol + db "WIRE" + dw usewire + db "HNDL" + dw usehandle + db "HACH" + dw usehatch + db "DOOR" + dw useelvdoor + db "CSHR" + dw usecashcard + db "GUNA" + dw usegun + db "CRAA" + dw usecardreader1 + db "CRBB" + dw usecardreader2 + db "CRCC" + dw usecardreader3 + db "SEAT" + dw sitdowninbar + db "MENU" + dw usemenu + db "COOK" + dw usecooker + db "ELCA" + dw callhotellift + db "EDCA" + dw calledenslift + db "DDCA" + dw calledensdlift + db "ALTR" + dw usealtar + db "LOKA" + dw openhoteldoor + db "LOKB" + dw openhoteldoor2 + db "ENTA" + dw openlouis + db "ENTB" + dw openryan + db "ENTE" + dw openpoolboss + db "ENTC" + dw openyourneighbour + db "ENTD" + dw openeden + db "ENTH" + dw opensarters + db "WWAT" + dw wearwatch + db "POOL" + dw usepoolreader + db "WSHD" + dw wearshades + db "GRAF" + dw grafittidoor + db "TRAP" + dw trapdoor + db "CDPE" + dw edenscdplayer + + db "DLOK" + dw opentvdoor + + db "HOLE" + dw usehole + + db "DRYR" + dw usedryer + + db "HOLY" + dw usechurchhole + + db "WALL" + dw usewall + db "BOOK" + dw usediary + + db "AXED" + dw useaxe + db "SHLD" + dw useshield + + db "BCNY" + dw userailing + db "LIDC" + dw usecoveredbox + db "LIDU" + dw useclearbox + db "LIDO" + dw useopenbox + db "PIPE" + dw usepipe + + db "BALC" + dw usebalcony + db "WIND" + dw usewindow + db "PAPR" + dw viewfolder + + db "UWTA" + dw usetrainer + db "UWTB" + dw usetrainer + + db "STAT" + dw entersymbol + db "TLID" + dw opentomb + db "SLAB" + dw useslab + db "CART" + dw usecart + db "FCAR" + dw usefullcart + + + db "SLBA" + dw slabdoora + db "SLBB" + dw slabdoorb + db "SLBC" + dw slabdoorc + db "SLBD" + dw slabdoord + db "SLBE" + dw slabdoore + db "SLBF" + dw slabdoorf + db "PLIN" + dw useplinth + + db "LADD" + dw useladder + db "LADB" + dw useladderb + + db "GUMA" + dw chewy + + db "SQEE" + dw wheelsound + db "TAPP" + dw runtap + db "GUIT" + dw playguitar + db "CONT" + dw hotelcontrol + + db "BELL" + dw hotelbell + + db 140,140,140,140 + + endp + + + + + + +;-----------------------------------------------------------Puzzle routines---- + + +Wheelsound proc near + + mov al,17 + call playchannel1 + call showfirstuse + call putbackobstuff + ret + + endp + + + + +Runtap proc near + + cmp withobject,255 + jnz tapwith + call withwhat + ret +tapwith: mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"U" + mov dl,"P" + mov dh,"E" + call compare + jz fillcupfromtap + mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"U" + mov dl,"P" + mov dh,"F" + call compare + jz cupfromtapfull + mov cx,300 + mov al,56 + call showpuztext + call putbackobstuff + ret + +fillcupfromtap: mov al,withobject + call getexad + mov byte ptr [es:bx+15],"F"-"A" + mov al,8 + call playchannel1 + mov cx,300 + mov al,57 + call showpuztext + call putbackobstuff + ret + +cupfromtapfull: mov cx,300 + mov al,58 + call showpuztext + call putbackobstuff + ret + + + endp + + + +Playguitar proc near + + mov al,14 + call playchannel1 + call showfirstuse + call putbackobstuff + ret + + endp + + + +Hotelcontrol proc near + + cmp reallocation,21 + jnz notrightcont + cmp mapx,33 + jnz notrightcont + call showfirstuse + call putbackobstuff + ret +notrightcont: call showseconduse + call putbackobstuff + ret + + endp + + + + +Hotelbell proc near + + if demo + mov al,24 + else + mov al,12 + endif + call playchannel1 + call showfirstuse + call putbackobstuff + ret + + endp + + + + + +Opentomb proc near + + inc progresspoints + call showfirstuse + mov watchingtime,35*2 + mov reeltowatch,1 + mov endwatchreel,33 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret + + endp + + + +Usetrainer proc near + + call getanyad + cmp byte ptr [es:bx+2],4 + jnz notheldtrainer + inc progresspoints + call makeworn + call showseconduse + call putbackobstuff + ret +notheldtrainer: call nothelderror + ret + + endp + + + +Nothelderror proc near + + call createpanel + call showpanel + call showman + call showexit + call obicons + mov di,64 + mov bx,100 + mov al,63 + mov ah,1 + mov dl,201 + call printmessage2 + call worktoscreenm + mov cx,50 + call hangonp + call putbackobstuff + ret + + endp + + + +Usepipe proc near + + cmp withobject,255 + jnz pipewith + call withwhat + ret +pipewith: mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"U" + mov dl,"P" + mov dh,"E" + call compare + jz fillcup + mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"U" + mov dl,"P" + mov dh,"F" + call compare + jz alreadyfull + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +fillcup: mov cx,300 + mov al,36 + call showpuztext + call putbackobstuff + mov al,withobject + call getexad + mov byte ptr [es:bx+15],"F"-"A" + ret + +alreadyfull: mov cx,300 + mov al,35 + call showpuztext + call putbackobstuff + ret + + endp + + + + + + +Usefullcart proc near + + inc progresspoints + mov al,2 + mov ah,roomnum + add ah,6 + call turnanypathon + mov manspath,4 + mov facing,4 + mov turntoface,4 + mov finaldest,4 + call findxyfrompath + mov resetmanxy,1 + call showfirstuse + mov watchingtime,72*2 + mov reeltowatch,58 + mov endwatchreel,142 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret + + endp + + + + + + + +Useplinth proc near + + cmp withobject,255 + jnz plinthwith + call withwhat + ret + +plinthwith: mov al,withobject + mov ah,withtype + mov cl,"D" + mov ch,"K" + mov dl,"E" + mov dh,"Y" + call compare + jz isrightkey + call showfirstuse + call putbackobstuff + ret + +isrightkey: inc progresspoints + call showseconduse + mov watchingtime,220 + mov reeltowatch,0 + mov endwatchreel,104 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + mov al,roomafterdream + mov newlocation,al + ret + + endp + + + +Chewy proc near + + call showfirstuse + call getanyad + mov byte ptr [es:bx+2],255 + mov getback,1 + ret + + endp + + + + + +Useladder proc near + + call showfirstuse + sub mapx,11 + call findroominloc + mov facing,6 + mov turntoface,6 + mov manspath,0 + mov destination,0 + mov finaldest,0 + call findxyfrompath + mov resetmanxy,1 + mov getback,1 + ret + + endp + + + + + +Useladderb proc near + + call showfirstuse + add mapx,11 + call findroominloc + mov facing,2 + mov turntoface,2 + mov manspath,1 + mov destination,1 + mov finaldest,1 + call findxyfrompath + mov resetmanxy,1 + mov getback,1 + ret + + endp + + + + + +Slabdoora proc near + + call showfirstuse + mov getback,1 + mov watchspeed,1 + mov speedcount,1 + mov reeltowatch,13 + cmp dreamnumber,3 + jnz slabawrong + inc progresspoints + mov watchingtime,60 + mov endwatchreel,42 + mov newlocation,47 + ret +slabawrong: mov watchingtime,40 + mov endwatchreel,34 + mov watchspeed,1 + mov speedcount,1 + ret + + endp + + + + +Slabdoorb proc near + + cmp dreamnumber,1 + jnz slabbwrong + mov al,"S" + mov ah,"H" + mov cl,"L" + mov ch,"D" + call isryanholding + jnz gotcrystal + mov al,44 + mov cx,200 + call showpuztext + call putbackobstuff + ret +gotcrystal: call showfirstuse + inc progresspoints + mov getback,1 + mov watchspeed,1 + mov speedcount,1 + mov reeltowatch,44 + mov watchingtime,60 + mov endwatchreel,71 + mov newlocation,47 + ret +slabbwrong: call showfirstuse + mov getback,1 + mov watchspeed,1 + mov speedcount,1 + mov reeltowatch,44 + mov watchingtime,40 + mov endwatchreel,63 + mov watchspeed,1 + mov speedcount,1 + ret + + endp + + + +Slabdoord proc near + + call showfirstuse + mov getback,1 + mov watchspeed,1 + mov speedcount,1 + mov reeltowatch,75 + cmp dreamnumber,0 + jnz slabcwrong + inc progresspoints + mov watchingtime,60 + mov endwatchreel,102 + mov newlocation,47 + ret +slabcwrong: mov watchingtime,40 + mov endwatchreel,94 + mov watchspeed,1 + mov speedcount,1 + ret + + endp + + + +Slabdoorc proc near + + call showfirstuse + mov getback,1 + mov watchspeed,1 + mov speedcount,1 + mov reeltowatch,108 + cmp dreamnumber,4 + jnz slabdwrong + inc progresspoints + mov watchingtime,60 + mov endwatchreel,135 + mov newlocation,47 + ret +slabdwrong: mov watchingtime,40 + mov endwatchreel,127 + mov watchspeed,1 + mov speedcount,1 + ret + + endp + + + +Slabdoore proc near + + call showfirstuse + mov getback,1 + mov watchspeed,1 + mov speedcount,1 + mov reeltowatch,141 + cmp dreamnumber,5 + jnz slabewrong + inc progresspoints + mov watchingtime,60 + mov endwatchreel,168 + mov newlocation,47 + ret +slabewrong: mov watchingtime,40 + mov endwatchreel,160 + mov watchspeed,1 + mov speedcount,1 + ret + + endp + + + +Slabdoorf proc near + + call showfirstuse + mov getback,1 + mov watchspeed,1 + mov speedcount,1 + mov reeltowatch,171 + cmp dreamnumber,2 + jnz slabfwrong + inc progresspoints + mov watchingtime,60 + mov endwatchreel,197 + mov newlocation,47 + ret +slabfwrong: mov watchingtime,40 + mov endwatchreel,189 + mov watchspeed,1 + mov speedcount,1 + ret + + endp + + + + + + +Useslab proc near + + cmp withobject,255 + jnz slabwith + call withwhat + ret +slabwith: mov al,withobject + mov ah,withtype + mov cl,"J" + mov ch,"E" + mov dl,"W" + mov dh,"L" + call compare + jz nextslab + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret +nextslab: mov al,withobject + call getexad + mov byte ptr [es:bx+2],0 + mov al,command + push ax + call removesetobject + pop ax + inc al + push ax + call placesetobject + pop ax + cmp al,54 + jnz notlastslab + mov al,0 + call turnpathon + mov watchingtime,22 + mov reeltowatch,35 + mov endwatchreel,48 + mov watchspeed,1 + mov speedcount,1 +notlastslab: inc progresspoints + call showfirstuse + mov getback,1 + ret + + endp + + + + + +Usecart proc near + + cmp withobject,255 + jnz cartwith + call withwhat + ret +cartwith: mov al,withobject + mov ah,withtype + mov cl,"R" + mov ch,"O" + mov dl,"C" + mov dh,"K" + call compare + jz nextcart + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret +nextcart: mov al,withobject + call getexad + mov byte ptr [es:bx+2],0 + mov al,command + push ax + call removesetobject + pop ax + inc al + call placesetobject + inc progresspoints + mov al,17 + call playchannel1 + call showfirstuse + mov getback,1 + ret + + endp + + + + + + + + +Useclearbox proc near + + cmp withobject,255 + jnz clearboxwith + call withwhat + ret +clearboxwith: mov al,withobject + mov ah,withtype + mov cl,"R" + mov ch,"A" + mov dl,"I" + mov dh,"L" + call compare + jz openbox + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +openbox: inc progresspoints + call showfirstuse + mov watchingtime,80 + mov reeltowatch,67 + mov endwatchreel,105 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret + + endp + + + + + +Usecoveredbox proc near + + inc progresspoints + call showfirstuse + mov watchingtime,50 + mov reeltowatch,41 + mov endwatchreel,66 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret + + endp + + + +Userailing proc near + + call showfirstuse + mov watchingtime,80 + mov reeltowatch,0 + mov endwatchreel,30 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + mov mandead,4 + ret + + endp + + + + + +Useopenbox proc near + + cmp withobject,255 + jnz openboxwith + call withwhat + ret +openboxwith: mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"U" + mov dl,"P" + mov dh,"F" + call compare + jz destoryopenbox + mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"U" + mov dl,"P" + mov dh,"E" + call compare + jz openboxwrong + call showfirstuse + ret + +destoryopenbox: inc progresspoints + mov cx,300 + mov al,37 + call showpuztext + mov al,withobject + call getexad + mov byte ptr [es:bx+15],"E"-"A" + mov watchingtime,140 + mov reeltowatch,105 + mov endwatchreel,181 + mov watchspeed,1 + mov speedcount,1 + mov al,4 + call turnpathon + mov getback,1 + ret + +openboxwrong: mov cx,300 + mov al,38 + call showpuztext + call putbackobstuff + ret + + endp + + + + + + + + + + + + + + +Wearwatch proc near + + cmp watchon,1 + jz wearingwatch + call showfirstuse + mov watchon,1 + mov getback,1 + call getanyad + call makeworn + ret +wearingwatch: call showseconduse + call putbackobstuff + ret + + endp + + + + +Wearshades proc near + + cmp shadeson,1 + jz wearingshades + mov shadeson,1 + call showfirstuse + mov getback,1 + call getanyad + call makeworn + ret +wearingshades: call showseconduse + call putbackobstuff + ret + + endp + + + +Sitdowninbar proc near + + cmp watchmode,-1 + jnz satdown + call showfirstuse + mov watchingtime,50 + mov reeltowatch,55 + mov endwatchreel,71 + mov reeltohold,73 + mov endofholdreel,83 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret +satdown: call showseconduse + call putbackobstuff + ret + + endp + + + +Usechurchhole proc near + + call showfirstuse + mov getback,1 + mov watchingtime,28 + mov reeltowatch,13 + mov endwatchreel,26 + mov watchspeed,1 + mov speedcount,1 + ret + + endp + + + +Usehole proc near + + cmp withobject,255 + jnz holewith + call withwhat + ret +holewith: mov al,withobject + mov ah,withtype + mov cl,"H" + mov ch,"N" + mov dl,"D" + mov dh,"A" + call compare + jz righthand + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +righthand: call showfirstuse + mov al,86 + call removesetobject + mov al,withobject + call getexad + mov byte ptr [es:bx+2],255 + mov canmovealtar,1 + mov getback,1 + ret + + endp + + + + +Usealtar proc near + + mov al,"C" + mov ah,"N" + mov cl,"D" + mov ch,"A" + call findexobject + cmp al,numexobjects + jz thingsonaltar + mov al,"C" + mov ah,"N" + mov cl,"D" + mov ch,"B" + call findexobject + cmp al,numexobjects + jz thingsonaltar + cmp canmovealtar,1 + jz movealtar + mov cx,300 + mov al,23 + call showpuztext + mov getback,1 + ret + +movealtar: inc progresspoints + call showseconduse + mov watchingtime,160 + mov reeltowatch,81 + mov endwatchreel,174 + mov watchspeed,1 + mov speedcount,1 + + mov al,47 ;message number + mov bl,52 ;x pos of message + mov bh,76 ;and y pos + mov cx,32 ;time on screen + mov dx,98 ;pause before show + call setuptimeduse + mov getback,1 + ret + +thingsonaltar: call showfirstuse + mov getback,1 + ret + + endp + + + + + + + + + +Opentvdoor proc near + + cmp withobject,255 + jnz tvdoorwith + call withwhat + ret +tvdoorwith: mov al,withobject + mov ah,withtype + mov cl,"U" + mov ch,"L" + mov dl,"O" + mov dh,"K" + call compare + jz keyontv + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +keyontv: call showfirstuse + mov lockstatus,0 + mov getback,1 + ret + + endp + + + + + + + +Usedryer proc near + + mov al,12 + call playchannel1 + call showfirstuse + mov getback,1 + ret + + endp + + + + + +Openlouis proc near + + mov al,5 + mov ah,2 + mov cl,3 + mov ch,8 + call entercode + mov getback,1 + ret + + endp + + + + +Nextcolon proc near + +lookcolon: mov al,[es:si] + inc si + cmp al,":" + jnz lookcolon + ret + + endp + + + + +Openyourneighbour proc near + + mov al,255 + mov ah,255 + mov cl,255 + mov ch,255 + call entercode + mov getback,1 + ret + + endp + + + +Usewindow proc near + + cmp manspath,6 + jnz notonbalc + inc progresspoints + call showfirstuse + mov newlocation,29 + mov getback,1 + ret +notonbalc: call showseconduse + call putbackobstuff + ret + + endp + + + +Usebalcony proc near + + call showfirstuse + mov al,6 + call turnpathon + mov al,0 + call turnpathoff + mov al,1 + call turnpathoff + mov al,2 + call turnpathoff + mov al,3 + call turnpathoff + mov al,4 + call turnpathoff + mov al,5 + call turnpathoff + inc progresspoints + mov manspath,6 + mov destination,6 + mov finaldest,6 + call findxyfrompath + call switchryanoff + mov resetmanxy,1 + + mov watchingtime,30*2 + mov reeltowatch,183 + mov endwatchreel,212 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret + + endp + + + +Openryan proc near + + mov al,5 + mov ah,1 + mov cl,0 + mov ch,6 + call entercode + mov getback,1 + ret + + endp + + + +Openpoolboss proc near + + mov al,5 + mov ah,2 + mov cl,2 + mov ch,2 + call entercode + mov getback,1 + ret + + endp + + + + +Openeden proc near + + mov al,2 + mov ah,8 + mov cl,6 + mov ch,5 + call entercode + mov getback,1 + ret + + endp + + +Opensarters proc near + + mov al,7 + mov ah,8 + mov cl,3 + mov ch,3 + call entercode + mov getback,1 + ret + + endp + + + + +Isitright proc near + + mov bx,seg presslist + mov es,bx + mov bx,offset es:presslist + cmp [es:bx+0],al + jnz notright + cmp [es:bx+1],ah + jnz notright + cmp [es:bx+2],cl + jnz notright + cmp [es:bx+3],ch +notright: ret + + endp + + + + +Drawitall proc near + + call createpanel + call drawfloor + ;call dumpallmap + call printsprites + call showicon + ret + + endp + + + + +Openhoteldoor proc near + + cmp withobject,255 + jnz hoteldoorwith + call withwhat + ret +hoteldoorwith: mov al,withobject + mov ah,withtype + mov cl,"K" + mov ch,"E" + mov dl,"Y" + mov dh,"A" + call compare + jz keyonhotel1 + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +keyonhotel1: if demo + mov al,27 + else + mov al,16 + endif + call playchannel1 + call showfirstuse + ;mov destination,1 + ;mov finaldest,1 + ;call autosetwalk + mov lockstatus,0 + mov getback,1 + ret + + endp + + + +Openhoteldoor2 proc near + + cmp withobject,255 + jnz hoteldoorwith2 + call withwhat + ret +hoteldoorwith2: mov al,withobject + mov ah,withtype + mov cl,"K" + mov ch,"E" + mov dl,"Y" + mov dh,"A" + call compare + jz keyonhotel2 + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +keyonhotel2: if demo + mov al,27 + else + mov al,16 + endif + call playchannel1 + call showfirstuse + call putbackobstuff + ret + + endp + + + + + + +Grafittidoor proc near + + cmp withobject,255 + jnz grafwith + call withwhat + ret +grafwith: mov al,withobject + mov ah,withtype + mov cl,"A" + mov ch,"P" + mov dl,"E" + mov dh,"N" + call compare + jz dograf + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +dograf: call showfirstuse + call putbackobstuff + ret + + endp + + + + + +Trapdoor proc near + + inc progresspoints + call showfirstuse + call switchryanoff + mov watchingtime,20*2 + mov reeltowatch,181 + mov endwatchreel,197 + mov newlocation,26 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret + + endp + + + + +Callhotellift proc near + + if demo + mov al,24 + else + mov al,12 + endif + call playchannel1 + call showfirstuse + mov counttoopen,8 + mov getback,1 + mov destination,5 + mov finaldest,5 + call autosetwalk + mov al,4 + call turnpathon + ret + + endp + + + + +Calledenslift proc near + + call showfirstuse + mov counttoopen,8 + mov getback,1 + mov al,2 + call turnpathon + ret + + endp + + + +Calledensdlift proc near + + cmp liftflag,1 + jz edensdhere + call showfirstuse + mov counttoopen,8 + mov getback,1 + mov al,2 + call turnpathon + ret +edensdhere: call showseconduse + call putbackobstuff + ret + + endp + + + + + + +Usepoolreader proc near + + cmp withobject,255 + jnz poolwith + call withwhat + ret +poolwith: mov al,withobject + mov ah,withtype + mov cl,"M" + mov ch,"E" + mov dl,"M" + mov dh,"B" + call compare + jz openpool + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +openpool: cmp talkedtoattendant,1 + jz canopenpool + call showseconduse + call putbackobstuff + ret + +canopenpool: mov al,17 + call playchannel1 + call showfirstuse + mov counttoopen,6 + mov getback,1 + ret + + endp + + + + + + + + + + + + + +Uselighter proc near + + cmp withobject,255 + jnz gotlighterwith + call withwhat + ret +gotlighterwith: mov al,withobject + mov ah,withtype + mov cl,"S" + mov ch,"M" + mov dl,"K" + mov dh,"E" + call compare + jz cigarette + call showfirstuse + call putbackobstuff + ret +cigarette: mov cx,300 + mov al,9 + call showpuztext + mov al,withobject + call getexad + mov byte ptr [es:bx+2],255 + mov getback,1 + ret + + endp + + + + + + + + + + + + + +Showseconduse proc near + + call getobtextstart + call nextcolon + call nextcolon + call nextcolon + call usetext + mov cx,400 + call hangonp + ret + + endp + + + + + + +Usecardreader1 proc near + + cmp withobject,255 + jnz gotreader1with + call withwhat + ret +gotreader1with: mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"S" + mov dl,"H" + mov dh,"R" + call compare + jz correctcard + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret +correctcard: cmp talkedtosparky,0 + jz notyet + cmp card1money,0 + jz getscash + mov cx,300 + mov al,17 + call showpuztext + call putbackobstuff + ret +getscash: mov al,16 + call playchannel1 + mov cx,300 + mov al,18 + call showpuztext + inc progresspoints + mov card1money,12432 + mov getback,1 + ret +notyet: call showfirstuse + call putbackobstuff + ret + + endp + + + + +Usecardreader2 proc near + + cmp withobject,255 + jnz gotreader2with + call withwhat + ret +gotreader2with: mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"S" + mov dl,"H" + mov dh,"R" + call compare + jz correctcard2 + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +correctcard2: cmp talkedtoboss,0 + jz notyetboss + cmp card1money,0 + jz nocash + cmp gunpassflag,2 + jz alreadygotnew + mov al,18 + call playchannel1 + mov cx,300 + mov al,19 + call showpuztext + mov al,94 + call placesetobject + mov gunpassflag,1 + sub card1money,2000 + inc progresspoints + mov getback,1 + ret +nocash: mov cx,300 + mov al,20 + call showpuztext + call putbackobstuff + ret +alreadygotnew: mov cx,300 + mov al,22 + call showpuztext + call putbackobstuff + ret +notyetboss: call showfirstuse + call putbackobstuff + ret + + endp + + + + + + + +Usecardreader3 proc near + + cmp withobject,255 + jnz gotreader3with + call withwhat + ret +gotreader3with: mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"S" + mov dl,"H" + mov dh,"R" + call compare + jz rightcard + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +rightcard: cmp talkedtorecep,0 + jz notyetrecep + cmp cardpassflag,0 + jnz alreadyusedit + if demo + mov al,27 + else + mov al,16 + endif + call playchannel1 + mov cx,300 + mov al,25 + call showpuztext + inc progresspoints + sub card1money,8300 + mov cardpassflag,1 + mov getback,1 + ret +alreadyusedit: mov cx,300 + mov al,26 + call showpuztext + call putbackobstuff + ret +notyetrecep: call showfirstuse + call putbackobstuff + ret + + endp + + + + + + + + +Usecashcard proc near + + call getridofreels + call loadkeypad + call createpanel + call showpanel + call showexit + call showman + + mov di,114 + if foreign + mov bx,120-3 + else + mov bx,120 + endif + mov ds,tempgraphics + mov al,39 + mov ah,0 + call showframe + + mov ax,card1money + call moneypoke + + call getobtextstart + call nextcolon + call nextcolon + + mov di,36 + mov bx,98 + mov dl,241 + mov al,0 + mov ah,0 + call printdirect + + mov di,160 + mov bx,155 + push cs + pop es + mov si,offset cs:money1poke + mov charshift,91*2+75 + mov al,0 + mov ah,0 + mov dl,240 + call printdirect + mov di,187 + mov bx,155 + push cs + pop es + mov si,offset cs:money2poke + mov charshift,91*2+85 + mov al,0 + mov ah,0 + mov dl,240 + call printdirect + mov charshift,0 + call worktoscreenm + mov cx,400 + call hangonp + call getridoftemp + call restorereels + call putbackobstuff + ret + +money1poke: db "0000",0 +money2poke: db "00",0 + + endp + + + + +Lookatcard proc near + + mov manisoffscreen,1 + call getridofreels + call loadkeypad + + call createpanel2 + mov di,160 + mov bx,80 + mov ds,tempgraphics + mov al,42 + mov ah,128 + call showframe + + call getobtextstart + call findnextcolon + call findnextcolon + call findnextcolon + mov di,36 + mov bx,124 + mov dl,241 + mov al,0 + mov ah,0 + call printdirect + + push es si + call worktoscreenm + mov cx,280 + call hangonw + call createpanel2 + mov di,160 + mov bx,80 + mov ds,tempgraphics + mov al,42 + mov ah,128 + call showframe + pop si es + + mov di,36 + mov bx,130 + mov dl,241 + mov al,0 + mov ah,0 + call printdirect + call worktoscreenm + + mov cx,200 + call hangonw + mov manisoffscreen,0 + call getridoftemp + call restorereels + call putbackobstuff + ret + + endp + + + + + +Moneypoke proc near + + mov bx,offset cs:money1poke + mov cl,48-1 +numberpoke0: inc cl + sub ax,10000 + jnc numberpoke0 + add ax,10000 + mov [cs:bx],cl + inc bx + + mov cl,48-1 +numberpoke1: inc cl + sub ax,1000 + jnc numberpoke1 + add ax,1000 + mov [cs:bx],cl + inc bx + + mov cl,48-1 +numberpoke2: inc cl + sub ax,100 + jnc numberpoke2 + add ax,100 + mov [cs:bx],cl + inc bx + + mov cl,48-1 +numberpoke3: inc cl + sub ax,10 + jnc numberpoke3 + add ax,10 + mov [cs:bx],cl + + mov bx,offset cs:money2poke + add al,48 + mov [cs:bx],al + ret + + endp + + + + + + + +Usecontrol proc near + + cmp withobject,255 + jnz gotcontrolwith + call withwhat + ret +gotcontrolwith: mov al,withobject + mov ah,withtype + mov cl,"K" + mov ch,"E" + mov dl,"Y" + mov dh,"A" + call compare + jz rightkey + cmp reallocation,21 + jnz balls + mov al,withobject + mov ah,withtype + mov cl,"K" + mov ch,"N" + mov dl,"F" + mov dh,"E" + call compare + jz jimmycontrols + mov al,withobject + mov ah,withtype + mov cl,"A" + mov ch,"X" + mov dl,"E" + mov dh,"D" + call compare + jz axeoncontrols + +balls: call showfirstuse + call putbackobstuff + ret + +rightkey: mov al,16 + call playchannel1 + cmp location,21 + jz goingdown + mov cx,300 + mov al,0 + call showpuztext + mov newlocation,21 + mov counttoclose,8 + mov counttoopen,0 + mov watchingtime,80 + mov getback,1 + ret + +goingdown: mov cx,300 + mov al,3 + call showpuztext + mov newlocation,30 + mov counttoclose,8 + mov counttoopen,0 + mov watchingtime,80 + mov getback,1 + ret + +jimmycontrols: mov al,50 + call placesetobject + mov al,51 + call placesetobject + mov al,26 + call placesetobject + mov al,30 + call placesetobject + mov al,16 + call removesetobject + mov al,17 + call removesetobject + if demo + mov al,26 + else + mov al,14 + endif + call playchannel1 + mov cx,300 + mov al,10 + call showpuztext + inc progresspoints + mov getback,1 + ret + +axeoncontrols: mov cx,300 + mov al,16 + call showpuztext + inc progresspoints + call putbackobstuff + ret + + endp + + + + + + +Usehatch proc near + + call showfirstuse + mov newlocation,40 + mov getback,1 + ret + + endp + + + + + +Usewire proc near + + cmp withobject,255 + jnz gotwirewith + call withwhat + ret +gotwirewith: mov al,withobject + mov ah,withtype + mov cl,"K" + mov ch,"N" + mov dl,"F" + mov dh,"E" + call compare + jz wireknife + mov al,withobject + mov ah,withtype + mov cl,"A" + mov ch,"X" + mov dl,"E" + mov dh,"D" + call compare + jz wireaxe + + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +wireaxe: mov cx,300 + mov al,16 + call showpuztext + call putbackobstuff + ret + +wireknife: mov al,51 + call removesetobject + mov al,52 + call placesetobject + mov cx,300 + mov al,11 + call showpuztext + inc progresspoints + mov getback,1 + ret + + endp + + + + + + + +Usehandle proc near + + mov al,"C" + mov ah,"U" + mov cl,"T" + mov ch,"W" + call findsetobject + mov al,[es:bx+58] + cmp al,255 + jnz havecutwire + mov cx,300 + mov al,12 + call showpuztext + mov getback,1 + ret + +havecutwire: mov cx,300 + mov al,13 + call showpuztext + mov newlocation,22 + mov getback,1 + ret + + endp + + + + + + + + +Useelevator1 proc near + + call showfirstuse + call selectlocation + mov getback,1 + ret + + endp + + + + + + +Showfirstuse proc near ;shows but does not delete the + ;first bit of text after the + call getobtextstart ;description + call findnextcolon + call findnextcolon + call usetext + mov cx,400 + call hangonp + ret + + endp + + + + + +Useelevator3 proc near + + call showfirstuse + mov counttoclose,20 + mov newlocation,34 + mov reeltowatch,46 + mov endwatchreel,63 + mov watchspeed,1 + mov speedcount,1 + mov watchingtime,80 ;40 + mov getback,1 + ret + + endp + + + + +Useelevator4 proc near + + call showfirstuse + mov reeltowatch,0 + mov endwatchreel,11 + mov watchspeed,1 + mov speedcount,1 + mov counttoclose,20 + mov watchingtime,80 ;40 + mov getback,1 + mov newlocation,24 + ret + + endp + + + +Useelevator2 proc near + + cmp location,23 + jz inpoolhall + call showfirstuse + mov newlocation,23 + mov counttoclose,20 + mov counttoopen,0 + mov watchingtime,80 + mov getback,1 + ret +inpoolhall: call showfirstuse + mov newlocation,31 + mov counttoclose,20 + mov counttoopen,0 + mov watchingtime,80 + mov getback,1 + ret + + endp + + + + +Useelevator5 proc near + + mov al,4 + call placesetobject + mov al,0 + call removesetobject + mov newlocation,20 + mov watchingtime,80 + mov liftflag,1 + mov counttoclose,8 + mov getback,1 + ret + + endp + + + + + +Usekey proc near + + cmp location,5 + jz usekey1 + cmp location,30 + jz usekey1 + cmp location,21 + jz usekey2 + mov cx,200 + mov al,1 + call showpuztext + call putbackobstuff + ret + +usekey1: cmp mapx,22 + jnz wrongroom1 + cmp mapy,10 + jnz wrongroom1 + mov cx,300 + mov al,0 + call showpuztext + mov counttoclose,100 + mov getback,1 + ret + +usekey2: cmp mapx,11 + jnz wrongroom1 + cmp mapy,10 + jnz wrongroom1 + mov cx,300 + mov al,3 + call showpuztext + mov newlocation,30 + mov al,2 + call fadescreendown + call showfirstuse + call putbackobstuff + ret + +wrongroom1: mov cx,200 + mov al,2 + call showpuztext + call putbackobstuff + ret + + endp + + + + + + + +Usestereo proc near + + cmp location,0 + jz stereook + mov cx,400 ;Ryan isn't in his flat. + mov al,4 + call showpuztext + call putbackobstuff + ret + +stereook: cmp mapx,11 + jnz stereonotok + cmp mapy,0 + jz stereook2 +stereonotok: mov cx,400 ;Ryan isn't in his bedroom. + mov al,5 + call showpuztext + call putbackobstuff + ret + +stereook2: mov al,"C" + mov ah,"D" + mov cl,"P" + mov ch,"L" + call findsetobject ;find object number of CD player + mov ah,1 ;searching for inside a set ob + call checkinside ;see if there is anything inside + cmp cl,numexobjects + jnz cdinside + mov al,6 ;Need a CD inside + mov cx,400 + call showpuztext + call putbackobstuff + call getanyad ;if the CD's been taken out, + mov al,255 ;make sure the player isn't still + mov [es:bx+10],al ;playing, ie:reset the puzzle + ret ;flag for the remote. + +cdinside: call getanyad + mov al,[es:bx+10] + xor al,1 + mov [es:bx+10],al + cmp al,255 + jz stereoon + mov al,7 ;The stereo works + mov cx,400 + call showpuztext + call putbackobstuff + ret + +stereoon: mov al,8 ;Stereo was already on, + mov cx,400 ;so switch it off + call showpuztext + call putbackobstuff + ret + + endp + + + + + + + + + + + + + + + +Usecooker proc near + + mov al,command + mov ah,objecttype + call checkinside ;see if there is anything inside + cmp cl,numexobjects + jnz foodinside + call showfirstuse + call putbackobstuff + ret ;flag for the remote. + +foodinside: call showseconduse + call putbackobstuff + ret + + endp + + + + + + +Useaxe proc near + + cmp reallocation,22 + jnz notinpool + cmp mapy,10 + jz axeondoor + call showseconduse + inc progresspoints + mov lastweapon,2 + mov getback,1 + call removeobfrominv + ret + +notinpool: call showfirstuse + ret + + endp + + + + + + + + +Useelvdoor proc near + + cmp withobject,255 + jnz gotdoorwith + call withwhat + ret +gotdoorwith: mov al,withobject + mov ah,withtype + mov cl,"A" + mov ch,"X" + mov dl,"E" + mov dh,"D" + call compare + jz axeondoor + mov al,14 + mov cx,300 + call showpuztext + call putbackobstuff + ret + +axeondoor: mov al,15 + mov cx,300 + call showpuztext + inc progresspoints + + mov watchingtime,46*2 + mov reeltowatch,31 + mov endwatchreel,77 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret + + endp + +;------------------------------------------------------------------------------ + +Withwhat proc near ;Gets player to identify object + ;to use selected item with. + call createpanel + call showpanel + call showman + call showexit + mov al,command + mov ah,objecttype + push cs + pop es + mov di,offset cs:commandline + call copyname + + mov di,100 + mov bx,21 + mov dl,200 + mov al,63 + mov ah,2 + call printmessage2 + + mov di,lastxpos + add di,5 + mov bx,21 + push cs + pop es + mov si,offset cs:commandline + mov dl,220 + mov al,0 + mov ah,0 + call printdirect + + mov di,lastxpos + add di,5 + mov bx,21 + mov dl,200 + mov al,63 + mov ah,3 + call printmessage2 + + call fillryan + mov commandtype,255 + call readmouse + call showpointer + call worktoscreen + call delpointer + mov invopen,2 + ret + + endp + + + + + +Selectob proc near + + call findinvpos + mov ax,[es:bx] + cmp al,255 + jnz canselectob + call blank + ret + +canselectob: mov withobject,al + mov withtype,ah + cmp ax,oldsubject + jnz diffsub3 + cmp commandtype,221 + jz alreadyselob + mov commandtype,221 + +diffsub3: mov oldsubject,ax + mov bx,ax + mov al,0 + call commandwithob +alreadyselob: mov ax,mousebutton + cmp ax,oldbutton + jz notselob + and ax,1 + jnz doselob +notselob: ret + +doselob: call delpointer + mov invopen,0 + call useroutine + ret + + endp + + + + + + + + +Compare proc near + + sub dl,"A" + sub dh,"A" + sub cl,"A" + sub ch,"A" + push cx dx + call getanyaddir + pop dx cx + cmp [es:bx+12],cx + jnz comparefin + cmp [es:bx+14],dx +comparefin: ret + + endp + + + + + + + + + + + +Findsetobject proc near ;searches set object ID's + ;for contents of ax,cx + sub al,"A" ;returns number in al and data + sub ah,"A" ;start point in es:bx + sub cl,"A" + sub ch,"A" + mov es,setdat + mov bx,0 + mov dl,0 ;dl counts object number +findsetloop: cmp al,[es:bx+12] + jnz nofind + cmp ah,[es:bx+13] + jnz nofind + cmp cl,[es:bx+14] + jnz nofind + cmp ch,[es:bx+15] + jnz nofind + mov al,dl + ret +nofind: add bx,64 + inc dl + cmp dl,128 ;number of objects to search + jnz findsetloop + mov al,dl + ret + + endp + + + + + + +Findexobject proc near ;searches ex object ID's + ;for contents of ax,cx + sub al,"A" ;returns number in al and data + sub ah,"A" ;start point in es:bx + sub cl,"A" + sub ch,"A" + mov es,extras + mov bx,exdata + mov dl,0 ;dl counts object number +findexloop: cmp al,[es:bx+12] + jnz nofindex + cmp ah,[es:bx+13] + jnz nofindex + cmp cl,[es:bx+14] + jnz nofindex + cmp ch,[es:bx+15] + jnz nofindex + mov al,dl + ret +nofindex: add bx,16 + inc dl + cmp dl,numexobjects ;number of objects to search + jnz findexloop + mov al,dl + ret + + endp + + + +Isryanholding proc near + + sub al,"A" ;returns number in al and data + sub ah,"A" ;start point in es:bx + sub cl,"A" + sub ch,"A" + mov es,extras + mov bx,exdata + mov dl,0 ;dl counts object number +searchinv: cmp byte ptr [es:bx+2],4 + jnz nofindininv + cmp al,[es:bx+12] + jnz nofindininv + cmp ah,[es:bx+13] + jnz nofindininv + cmp cl,[es:bx+14] + jnz nofindininv + cmp ch,[es:bx+15] + jnz nofindininv + mov al,dl + cmp al,numexobjects + ret +nofindininv: add bx,16 + inc dl + cmp dl,numexobjects ;number of objects to search + jnz searchinv + mov al,dl + cmp al,numexobjects ;if not zero he is holding + ret ;if zero, he is not holding + + endp + + + + +Checkinside proc near ;finds an extra object inside + ;object number al, type ah + + mov es,extras + mov bx,exdata + mov cl,0 +insideloop: cmp al,[es:bx+3] ;OI! might need to check room number!!! + jnz notfoundinside + cmp ah,[es:bx+2] + jnz notfoundinside + ret +notfoundinside: add bx,16 + inc cl + cmp cl,numexobjects + jnz insideloop + ret ;ch returns the object number + ;in the extras list + endp + + + + + + + + + + + + +Usetext proc near + + push es si + call createpanel + call showpanel + call showman + call showexit + call obicons + pop si es + + mov di,36 + mov bx,104 + mov dl,241 + mov al,0 + mov ah,0 + call printdirect + + call worktoscreenm + ret + + endp + + + + + +Putbackobstuff proc near + + call createpanel + call showpanel + call showman + call obicons + call showexit + call obpicture + call describeob + call undertextline + mov commandtype,255 + call readmouse + call showpointer + call worktoscreen + call delpointer + ret + + endp + + + + + + + +Showpuztext proc near + + push cx + call findpuztext + push es si + call createpanel + call showpanel + call showman + call showexit + call obicons + pop si es + mov di,36 + mov bx,104 + mov dl,241 + mov ah,0 + call printdirect + call worktoscreenm + pop cx + call hangonp + ret + + endp + + + +Findpuztext proc near + + mov ah,0 + mov si,ax + add si,si + mov es,puzzletext + mov ax,[es:si] + add ax,textstart + mov si,ax + ret + + endp + + + +;------------------------------------------------------------------------------- + +Placesetobject proc near + + push es bx + mov cl,0 + mov ch,0 + call findormake + call getsetad + mov byte ptr [es:bx+58],0 + pop bx es + ret + + endp + + + + +Removesetobject proc near + + push es bx + mov cl,255 + mov ch,0 + call findormake + call getsetad + mov byte ptr [es:bx+58],255 + pop bx es + ret + + endp + + + + +Issetobonmap proc near + + push es bx + call getsetad + mov al,[es:bx+58] + pop bx es + cmp al,0 + ret + + endp + + + + + + +Placefreeobject proc near + + push es bx + mov cl,0 + mov ch,1 + call findormake + call getfreead + mov byte ptr [es:bx+2],0 + pop bx es + ret + + endp + + + + + +Removefreeobject proc near + + push es bx + ;mov cl,255 + ;mov ch,1 + ;call findormake + call getfreead + mov byte ptr [es:bx+2],255 + pop bx es + ret + + endp + + + + + + + + + + +Findormake proc near + + mov bx,listofchanges + push ax + mov es,buffers + mov ah,reallocation +changeloop: cmp byte ptr [es:bx],255 + jz haventfound + cmp ax,[es:bx] + jnz nofoundchange + cmp ch,[es:bx+3] + jz foundchange +nofoundchange: add bx,4 + jmp changeloop +foundchange: pop ax + mov [es:bx+2],cl + ret +haventfound: mov [es:bx],ax + mov [es:bx+2],cx + pop ax + ret + + endp + + + + + + + + +Switchryanon proc near + + mov ryanon,255 + ret + + endp + + + + + +Switchryanoff proc near + + mov ryanon,1 + ret + + endp + + + +Setallchanges proc near + + mov es,buffers + mov bx,listofchanges +setallloop: mov ax,[es:bx] + cmp al,255 + jz endsetloop + mov cx,[es:bx+2] + add bx,4 + cmp ah,reallocation + jnz setallloop + push es bx + call dochange + pop bx es + jmp setallloop +endsetloop: ret + + endp + + + + + + +Dochange proc near + + cmp ch,0 + jz object + cmp ch,1 + jz freeobject + +path: push cx + mov ah,0 + add ax,ax + add ax,ax + add ax,ax + push ax + mov al,ch + sub al,100 + mov ah,0 + mov cx,144 + mul cx + pop bx + add bx,ax + add bx,pathdata + mov es,reels + pop cx + mov byte ptr [es:bx+6],cl +nopath: ret + +object: push cx + call getsetad + pop cx + mov [es:bx+58],cl + ret + +freeobject: push cx + call getfreead + pop cx + cmp byte ptr [es:bx+2],255 + jnz beenpickedup + mov [es:bx+2],cl +beenpickedup: ret + + endp + + + +Autoappear proc near ;places objects that appear + ;in rooms after certain + cmp location,32 ;conditions are met. + jnz notinalley + mov al,5 ;switch off travel to + call resetlocation ;hotel after kill + mov al,10 + call setlocation + mov destpos,10 + ret +notinalley: cmp reallocation,24 + jnz notinedens + cmp generaldead,1 + jnz edenspart2 + inc generaldead + mov al,44 + call placesetobject + mov al,18 + call placesetobject + mov al,93 + call placesetobject + mov al,92 + call removesetobject + mov al,55 + call removesetobject + mov al,75 + call removesetobject + mov al,84 + call removesetobject + mov al,85 + call removesetobject + ret +edenspart2: cmp sartaindead,1 + jnz notedens2 + mov al,44 + call removesetobject + mov al,93 + call removesetobject + mov al,55 + call placesetobject + inc sartaindead +notedens2: ret +notinedens: cmp reallocation,25 + jnz notonsartroof + mov newsitem,3 + mov al,6 + call resetlocation ;turn off Sartain Industries + mov al,11 + call setlocation ;turn on carpark for later + mov destpos,11 + ret +notonsartroof: cmp reallocation,2 + jnz notinlouiss + cmp rockstardead,0 + jz notinlouiss + mov al,23 + call placesetobject +notinlouiss: ret + + endp + + + + + + + + + + +;--------------------------------------------------------- Timed text stuff ---- + + + +Getundertimed proc near + + mov al,timedy + if foreign + sub al,3 + endif + mov ah,0 + mov bx,ax + mov al,timedx + mov ah,0 + mov di,ax + mov ch,undertimedysize + mov cl,240 + mov ds,buffers + mov si,undertimedtext + call multiget + ret + + endp + + + + +Putundertimed proc near + + mov al,timedy + if foreign + sub al,3 + endif + mov ah,0 + mov bx,ax + mov al,timedx + mov ah,0 + mov di,ax + mov ch,undertimedysize + mov cl,240 + mov ds,buffers + mov si,undertimedtext + call multiput + ret + + endp + + + + + + +Dumptimedtext proc near + + cmp needtodumptimed,1 + jnz nodumptimed + mov al,timedy + if foreign + sub al,3 + endif + mov ah,0 + mov bx,ax + mov al,timedx + mov ah,0 + mov di,ax + mov cl,240 + mov ch,undertimedysize + call multidump + mov needtodumptimed,0 +nodumptimed: ret + + endp + + + + + + + + +Setuptimeduse proc near + + cmp timecount,0 + jnz cantsetup + + mov timedy,bh + mov timedx,bl + mov counttotimed,cx + add dx,cx + mov timecount,dx + mov bl,al + mov bh,0 + add bx,bx + mov es,puzzletext + mov cx,textstart + mov ax,[es:bx] + add ax,cx + mov bx,ax + mov timedseg,es + mov timedoffset,bx +cantsetup: ret + + endp + + + +Setuptimedtemp proc near + + if cd + cmp ah,0 + jz notloadspeech3 + mov dl,"T" + mov dh,ah + mov cl,"T" + mov ah,0 + call loadspeech + cmp speechloaded,1 + jnz notloadspeech3 + mov al,50+12 + call playchannel1 + ret +notloadspeech3: + endif + cmp timecount,0 + jnz cantsetup2 + mov timedy,bh + mov timedx,bl + mov counttotimed,cx + add dx,cx + mov timecount,dx + mov bl,al + mov bh,0 + add bx,bx + mov es,textfile1 + mov cx,textstart + mov ax,[es:bx] + add ax,cx + mov bx,ax + mov timedseg,es + mov timedoffset,bx +cantsetup2: ret + + endp + + + + + + + +Usetimedtext proc near + + cmp timecount,0 + jz notext + dec timecount + cmp timecount,0 + jz deltimedtext + mov ax,timecount + cmp ax,counttotimed + jz firsttimed + jnc notext + jmp notfirsttimed +firsttimed: call getundertimed +notfirsttimed: mov bl,timedy + mov bh,0 + mov al,timedx + mov ah,0 + mov di,ax + mov es,timedseg + mov si,timedoffset + mov dl,237 + mov ah,0 + call printdirect + mov needtodumptimed,1 +notext: ret + +deltimedtext: call putundertimed + mov needtodumptimed,1 + ret + + endp + + + + + + + + + + + + +Edenscdplayer proc near + + call showfirstuse + mov watchingtime,18*2 + mov reeltowatch,25 + mov endwatchreel,42 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + ret + + endp + + + + + +Usewall proc near + + call showfirstuse + cmp manspath,3 + jz gobackover + mov watchingtime,30*2 + mov reeltowatch,2 + mov endwatchreel,31 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + mov al,3 + call turnpathon + mov al,4 + call turnpathon + mov al,0 + call turnpathoff + mov al,1 + call turnpathoff + mov al,2 + call turnpathoff + mov al,5 + call turnpathoff + mov manspath,3 + mov finaldest,3 + call findxyfrompath + mov resetmanxy,1 + call switchryanoff + ret +gobackover: mov watchingtime,30*2 + mov reeltowatch,34 + mov endwatchreel,60 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + mov al,3 + call turnpathoff + mov al,4 + call turnpathoff + mov al,0 + call turnpathon + mov al,1 + call turnpathon + mov al,2 + call turnpathon + mov al,5 + call turnpathon + mov manspath,5 + mov finaldest,5 + call findxyfrompath + mov resetmanxy,1 + call switchryanoff + ret + + endp + + + + + + + +Usechurchgate proc near + + cmp withobject,255 + jnz gatewith + call withwhat + ret +gatewith: mov al,withobject + mov ah,withtype + mov cl,"C" + mov ch,"U" + mov dl,"T" + mov dh,"T" + call compare + jz cutgate + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +cutgate: call showfirstuse + mov watchingtime,64*2 + mov reeltowatch,4 + mov endwatchreel,70 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + inc progresspoints + mov al,3 + call turnpathon + cmp aidedead,0 + jz notopenchurch + mov al,2 + call turnpathon +notopenchurch: ret + + endp + + + + + +Usegun proc near + + cmp objecttype,4 + jz istakengun + call showseconduse + call putbackobstuff + ret +istakengun: cmp reallocation,22 + jnz notinpoolroom + mov cx,300 + mov al,34 + call showpuztext + mov lastweapon,1 + mov combatcount,39 + mov getback,1 + inc progresspoints + ret +notinpoolroom: cmp reallocation,25 + jnz nothelicopter + mov cx,300 + mov al,34 + call showpuztext + mov lastweapon,1 + mov combatcount,19 + mov getback,1 + mov dreamnumber,2 + mov roomafterdream,38 + mov sartaindead,1 + inc progresspoints + ret +nothelicopter: cmp reallocation,27 + jnz notinrockroom + mov cx,300 + mov al,46 + call showpuztext + mov pointermode,2 ;0 + mov rockstardead,1 + mov lastweapon,1 + mov newsitem,1 + mov getback,1 + mov roomafterdream,32 ; skip + mov dreamnumber,0 + inc progresspoints + ret +notinrockroom: cmp reallocation,8 + jnz notbystudio + cmp mapx,22 + jnz notbystudio + cmp mapy,40 + jnz notbystudio + mov al,92 + call issetobonmap + jz notbystudio + cmp manspath,9 + jz notbystudio + mov destination,9 + mov finaldest,9 + call autosetwalk + mov lastweapon,1 + mov getback,1 + inc progresspoints + ret +notbystudio: cmp reallocation,6 + jnz notsarters + cmp mapx,11 + jnz notsarters + cmp mapy,20 + jnz notsarters + mov al,5 + call issetobonmap + jnz notsarters + mov destination,1 + mov finaldest,1 + call autosetwalk + mov al,5 + call removesetobject + mov al,6 + call placesetobject + mov al,1 + mov ah,roomnum + dec ah + call turnanypathon + mov liftflag,1 + mov watchingtime,40*2 + mov reeltowatch,4 + mov endwatchreel,43 + mov watchspeed,1 + mov speedcount,1 + mov getback,1 + inc progresspoints + ret +notsarters: cmp reallocation,29 + jnz notaide + mov getback,1 + mov al,13 + call resetlocation + mov al,12 + call setlocation + mov destpos,12 + mov destination,2 + mov finaldest,2 + call autosetwalk + mov watchingtime,164*2 + mov reeltowatch,3 + mov endwatchreel,164 + mov watchspeed,1 + mov speedcount,1 + mov aidedead,1 + mov dreamnumber,3 + mov roomafterdream,33 + inc progresspoints + ret +notaide: cmp reallocation,23 + jnz notwithboss + cmp mapx,0 + jnz notwithboss + cmp mapy,50 + jnz notwithboss + cmp manspath,5 + jz pathokboss + mov destination,5 + mov finaldest,5 + call autosetwalk +pathokboss: mov lastweapon,1 + mov getback,1 + ret +notwithboss: cmp reallocation,8 + jnz nottvsoldier + cmp mapx,11 + jnz nottvsoldier + cmp mapy,10 + jnz nottvsoldier + cmp manspath,2 + jz pathoktv + mov destination,2 + mov finaldest,2 + call autosetwalk +pathoktv: mov lastweapon,1 + mov getback,1 + ret +nottvsoldier: call showfirstuse + call putbackobstuff + ret + + endp + + + + + + + +Useshield proc near + + cmp reallocation,20 + jnz notinsartroom + cmp combatcount,0 + jz notinsartroom + mov lastweapon,3 + call showseconduse + mov getback,1 + inc progresspoints + call removeobfrominv + ret +notinsartroom: call showfirstuse + call putbackobstuff + ret + + endp + + + + + + +Usebuttona proc near + + mov al,95 + call issetobonmap + jz donethisbit + + call showfirstuse + mov al,0 + mov ah,roomnum + dec ah + call turnanypathon + mov al,9 + call removesetobject + mov al,95 + call placesetobject + + mov watchingtime,15*2 + mov reeltowatch,71 + mov endwatchreel,85 + mov watchspeed,1 + mov speedcount,1 + + mov getback,1 + inc progresspoints + ret +donethisbit: call showseconduse + call putbackobstuff + ret + + endp + + + + +Useplate proc near + + cmp withobject,255 + jnz platewith + call withwhat + ret +platewith: mov al,withobject + mov ah,withtype + mov cl,"S" + mov ch,"C" + mov dl,"R" + mov dh,"W" + call compare + jz unscrewplate + mov al,withobject + mov ah,withtype + mov cl,"K" + mov ch,"N" + mov dl,"F" + mov dh,"E" + call compare + jz triedknife + mov cx,300 + mov al,14 + call showpuztext + call putbackobstuff + ret + +unscrewplate: mov al,20 + call playchannel1 + call showfirstuse + mov al,28 + call placesetobject + mov al,24 + call placesetobject + mov al,25 + call removesetobject + mov al,0 + call placefreeobject + inc progresspoints + mov getback,1 + ret + +triedknife: mov cx,300 + mov al,54 + call showpuztext + call putbackobstuff + ret + + endp + + + + + +Usewinch proc near + + mov al,40 + mov ah,1 + call checkinside + cmp cl,numexobjects + jz nowinch + mov al,cl + mov ah,4 + mov cl,"F" + mov ch,"U" + mov dl,"S" + mov dh,"E" + call compare + jnz nowinch + + mov watchingtime,217*2 + mov reeltowatch,0 + mov endwatchreel,217 + mov watchspeed,1 + mov speedcount,1 + mov destpos,1 + mov newlocation,45 + mov dreamnumber,1 + mov roomafterdream,44 + mov generaldead,1 + mov newsitem,2 + mov getback,1 + inc progresspoints + ret + +nowinch: call showfirstuse + call putbackobstuff + ret + + endp + + + + + + + + + + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/vars.asm b/devtools/tasmrecover/dreamweb/vars.asm new file mode 100644 index 0000000000..b72f180d74 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/vars.asm @@ -0,0 +1,564 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +;---------------------------------------------------Equates and definitions---- + +Inputport equ 63h +Mapwidth equ 66 ;132/2 +Maplength equ 60 ;6/2 +Tablesize equ 32 ;size of each entry in spritetable +Itempicsize equ 44 ;size of inventory slots +Opsy equ 52 +Opsx equ 60 +Inventx equ 80 +Inventy equ 58 +Zoomx equ 8 +Zoomy equ 132 +Keypadx equ 36+112 +Keypady equ 72 +Diaryx equ 68+24 +Diaryy equ 48+12 +Symbolx equ 64 +Symboly equ 56 +Menux equ 80+40 +Menuy equ 60 + + if foreign +Undertextsizex equ 228 +Undertextsizey equ 13 +Undertimedysize equ 30 + else +Undertextsizex equ 180 +Undertextsizey equ 10 +Undertimedysize equ 24 + endif + +Numchanges equ 250 + +Textunder equ 0 ;offsets for items in buffer segment +Openinvlist equ textunder+(undertextsizex*undertextsizey) +Ryaninvlist equ openinvlist+32 +Pointerback equ ryaninvlist+60 +Mapflags equ pointerback+(32*32) +Startpal equ mapflags+(11*10*3) +Endpal equ startpal+768 +Maingamepal equ endpal+768 +Spritetable equ maingamepal+768 +Setlist equ spritetable+(32*tablesize) +Freelist equ setlist+(128*5) +Exlist equ freelist+(80*5) +Peoplelist equ exlist+(100*5) +Zoomspace equ peoplelist+(12*5) +Printedlist equ zoomspace+(46*40) +Listofchanges equ printedlist+(5*80) +Undertimedtext equ listofchanges+(numchanges*4) +Rainlist equ undertimedtext+(256*undertimedysize) +Initialreelrouts equ rainlist+(6*64) +Initialvars equ initialreelrouts+lenofreelrouts +Lengthofbuffer equ initialvars+lengthofvars + +Flags equ 0 ;offsets of items in backdrop segment +Blocks equ flags+192 +Map equ 0 +Lengthofmap equ map+(mapwidth*maplength) + +Intextdat equ 0 +Intext equ intextdat+(38*2) +Blocktextdat equ 0 +Blocktext equ blocktextdat+(98*2) +Settextdat equ 0 +Settext equ settextdat+(130*2) +Freetextdat equ 0 +Freetext equ freetextdat+(82*2) + +Numexobjects equ 114 +Exframeslen equ 30000 +Extextlen equ 18000 + +Exframedata equ 0 +Exframes equ exframedata+2080 +Exdata equ exframes+exframeslen +Extextdat equ exdata+(16*numexobjects) +Extext equ extextdat+((numexobjects+2)*2) +Lengthofextra equ extext+extextlen + +Framedata equ 0 +Frames equ framedata+2080 + +Frframedata equ 0 +Frframes equ frframedata+2080 + +Personframes equ 0 +Persontxtdat equ personframes+24 +Persontext equ persontxtdat+(1026*2) + +Pathdata equ 0 +Reellist equ pathdata+(36*144) + +Lenofmapstore equ 22*8*20*8 +Maplen equ mapwidth*maplength +Freedatlen equ 16*80 +Setdatlen equ 64*128 +Textstart equ 66*2 + +;-----------------------------------------------------------------Variables---- + + +startvars db 0 +progresspoints db 0 +watchon db 0 +shadeson db 0 +secondcount db 0 +minutecount db 30 +hourcount db 19 +zoomon db 1 +location db 0 +expos db 0 +exframepos dw 0 +extextpos dw 0 +card1money dw 0 +listpos dw 0 +ryanpage db 0 + + +watchingtime dw 0 +reeltowatch dw -1 ;reel plays from here in mode 0 +endwatchreel dw 0 ;and stops here. Mode set to 1 +speedcount db 0 +watchspeed db 0 +reeltohold dw -1 ;if mode is 1 hold on this reel +endofholdreel dw -1 ;if mode is 2 then play to end of +watchmode db -1 ;hold reel. Set mode back to -1 +destafterhold db 0 ;set walking destination. + +newsitem db 0 + +liftflag db 0 +liftpath db 0 +lockstatus db 1 +doorpath db 0 +counttoopen db 0 +counttoclose db 0 +rockstardead db 0 +generaldead db 0 +sartaindead db 0 +aidedead db 0 +beenmugged db 0 + +gunpassflag db 0 +canmovealtar db 0 +talkedtoattendant db 0 +talkedtosparky db 0 +talkedtoboss db 0 +talkedtorecep db 0 +cardpassflag db 0 +madmanflag db 0 +keeperflag db 0 +lasttrigger db 0 +mandead db 0 +seed db 1,2,3 +needtotravel db 0 +throughdoor db 0 +newobs db 0 +ryanon db 255 +combatcount db 0 +lastweapon db -1 + +dreamnumber db 0 +roomafterdream db 0 + +shakecounter db 48 + +lengthofvars equ $-startvars + + +speechcount db 0 + +charshift dw 0 +kerning db 0 + +brightness db 0 + +roomloaded db 0 + +didzoom db 0 + +linespacing dw 10 +textaddressx dw 13 +textaddressy dw 182 ;address on screen for text +textlen db 0 +lastxpos dw 0 + +icontop dw 0 +iconleft dw 0 +itemframe db 0 +itemtotran db 0 +roomad dw 0 +oldsubject dw 0 + +withobject db 0 +withtype db 0 + +lookcounter dw 0 + +command db 0 +commandtype db 0 +oldcommandtype db 0 +objecttype db 0 +getback db 0 +invopen db 0 +mainmode db 0 +pickup db 0 +lastinvpos db 0 +examagain db 0 +newtextline db 0 + +openedob db 0 +openedtype db 0 + +oldmapadx dw 0 +oldmapady dw 0 +mapadx dw 0 +mapady dw 0 +mapoffsetx dw 104 +mapoffsety dw 38 + +mapxstart dw 0 +mapystart dw 0 +mapxsize db 0 +mapysize db 0 + +havedoneobs db 0 +manisoffscreen db 0 +rainspace db 0 + +facing db 0 +leavedirection db 0 +turntoface db 0 +turndirection db 0 + +maintimer dw 0 +introcount db 0 +arrowad dw 0 +currentkey db 0 +oldkey db 0 +useddirection db 0 +currentkey2 db 0 + +timercount db 0 +oldtimercount db 0 + +mapx db 0 +mapy db 0 +newscreen db 0 +ryanx db 0 +ryany db 0 +lastflag db 0 +lastflagex db 0 +flagx db 0 +flagy db 0 + +currentex db 0 +currentfree db 0 +currentframe dw 0 +framesad dw 0 +dataad dw 0 +frsegment dw 0 +objectx dw 0 +objecty dw 0 +offsetx dw 0 +offsety dw 0 +savesize dw 0 +savesource dw 0 +savex db 0 +savey db 0 +currentob db 0 +priority db 0 + +destpos db 0 + +reallocation db 0 ;----------;some rooms have more than one +roomnum db 0 ;place in the Roomdata list, to + ;account for different start points +nowinnewroom db 0 ;this variable holds the rooms +resetmanxy db 0 ;real value - ie:which file it's in +newlocation db -1 ;if set then room is loaded at end of watch mode, or straight away if not in watch mode +autolocation db -1 +mustload db 0 +answered db 0 +saidno db 0 + +doorcheck1 db 0 +doorcheck2 db 0 +doorcheck3 db 0 +doorcheck4 db 0 + +mousex dw 0 +mousey dw 0 +mousebutton dw 0 +mousebutton1 dw 0 +mousebutton2 dw 0 +mousebutton3 dw 0 +mousebutton4 dw 0 +oldbutton dw 0 +oldx dw 0 +oldy dw 0 +lastbutton dw 0 +oldpointerx dw 0 +oldpointery dw 0 +delherex dw 0 +delherey dw 0 +pointerxs db 32 +pointerys db 32 +delxs db 0 +delys db 0 +pointerframe db 0 +pointerpower db 0 +auxpointerframe db 0 +pointermode db 0 +pointerspeed db 0 +pointercount db 0 +inmaparea db 0 + +reelpointer dw 0 +slotdata db 0 +thisslot db 0 +slotflags db 0 +takeoff dw 0 + +talkmode db 0 +talkpos db 0 +character db 0 +persondata dw 0 +talknum db 0 +numberinroom db 0 + +currentcel db 0 +oldselection db 0 + +stopwalking db 0 + +mouseon db 0 +played dw 0 +timer1 db 0 +timer2 db 0 +timer3 db 0 +wholetimer dw 0 +timer1to db 0 +timer2to db 0 +timer3to db 0 + +watchdump db 0 + +currentset dw 0 + +logonum db 0 +oldlogonum db 0 +newlogonum db 0 +netseg dw 0 +netpoint dw 0 +keynum db 0 +cursorstate db 0 + +pressed db 0 +presspointer dw 0 +graphicpress db 0 +presscount db 0 +keypadax dw 0 +keypadcx dw 0 +lightcount db 0 +folderpage db 0 +diarypage db 0 +menucount db 0 +symboltopx db 0 +symboltopnum db 0 +symboltopdir db 0 +symbolbotx db 0 +symbolbotnum db 0 +symbolbotdir db 0 + +symboltolight db 0 +symbol1 db 0 +symbol2 db 0 +symbol3 db 0 +symbolnum db 0 +dumpx dw 0 +dumpy dw 0 + +walkandexam db 0 +walkexamtype db 0 +walkexamnum db 0 + +cursloc dw 0 +curslocx dw 0 +curslocy dw 0 +curpos dw 0 +monadx dw 0 +monady dw 0 +gotfrom dw 0 + +monsource dw 0 +numtodo dw 0 + +timecount dw 0 +counttotimed dw 0 +timedseg dw 0 +timedoffset dw 0 +timedy db 0 +timedx db 0 +needtodumptimed db 0 + +;recordpos dw 0 +;rechandle dw 0 +handle dw 0 + +loadingorsave db 0 ;1 if load 2 if save +currentslot db 0 +cursorpos db 0 + +colourpos db 0 +fadedirection db 0 +numtofade db 0 +fadecount db 0 +addtogreen db 0 +addtored db 0 +addtoblue db 0 + + +lastsoundreel dw 0 + +soundbuffer dw 0 +soundbufferad dw 0 +soundbufferpage db 0 +soundtimes db 0 +needsoundbuff db 0 + +oldint9seg dw -1 +oldint9add dw -1 +oldint8seg dw -1 +oldint8add dw -1 +oldsoundintseg dw 0 +oldsoundintadd dw 0 +soundbaseadd dw 0 +dsp_status dw 0 +dsp_write dw 0 +dmaaddress db 0 +soundint db 5 +sounddmachannel db 1 +sampleplaying db 255 +testresult db 0 +currentirq db 0 +speechloaded db 0 +speechlength dw 0 +volume db 0 +volumeto db 0 +volumedirection db 0 +volumecount db 0 + +playblock db 0 + +wongame db 0 + +lasthardkey db 0 +bufferin dw 0 +bufferout dw 0 + +extras dw 0 ;for allocated memory +workspace dw 0 ;allocated mem for screen buffer +mapstore dw 0 ;allocated mem for copy of room +charset1 dw 0 ;allocated mem for normal charset +tempcharset dw 0 ;monitor char set +icons1 dw 0 ;allocated mem for on screen stuff +icons2 dw 0 +buffers dw 0 ;allocated mem for buffers +mainsprites dw 0 ;allocated mem for Ryan sprites +backdrop dw 0 +mapdata dw 0 + +sounddata dw 0 +sounddata2 dw 0 + +recordspace dw 0 + +freedat dw 0 +setdat dw 0 + +reel1 dw -1 +reel2 dw -1 +reel3 dw -1 +roomdesc dw -1 +freedesc dw -1 +setdesc dw -1 +blockdesc dw -1 +setframes dw -1 +freeframes dw -1 +people dw -1 +reels dw -1 +commandtext dw -1 +puzzletext dw -1 +traveltext dw -1 +tempgraphics dw -1 +tempgraphics2 dw -1 +tempgraphics3 dw -1 +tempsprites dw -1 + +textfile1 dw -1 +textfile2 dw -1 +textfile3 dw -1 + +blinkframe db 23 +blinkcount db 0 + + +reasseschanges db 0 ; if it's a 1 then obname will assume that +pointerspath db 0 ;the command has changed. +manspath db 0 ;ie. from "walk to" to "Examine" +pointerfirstpath db 0 +finaldest db 0 +destination db 0 +linestartx dw 0 +linestarty dw 0 +lineendx dw 0 +lineendy dw 0 +increment1 dw 0 +increment2 dw 0 +lineroutine db 0 +linepointer db 0 +linedirection db 0 +linelength db 0 + +liftsoundcount db 0 + +emmhandle dw 0 +emmpageframe dw 0 +emmhardwarepage db 0 + +ch0emmpage dw 0 +ch0offset dw 0 +ch0blockstocopy dw 0 + +ch0playing db 0 +ch0repeat db 0 +ch0oldemmpage dw 0 +ch0oldoffset dw 0 +ch0oldblockstocopy dw 0 + +ch1playing db 255 +ch1emmpage dw 0 +ch1offset dw 0 +ch1blockstocopy dw 0 +ch1blocksplayed dw 0 + +soundbufferwrite dw 0 + +soundemmpage dw 0 +speechemmpage dw 0 + +currentsample db -1 +roomssample db 0 + +gameerror db 0 + +howmuchalloc dw 0 + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/vgafades.asm b/devtools/tasmrecover/dreamweb/vgafades.asm new file mode 100644 index 0000000000..e4a5b97c45 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/vgafades.asm @@ -0,0 +1,867 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +Fadedos proc near + + call vsync + mov es,buffers + mov di,startpal + mov al,0 + mov dx,3c7h + out dx,al + mov dx,3c9h + mov cx,768/4 +dos1: in al,dx + stosb + loop dos1 + + mov cx,64 +fadedosloop: push cx + + mov ds,buffers + mov si,startpal + mov cx,768 +dos3: lodsb + cmp al,0 + jz nodown + dec al +nodown: mov [si-1],al + loop dos3 + + call vsync + mov ds,buffers + mov si,startpal + mov al,0 + mov dx,3c8h + out dx,al + inc dx + mov cx,768/4 +dos2: lodsb + out dx,al + loop dos2 + + pop cx + loop fadedosloop + ret + + endp + + + + + + + + + + + +Dofade proc near + + cmp fadedirection,0 + jz finishfade + mov cl,numtofade + mov ch,0 + mov al,colourpos + mov ah,0 + mov ds,buffers + mov si,startpal + add si,ax + add si,ax + add si,ax + call showgroup + mov al,numtofade + add al,colourpos + mov colourpos,al + cmp al,0 + jnz finishfade + call fadecalculation +finishfade: ret + + endp + + + + + + + +Clearendpal proc near + + mov es,buffers + mov di,endpal + mov cx,768 + mov al,0 + rep stosb + ret + + endp + + + + +Clearpalette proc near + + mov fadedirection,0 + call clearstartpal + call dumpcurrent + ret + + endp + + + + + + + + + + +Fadescreenup proc near + + call clearstartpal + call paltoendpal + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + ret + + endp + + + + +Fadetowhite proc near + + mov es,buffers + mov di,endpal + mov cx,768 + mov al,63 + rep stosb + mov di,endpal + mov al,0 + stosb + stosb + stosb + call paltostartpal + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + ret + + endp + + + +Fadefromwhite proc near + + mov es,buffers + mov di,startpal + mov cx,768 + mov al,63 + rep stosb + mov di,startpal + mov al,0 + stosb + stosb + stosb + call paltoendpal + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + ret + + endp + + + + + + + + + +Fadescreenups proc near + + call clearstartpal + call paltoendpal + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,64 + ret + + endp + + + +Fadescreendownhalf proc near + + call paltostartpal + call paltoendpal + mov cx,768 + mov es,buffers + mov bx,endpal +halfend: mov al,[es:bx] + shr al,1 + mov [es:bx],al + inc bx + loop halfend + + mov ds,buffers + mov es,buffers + mov si,startpal+(56*3) + mov di,endpal+(56*3) + mov cx,3*5 + rep movsb + mov si,startpal+(77*3) + mov di,endpal+(77*3) + mov cx,3*2 + rep movsb + + mov fadedirection,1 + mov fadecount,31 + mov colourpos,0 + mov numtofade,32 + ret + + endp + + +Fadescreenuphalf proc near + + call endpaltostart + call paltoendpal + mov fadedirection,1 + mov fadecount,31 + mov colourpos,0 + mov numtofade,32 + ret + + endp + + + + + + + + + + +Fadescreendown proc near + + call paltostartpal + call clearendpal + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + ret + + endp + + + +Fadescreendowns proc near + + call paltostartpal + call clearendpal + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,64 + ret + + endp + + + + + + + + +Clearstartpal proc near + + mov es,buffers + mov di,startpal + mov cx,256 +wholeloop1: mov ax,0 + stosw + mov al,0 + stosb + loop wholeloop1 + ret + + endp + + + + + + +Showgun proc near + + mov addtored,0 ;12 + mov addtogreen,0 + mov addtoblue,0 + call paltostartpal + call paltoendpal + call greyscalesum + +; mov es,buffers +; mov di,endpal+3 +; mov cx,255 +; mov ax,0 +;reds: mov byte ptr [es:di],63 +; inc di +; stosw +; loop reds + + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + mov cx,130 + call hangon + call endpaltostart + call clearendpal + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + mov cx,200 + call hangon + mov roomssample,34 + call loadroomssample + mov volume,0 + mov dx,offset cs:gungraphic + call loadintotemp + call createpanel2 + mov ds,tempgraphics + mov al,0 + mov ah,0 + mov di,100 + mov bx,4 + call showframe + mov ds,tempgraphics + mov al,1 + mov ah,0 + mov di,158 + mov bx,106 + call showframe + call worktoscreen + call getridoftemp + call fadescreenup + mov cx,160 + call hangon + mov al,12 + mov ah,0 + call playchannel0 + mov dx,offset cs:endtextname + call loadtemptext + call rollendcredits2 + call getridoftemptext + ret + + endp + + + + + +Rollendcredits2 proc near + + call rollem + ret + + endp + + + + +Rollem proc near + + mov cl,160 + mov ch,160 + mov di,25 + mov bx,20 + mov ds,mapstore + mov si,0 + call multiget + + mov es,textfile1 + mov si,49*2 + mov ax,[es:si] + mov si,ax + add si,textstart + + mov cx,80 +endcredits21: push cx + + mov bx,10 + mov cx,linespacing +endcredits22: push cx si di es bx + + call vsync + mov cl,160 + mov ch,160 + mov di,25 + mov bx,20 + mov ds,mapstore + mov si,0 + call multiput + call vsync + pop bx es di si + push si di es bx + + mov cx,18 +onelot2: push cx + mov di,25 ;75 + mov dx,161 + mov ax,0 + call printdirect + add bx,linespacing + pop cx + loop onelot2 + + call vsync + mov cl,160 + mov ch,160 + mov di,25 ;75 + mov bx,20 + call multidump + + pop bx es di si cx + cmp lasthardkey,1 + jz endearly2 + dec bx + loop endcredits22 + pop cx +looknext2: mov al,[es:si] + inc si + cmp al,":" + jz gotnext2 + cmp al,0 + jz gotnext2 + jmp looknext2 +gotnext2: cmp lasthardkey,1 + jz endearly + loop endcredits21 + + mov cx,120 + call hangone + ret +endearly2: pop cx +endearly: ret + + endp + + + + + + + + + +Fadecalculation proc near + + cmp fadecount,0 + jz nomorefading + mov bl,fadecount + mov es,buffers + mov si,startpal + mov di,endpal + mov cx,768 +fadecolloop: mov al,[es:si] + mov ah,[es:di] + cmp al,ah + jz gotthere + jc lesscolour + dec byte ptr [es:si] + jmp gotthere +lesscolour: cmp bl,ah + jz withit + jnc gotthere +withit: inc byte ptr [es:si] +gotthere: inc si + inc di + loop fadecolloop + dec fadecount + ret +nomorefading: mov fadedirection,0 + ret + + endp + + + + + + + + + + + + + + + + + + + + + + + + +Greyscalesum proc near ;converts palette to grey scale + ;summed using formula: + mov es,buffers ; .20xred + .59xGreen + .11xBlue + mov si,maingamepal + mov di,endpal + mov cx,256 ;convert 256 colours + +greysumloop1: push cx + mov bx,0 + mov al,[es:si] + mov ah,0 + mov cx,20 + mul cx + add bx,ax + mov al,[es:si+1] + mov ah,0 + mov cx,59 + mul cx + add bx,ax + mov al,[es:si+2] + mov ah,0 + mov cx,11 + mul cx + add bx,ax ;bx holds equationx100 + + mov al,-1 ;divide result by 100 +greysumloop2: inc al + sub bx,100 + jnc greysumloop2 ;ah holds grey scale number + mov bl,al + + mov al,bl + mov ah,addtored + cmp al,0 + ;jz noaddr + add al,ah +noaddr: stosb + mov ah,addtogreen + mov al,bl + cmp al,0 + jz noaddg + add al,ah +noaddg: stosb ;store result in red, green and + mov ah,addtoblue + mov al,bl + cmp al,0 + jz noaddb + add al,ah +noaddb: stosb ;blue portions of palette. + + add si,3 + pop cx + loop greysumloop1 + ret + + endp + + + + + + + + + + + + + + + + + + + + + + +Showgroup proc near + + mov dx,3c8h + out dx,al + mov dx,3c9h +showgroup1: lodsb + out dx,al + lodsb + out dx,al + lodsb + out dx,al + loop showgroup1 + ret + + endp + + + + + +Paltostartpal proc near + + mov es,buffers + mov ds,buffers + mov si,maingamepal + mov di,startpal + mov cx,768/2 + rep movsw + ret + + endp + + + +Endpaltostart proc near + + mov es,buffers + mov ds,buffers + mov si,endpal + mov di,startpal + mov cx,768/2 + rep movsw + ret + + endp + + +Startpaltoend proc near + + mov es,buffers + mov ds,buffers + mov di,endpal + mov si,startpal + mov cx,768/2 + rep movsw + ret + + endp + + + + + + + + +Paltoendpal proc near + + mov es,buffers + mov ds,buffers + mov di,endpal + mov si,maingamepal + mov cx,768/2 + rep movsw + ret + + endp + + + + + + + + + + + + + +Allpalette proc near + + mov es,buffers + mov ds,buffers + mov di,startpal + mov si,maingamepal + mov cx,768/2 + rep movsw + call dumpcurrent + ret + + endp + + + + + +Dumpcurrent proc near + + mov si,startpal + mov ds,buffers + call vsync + mov al,0 + mov cx,128 + call showgroup + call vsync + mov al,128 + mov cx,128 + call showgroup + ret + + endp + + + + + + + + + + + +Fadedownmon proc near + + call paltostartpal + call paltoendpal + mov es,buffers + mov di,endpal+(231*3) + mov cx,3*8 + mov ax,0 + rep stosb + mov di,endpal+(246*3) + stosb + stosw + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + mov cx,64 ;100 + call hangon ;curs + ret + + endp + + + + + +Fadeupmon proc near + + call paltostartpal + call paltoendpal + mov es,buffers + mov di,startpal+(231*3) + mov cx,3*8 + mov ax,0 + rep stosb + mov di,startpal+(246*3) + stosb + stosw + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + mov cx,128 + call hangon ;curs + ret + + endp + + + + + +Fadeupmonfirst proc near + + call paltostartpal + call paltoendpal + mov es,buffers + mov di,startpal+(231*3) + mov cx,3*8 + mov ax,0 + rep stosb + mov di,startpal+(246*3) + stosb + stosw + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + mov cx,64 + call hangon + mov al,26 + call playchannel1 + mov cx,64 + call hangon + + ret + + endp + + + + + + + +Fadeupyellows proc near + + ;call startpaltoend + call paltoendpal + mov es,buffers + mov di,endpal+(231*3) + mov cx,3*8 + mov ax,0 + rep stosb + mov di,endpal+(246*3) + stosb + stosw + mov fadedirection,1 + mov fadecount,63 + mov colourpos,0 + mov numtofade,128 + mov cx,128 + call hangon + ret + + endp + + + +Initialmoncols proc near + + call paltostartpal + mov es,buffers + mov di,startpal+(230*3) + mov cx,3*9 + mov ax,0 + rep stosb + mov di,startpal+(246*3) + stosb + stosw + mov ds,buffers + mov si,startpal+(230*3) + mov al,230 + mov cx,18 + call showgroup + ret + + endp + + + \ No newline at end of file diff --git a/devtools/tasmrecover/dreamweb/vgagrafx.asm b/devtools/tasmrecover/dreamweb/vgagrafx.asm new file mode 100644 index 0000000000..4c89412952 --- /dev/null +++ b/devtools/tasmrecover/dreamweb/vgagrafx.asm @@ -0,0 +1,1763 @@ +;Copyright (c) 1990-2011 by Neil Dodwell +;Released with permission from Neil Dodwell under GPLv2 +;See LICENSE file for full license text +Screenwidth equ 320 ;physical width of screen + + + +Allocatework proc near + + mov bx,1000h + call allocatemem + mov workspace,ax + ret + + endp + + + + + +Showpcx proc near + + call openfile + mov bx,handle + mov ds,workspace + mov ah,3fh + mov cx,128 + mov dx,0 + int 21h + + mov ds,workspace + mov si,16 + mov cx,48 + mov es,buffers + mov di,maingamepal +pcxpal: push cx + call readabyte + shr al,1 + shr al,1 + stosb + pop cx + loop pcxpal + mov cx,768-48 + mov ax,0ffffh + rep stosw + + call readoneblock + mov si,0 + mov di,0 + mov cx,480 +convertpcx: push cx + push di + mov ds,workspace + mov es,buffers + mov di,pointerback + mov bx,0 +sameline: call readabyte + mov ah,al + and ah,11000000b + cmp ah,11000000b + jnz normal + mov cl,al + and cl,00111111b + mov ch,0 + push cx + call readabyte + pop cx + add bx,cx + rep stosb + cmp bx,4*80 + jnz sameline + jmp endline +normal: stosb + inc bx + cmp bx,4*80 + jnz sameline + +endline: pop di + push si + mov dx,0a000h + mov es,dx + mov si,pointerback + mov ds,buffers + + mov dx,03c4h + mov al,2 + mov ah,1 + out dx,ax + mov cx,40 + push di + rep movsw + pop di + mov ah,2 + out dx,ax + mov cx,40 + push di + rep movsw + pop di + mov ah,4 + out dx,ax + mov cx,40 + push di + rep movsw + pop di + mov ah,8 + out dx,ax + mov cx,40 + rep movsw + + pop si + pop cx + loop convertpcx + + mov bx,handle + call closefile + ret + + endp + + + + +Readabyte proc near + + cmp si,30000 + jnz notendblock + push bx es di ds si + call readoneblock + pop si ds di es bx + mov si,0 +notendblock: lodsb + ret + + endp + + + + +Readoneblock proc near + + mov bx,handle + mov ah,3fh + mov ds,workspace + mov ah,3fh + mov cx,30000 + mov dx,0 + int 21h + ret + + endp + + + + + + + + +Loadpalfromiff proc near + + mov dx,offset cs:palettescreen + call openfile + mov cx,2000 + mov ds,mapstore + mov dx,0 + call readfromfile + call closefile + mov es,buffers + mov di,maingamepal + mov ds,mapstore + mov si,30h + mov cx,768 +palloop: lodsb + shr al,1 + shr al,1 + + cmp brightness,1 + jnz nought + cmp al,0 + jz nought + mov ah,al + shr ah,1 + add al,ah + shr ah,1 + add al,ah + cmp al,64 + jc nought + mov al,63 + +nought: stosb + loop palloop + ret + + endp + + + + + + +Setmode proc near + + call vsync + mov ah,12h + mov al,1 + mov bl,33h + int 10h + + mov ah,0 + mov al,13h + int 10h + + mov al,6 ; sets graphic controller + mov dx,3ceh ; register 6 (MM) to 1 - 64K + out dx,al + inc dx + in al,dx + and al,11110011b + or al,00000100b + out dx,al + + mov al,4 ; sets sequencer + mov dx,3c4h ; register 4 (EM) to 1 - >64K + out dx,al + inc dx + in al,dx + and al,11111101b + or al,00000010b + out dx,al + + mov al,13h ;give screen 16 extra hidden + mov dx,3d4h ;pixels at one side + out dx,al + inc dx + mov al,screenwidth/8 ; width of screen + out dx,al + + mov al,8h + mov dx,3d4h + out dx,al + inc dx + mov al,00000000b + out dx,al + + mov al,11h + mov dx,3d4h + out dx,al + inc dx + in al,dx + or al,128 + out dx,al + + mov al,00 + mov dx,3d4h + out dx,al + inc dx + mov al,3fh + out dx,al + mov al,01 + mov dx,3d4h + out dx,al + inc dx + mov al,3fh + out dx,al + ret + + endp + + + +Cls proc near + + mov ax,0a000h + mov es,ax + mov di,0 + mov cx,7fffh + mov ax,0 + rep stosw + ret + + endp + + + +Printundermon proc near ;prints workspace through the text + + mov si,(screenwidth*43)+76 + mov di,si + mov es,workspace + add si,8*screenwidth + mov dx,0a000h + mov ds,dx + mov cx,104 +scrollmonloop1: push cx di si + mov cx,170 +scrollmonloop2: lodsb + cmp al,231 + jnc dontplace +placeit: stosb + loop scrollmonloop2 + jmp finmonscroll +dontplace: inc di + loop scrollmonloop2 + +finmonscroll: pop si di cx + add si,screenwidth + add di,screenwidth + loop scrollmonloop1 + ret + + endp + + + + + + + + +Worktoscreen proc near + + call vsync + mov si,0 + mov di,0 + mov cx,25 + mov ds,workspace + mov dx,0a000h + mov es,dx + +dumpallloop: call width160 + call width160 + call width160 + call width160 + call width160 + call width160 + call width160 + call width160 + loop dumpallloop + + ret + + endp + + + + + + + + + +; +;Worktoscreen2 proc near +; +; call showpointer +; +; mov ds,workspace +; mov dx,0a000h +; mov es,dx +; +; mov si,320-16 +; mov di,320-16 +; mov bl,33 +; mov cx,16 +;screen2loop1: push di si cx +; call vsync +; cmp bl,21 +; jc screen2loop2 +; sub cx,16 +; jz isoneblock +;screen2loop2: movsw +; movsw +; movsw +; movsw +; movsw +; movsw +; movsw +; movsw +; add di,320-15 +; add si,320-15 +; loop screen2loop2 +;isoneblock: mov cx,16 +; mov ax,320-15 +;oneblockloop: push cx +; rep movsb +; pop cx +; add si,ax +; add di,ax +; inc ax +; loop oneblockloop +; +; pop cx si di +; add cx,16 +; cmp cx,200 +; jc itsallright +; mov cx,200 +;itsallright: sub si,16 +; sub di,16 +; dec bl +; jnz screen2loop1 +; +; call delpointer +; ret +; +; endp +; +; +; +; + + + + +Paneltomap proc near + + mov di,mapxstart + add di,mapadx + mov bx,mapystart + add bx,mapady + mov ds,mapstore + mov si,0 + mov cl,mapxsize + mov ch,mapysize + call multiget + ret + + endp + + + +Maptopanel proc near + + mov di,mapxstart + add di,mapadx + mov bx,mapystart + add bx,mapady + mov ds,mapstore + mov si,0 + mov cl,mapxsize + mov ch,mapysize + call multiput + + ret + + endp + + + + + +Dumpmap proc near + + mov di,mapxstart + add di,mapadx + mov bx,mapystart + add bx,mapady + mov cl,mapxsize + mov ch,mapysize + call multidump + ret + + endp + + + + +Pixelcheckset proc near ;al=x, ah=y, es:bx=setlist pos + ;checks exact pixel in a frame + push ax + sub al,[es:bx] ;for detection. + sub ah,[es:bx+1] ;al,ah now holds offset within + ;the frame + push es bx cx ax + mov al,[es:bx+4] ;object number + call getsetad + mov al,[es:bx+17] ;finds frame number + mov es,setframes + mov bx,framedata + mov ah,0 + mov cx,6 + mul cx + add bx,ax ;get data for this frame in es:bx + pop ax + + push ax + mov al,ah + mov ah,0 + mov cl,[es:bx] + mov ch,0 + mul cx + pop cx + mov ch,0 + add ax,cx ;ax now holds offset from corner + ;of the frame + add ax,[es:bx+2] + mov bx,ax ;es:bx now holds offset of pixel! + add bx,frames + + mov al,[es:bx] + mov dl,al + pop cx bx es ax + cmp dl,0 + ret + + endp + + + + + + + + + + + + +Createpanel proc near + + mov di,0 + mov bx,8 + mov ds,icons2 + mov al,0 + mov ah,2 + call showframe ;spritef + mov di,160 + mov bx,8 + mov ds,icons2 + mov al,0 + mov ah,2 + call showframe ;spritef + mov di,0 + mov bx,104 + mov ds,icons2 + mov al,0 + mov ah,2 + call showframe ;spritef + mov di,160 + mov bx,104 + mov ds,icons2 + mov al,0 + mov ah,2 + call showframe ;spritef + ret + + endp + + + +Createpanel2 proc near + + call createpanel + mov di,0 + mov bx,0 + mov ds,icons2 + mov al,5 + mov ah,2 + call showframe + mov di,160 + mov bx,0 + mov ds,icons2 + mov al,5 + mov ah,2 + call showframe + ret + + endp + + + + + + +;Showspritef proc near +; +; mov ax,bx +; mov bx,screenwidth +; mul bx +; add di,ax +; mov dx,screenwidth +; mov es,workspace +; mov si,2080 +; mov ah,0 +; add ax,ax +; mov bx,ax +; add ax,ax +; add bx,ax +; add si,[bx+2] +; mov cx,[bx+0] +;spritefloop: push cx di +; call width80 +; pop di cx +; add di,dx +; dec ch +; jnz spritefloop +; ret +; +; endp +; +; + + + + + + + + +Clearwork proc near + + mov ax,0h + mov es,workspace + mov di,0 + mov cx,(200*320)/64 +clearloop: stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + loop clearloop + ret + + endp + + + + + + +Vsync proc near + + push ax bx cx dx si di ds es + + mov dx,03dah +loop2: in al,dx + test al,8 + jz loop2 +loop1: in al,dx + test al,8 + jnz loop1 + + call doshake + call dofade + if debuglevel2 + call debugkeys + endif + pop es ds di si dx cx bx ax + ret + + endp + + + +Doshake proc near + + cmp shakecounter,48 + jz finishshake + inc shakecounter + mov bl,shakecounter + mov bh,0 + add bx,offset cs:shaketable + mov al,10h + mov dx,3d4h + out dx,al + inc dx + mov al,[cs:bx] + out dx,al +finishshake: ret + +shaketable: db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh + db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh + db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh + db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh + db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh + db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh + db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh + db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9eh + db 9ch,9ah,9fh,9ah,9ch,9eh,0a0h,9bh,9dh,99h,9fh,9ch + + endp + + + + + + +Zoom proc near + + cmp watchingtime,0 + jnz inwatching + cmp zoomon,1 + jz zoomswitch +inwatching: ret + +zoomswitch: cmp commandtype,199 + jc zoomit +cantzoom: call putunderzoom + ret + +zoomit: mov ax,oldpointery + sub ax,9 + mov cx,screenwidth + mul cx + add ax,oldpointerx + sub ax,11 + mov si,ax + + mov ax,zoomy+4 + mov cx,screenwidth + mul cx + add ax,zoomx+5 + mov di,ax + mov es,workspace + mov ds,workspace + + mov cx,20 +zoomloop: push cx + mov cx,23 +zoomloop2: lodsb + mov ah,al + stosw + mov [es:di+screenwidth-2],ax + loop zoomloop2 + add si,screenwidth-23 + add di,screenwidth-46+screenwidth + pop cx + loop zoomloop + + call crosshair + mov didzoom,1 + ret + + endp + + + + + + + + + +Delthisone proc near + + push ax + push ax + mov al,ah + mov ah,0 + add ax,mapady + mov bx,screenwidth + mul bx + pop bx + mov bh,0 + add bx,mapadx + add ax,bx + mov di,ax + pop ax + push ax + mov al,ah + mov ah,0 + mov bx,22*8 + mul bx + pop bx + mov bh,0 + add ax,bx + mov si,ax + + mov es,workspace + mov ds,mapstore + mov dl,cl + mov dh,0 + mov ax,screenwidth + sub ax,dx + neg dx + add dx,22*8 +deloneloop: push cx + mov ch,0 + rep movsb + pop cx + add di,ax + add si,dx + dec ch + jnz deloneloop + ret + + endp + + + + + + + +;------------------------------------------------------------Pointer update---- + + +Multiget proc near ;di,bx = dest x,y + ;cl,ch = size + mov ax,bx ;si,di = storage + mov bx,screenwidth + mul bx + add di,ax + + mov es,workspace + push es ds + pop es ds + xchg di,si + mov al,cl + mov ah,0 + mov dx,screenwidth + sub dx,ax + + mov al,cl + and al,1 + jnz oddwidth2 + + mov bl,cl + mov bh,0 + mov ax,offset cs:width0 + shr bx,1 + sub ax,bx + mov cl,ch + mov ch,0 +multiloop3: call ax + add si,dx + loop multiloop3 + ret + +oddwidth2: mov bl,cl + mov bh,0 + shr bx,1 + mov ax,offset cs:width0 + sub ax,bx + mov cl,ch + mov ch,0 +multiloop4: call ax + movsb + add si,dx + loop multiloop4 + ret + + endp + + + + + + + +Multiput proc near ;di,bx = dest x,y + ;cl,ch = size + mov ax,bx ;si,di = storage + mov bx,screenwidth + mul bx + add di,ax + + mov es,workspace + mov al,cl + mov ah,0 + mov dx,screenwidth + sub dx,ax + + mov al,cl + and al,1 + jnz oddwidth3 + + mov bl,cl + mov bh,0 + shr bx,1 + mov ax,offset cs:width0 + sub ax,bx + mov cl,ch + mov ch,0 +multiloop5: call ax + add di,dx + loop multiloop5 + ret + +oddwidth3: mov bl,cl + mov bh,0 + shr bx,1 + mov ax,offset cs:width0 + sub ax,bx + mov cl,ch + mov ch,0 +multiloop6: call ax + movsb + add di,dx + loop multiloop6 + ret + + + endp + + + + + + + + + +Multidump proc near ;di,bx = dest x,y + ;cl,ch = size + mov dx,0a000h + mov es,dx + mov ds,workspace + + mov ax,bx + mov bx,screenwidth + mul bx + add di,ax + mov dx,screenwidth + mov si,di + + mov al,cl + and al,1 + jnz oddwidth + + mov bl,cl + mov bh,0 + shr bx,1 + mov ax,offset cs:width0 + sub ax,bx + mov bl,cl + mov bh,0 + neg bx + add bx,dx + mov cl,ch + mov ch,0 +multiloop1: call ax + add di,bx + add si,bx + loop multiloop1 + ret + +oddwidth: mov bl,cl + mov bh,0 + shr bx,1 + mov ax,offset cs:width0 + sub ax,bx + mov bl,cl + mov bh,0 + neg bx + add bx,screenwidth + mov cl,ch + mov ch,0 +multiloop2: call ax + movsb + add di,bx + add si,bx + loop multiloop2 + ret + + endp + + + + + +Width160 proc near + + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw +width128: movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw +width110: movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw +width88: movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw +width80: movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw +width63: movsw +width62: movsw +width61: movsw +width60: movsw +width59: movsw +width58: movsw +width57: movsw +width56: movsw +width55: movsw +width54: movsw +width53: movsw +width52: movsw +width51: movsw +width50: movsw +width49: movsw +width48: movsw +width47: movsw +width46: movsw +width45: movsw +width44: movsw +width43: movsw +width42: movsw +width41: movsw +width40: movsw +width39: movsw +width38: movsw +width37: movsw +width36: movsw +width35: movsw +width34: movsw +width33: movsw +width32: movsw +width31: movsw +width30: movsw +width29: movsw +width28: movsw +width27: movsw +width26: movsw +width25: movsw +width24: movsw +width23: movsw +width22: movsw +width21: movsw +width20: movsw +width19: movsw +width18: movsw +width17: movsw +width16: movsw +width15: movsw +width14: movsw +width13: movsw +width12: movsw +width11: movsw +width10: movsw +width9: movsw +width8: movsw +width7: movsw +width6: movsw +width5: movsw +width4: movsw +width3: movsw +width2: movsw +width1: movsw +width0: ret + + endp + + + + + + + + + +Doblocks proc near + + mov es,workspace + mov ax,mapady + mov cx,screenwidth + mul cx + mov di,mapadx + add di,ax + + mov al,mapy + mov ah,0 + mov bx,mapwidth + mul bx + mov bl,mapx + mov bh,0 + add ax,bx + + mov si,map + add si,ax + + mov cx,10 +loop120: push di cx + mov cx,11 +loop124: push cx di + + mov ds,mapdata + lodsb + mov ds,backdrop + + push si + cmp al,0 + jz zeroblock + mov ah,al + mov al,0 + mov si,blocks + add si,ax + mov bh,14 + + + mov bh,4 +firstbitofblock: movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + add di,screenwidth-16 + dec bh + jnz firstbitofblock + + mov bh,12 +loop125: movsw + movsw + movsw + movsw + movsw + movsw + movsw + movsw + mov ax,0dfdfh + stosw + stosw + + add di,screenwidth-20 + dec bh + jnz loop125 + + add di,4 + mov ax,0dfdfh + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + add di,screenwidth-16 + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + add di,screenwidth-16 + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + add di,screenwidth-16 + stosw + stosw + stosw + stosw + stosw + stosw + stosw + stosw + + +zeroblock: pop si + + pop di cx + add di,16 + loop loop124 + add si,mapwidth-11 + pop cx di + add di,screenwidth*16 + loop loop120 + ret + + endp + + + + + + + +;----------------------------------------------General sprite output routine---- + +Showframe proc near ; shows a frame from sprites + + push dx ax ; es=destination + mov cx,ax ; ds=source + and cx,511 ; di=x, bx=y + add cx,cx ; al=frame number + mov si,cx ; ah=effects flag + add cx,cx + add si,cx + cmp word ptr [si],0 + jnz notblankshow + pop ax dx + mov cx,0 + ret + +notblankshow: test ah,128 + jnz skipoffsets + mov al,[si+4] + mov ah,0 + add di,ax + mov al,[si+5] + mov ah,0 + add bx,ax +skipoffsets: mov cx,[si+0] + mov ax,[si+2] + add ax,2080 + mov si,ax + pop ax dx + cmp ah,0 + jz noeffects + + test ah,128 + jz notcentred + push ax + mov al,cl + mov ah,0 + shr ax,1 + sub di,ax + mov al,ch + mov ah,0 + shr ax,1 + sub bx,ax + pop ax + +notcentred: test ah,64 + jz notdiffdest + push cx + call frameoutfx + pop cx + ret + +notdiffdest: test ah,8 + jz notprintlist + push ax + mov ax,di + sub ax,mapadx + push bx + sub bx,mapady + mov ah,bl + pop bx + ;call addtoprintlist + pop ax + +notprintlist: test ah,4 + jz notflippedx + mov dx,screenwidth + mov es,workspace + push cx + call frameoutfx + pop cx + ret + +notflippedx: test ah,2 + jz notnomask + mov dx,screenwidth + mov es,workspace + push cx + call frameoutnm + pop cx + ret + +notnomask: test ah,32 + jz noeffects + mov dx,screenwidth + mov es,workspace + push cx + call frameoutbh + pop cx + ret + +noeffects: mov dx,screenwidth + mov es,workspace + push cx + call frameoutv + pop cx ; returns size printed in cx + ret + + endp + + + + + + + + + + +Frameoutv proc near + + push dx + mov ax,bx + mov bx,dx + mul bx + add di,ax + pop dx + + push cx + mov ch,0 + sub dx,cx + pop cx + +frameloop1: push cx + mov ch,0 + +frameloop2: lodsb + cmp al,0 + jnz backtosolid +backtoother: inc di + loop frameloop2 + pop cx + add di,dx + dec ch + jnz frameloop1 + ret + +frameloop3: lodsb + cmp al,0 + jz backtoother +backtosolid: stosb + loop frameloop3 + pop cx + add di,dx + dec ch + jnz frameloop1 + ret + + endp + + + + + + +Frameoutnm proc near + + push dx + mov ax,bx + mov bx,dx + mul bx + add di,ax + pop dx + + push cx + mov ch,0 + sub dx,cx + pop cx + + mov al,cl + and al,1 + jnz oddwidthframe + + mov bl,cl + mov bh,0 + mov ax,offset cs:width0 + shr bx,1 + sub ax,bx + mov cl,ch + mov ch,0 +nmloop1: call ax + add di,dx + loop nmloop1 + ret + +oddwidthframe: mov bl,cl + mov bh,0 + shr bx,1 + mov ax,offset cs:width0 + sub ax,bx + mov cl,ch + mov ch,0 +nmloop2: call ax + movsb + add di,dx + loop nmloop2 + ret + + endp + + + + + + +Frameoutbh proc near + + push dx + mov ax,bx + mov bx,dx + mul bx + add di,ax + pop dx + + push cx + mov ch,0 + sub dx,cx + pop cx + +bhloop2: push cx + mov ch,0 + mov ah,255 +bhloop1: cmp [es:di],ah + jnz nofill + movsb + loop bhloop1 + jmp nextline +nofill: inc di + inc si + loop bhloop1 +nextline: add di,dx + pop cx + dec ch + jnz bhloop2 + ret + + endp + + + + + + + +Frameoutfx proc near + + push dx + mov ax,bx + mov bx,dx + mul bx + add di,ax + pop dx + + push cx + mov ch,0 + add dx,cx + pop cx + +frameloopfx1: push cx + mov ch,0 + +frameloopfx2: lodsb + cmp al,0 + jnz backtosolidfx +backtootherfx: dec di + loop frameloopfx2 + pop cx + add di,dx + dec ch + jnz frameloopfx1 + ret + +frameloopfx3: lodsb + cmp al,0 + jz backtootherfx +backtosolidfx: mov [es:di],al + dec di + loop frameloopfx3 + pop cx + add di,dx + dec ch + jnz frameloopfx1 + ret + + endp + + + + +;---------------------------------------------------Transfers for extra data---- + +Transferinv proc near + + mov di,exframepos + push di + mov al,expos + mov ah,0 + mov bx,ax + add ax,ax + add ax,bx + inc ax + mov cx,6 + mul cx + mov es,extras + mov bx,exframedata + add bx,ax + add di,exframes + + push bx + mov al,itemtotran + mov ah,0 + mov bx,ax + add ax,ax + add ax,bx + inc ax + mov cx,6 + mul cx + mov ds,freeframes + mov bx,frframedata + add bx,ax + mov si,frframes + mov al,[bx] + mov ah,0 + mov cl,[bx+1] + mov ch,0 + add si,[bx+2] ;we have si, and length + mov dx,[bx+4] + pop bx + mov [es:bx+0],al + mov [es:bx+1],cl + mov [es:bx+4],dx + + mul cx + mov cx,ax + push cx + rep movsb + pop cx + pop ax + mov [es:bx+2],ax + add exframepos,cx + ret + + endp + + + + + + + + + + +Transfermap proc near + + mov di,exframepos + push di + mov al,expos + mov ah,0 + mov bx,ax + add ax,ax + add ax,bx + mov cx,6 + mul cx + mov es,extras + mov bx,exframedata + add bx,ax + add di,exframes + + push bx + mov al,itemtotran + mov ah,0 + mov bx,ax + add ax,ax + add ax,bx + mov cx,6 + mul cx + mov ds,freeframes + mov bx,frframedata + add bx,ax + mov si,frframes + mov al,[bx] + mov ah,0 + mov cl,[bx+1] + mov ch,0 + add si,[bx+2] ;we have si, and length + mov dx,[bx+4] + pop bx + mov [es:bx+0],al + mov [es:bx+1],cl + mov [es:bx+4],dx + + mul cx + mov cx,ax + push cx + rep movsb + pop cx + pop ax + mov [es:bx+2],ax + add exframepos,cx + ret + + endp + + +;------------------------------------------------------------------Filenames---- + + +Spritename1 db "DREAMWEB.S00",0 +Spritename3 db "DREAMWEB.S02",0 + +Idname db "INSTALL.DAT",0 + +Characterset1 db "DREAMWEB.C00",0 +Characterset2 db "DREAMWEB.C01",0 +Characterset3 db "DREAMWEB.C02",0 + +Samplename db "DREAMWEB.V00",0 + +Basicsample db "DREAMWEB.V99",0 + +Icongraphics0 db "DREAMWEB.G00",0 +Icongraphics1 db "DREAMWEB.G01",0 +Extragraphics1 db "DREAMWEB.G02",0 +Icongraphics8 db "DREAMWEB.G08",0 +Mongraphicname db "DREAMWEB.G03",0 +Mongraphics2 db "DREAMWEB.G07",0 +Cityname db "DREAMWEB.G04",0 +Travelgraphic1 db "DREAMWEB.G05",0 +Travelgraphic2 db "DREAMWEB.G06",0 +Diarygraphic db "DREAMWEB.G14",0 + +Monitorfile1 db "DREAMWEB.T01",0 +Monitorfile2 db "DREAMWEB.T02",0 +Monitorfile10 db "DREAMWEB.T10",0 ;News items 10-13 +Monitorfile11 db "DREAMWEB.T11",0 +Monitorfile12 db "DREAMWEB.T12",0 +Monitorfile13 db "DREAMWEB.T13",0 +Monitorfile20 db "DREAMWEB.T20",0 +Monitorfile21 db "DREAMWEB.T21",0 ;Ryan's private stuff +Monitorfile22 db "DREAMWEB.T22",0 ;Use for blank carts +Monitorfile23 db "DREAMWEB.T23",0 ;Use for edens cart +Monitorfile24 db "DREAMWEB.T24",0 ;Use for church cart +Foldertext db "DREAMWEB.T50",0 +Diarytext db "DREAMWEB.T51",0 +Puzzletextname db "DREAMWEB.T80",0 ;puzzle text +Traveltextname db "DREAMWEB.T81",0 ;location descriptions +Introtextname db "DREAMWEB.T82",0 ;intro sequence +Endtextname db "DREAMWEB.T83",0 ;end sequence/credits +Commandtextname db "DREAMWEB.T84",0 ;commands + +Volumetabname db "DREAMWEB.VOL",0 + +Foldergraphic1 db "DREAMWEB.G09",0 +Foldergraphic2 db "DREAMWEB.G10",0 +Foldergraphic3 db "DREAMWEB.G11",0 +Symbolgraphic db "DREAMWEB.G12",0 +Gungraphic db "DREAMWEB.G13",0 +Monkface db "DREAMWEB.G15",0 + +Title0graphics db "DREAMWEB.I00",0 +Title1graphics db "DREAMWEB.I01",0 +Title2graphics db "DREAMWEB.I02",0 +Title3graphics db "DREAMWEB.I03",0 +Title4graphics db "DREAMWEB.I04",0 +Title5graphics db "DREAMWEB.I05",0 +Title6graphics db "DREAMWEB.I06",0 +Title7graphics db "DREAMWEB.I07",0 + +Palettescreen db "DREAMWEB.PAL",0 + + + \ No newline at end of file -- cgit v1.2.3