Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MegaZeux 2.51s2 release.

  • Loading branch information...
commit de721af805d222d98a1e6c97fd332275c449d3b0 1 parent 5e7c79b
@ajs1984 authored
Showing with 3,016 additions and 3,046 deletions.
  1. +22 −0 WHATSNEW.251 → CHANGELOG
  2. +4 −4 Makefile
  3. +49 −36 README.1ST
  4. +46 −0 README.S1
  5. +1 −141 README.TXT
  6. +1 −1  arrowkey.asm
  7. +8 −2 boardmem.cpp
  8. +1 −1  boardmem.h
  9. +3 −14 comp_chk.cpp
  10. +2 −2 comp_chk.h
  11. +20 −0 convmem.txt
  12. +8 −7 counter.cpp
  13. +1 −1  cursor.asm
  14. +8 −1 data.asm
  15. +6 −1 data.h
  16. +7 −1 data.inc
  17. +1 −79 detect.asm
  18. +1 −5 detect.h
  19. +0 −1  detect.inc
  20. +2 −2 dt_data.cpp
  21. +2 −2 dt_data.h
  22. +14 −67 edit.cpp
  23. +33 −22 egacode.cpp
  24. +3 −1 egacode.h
  25. +6 −5 ezboard.cpp
  26. +42 −150 game.cpp
  27. +1 −1  graphics.asm
  28. +45 −51 help.doc
  29. +1 −1  idput.asm
  30. +17 −27 main.cpp
  31. +1 −0  main.h
  32. +9 −1 mouse.cpp
  33. +4 −1 mouse.h
  34. +38 −7 new_mod.cpp
  35. +1 −1  random.asm
  36. +1 −1  retrace.asm
  37. +2,365 −2,343 runrobo2.cpp
  38. +106 −66 saveload.cpp
  39. +101 −0 scrdump.cpp
  40. +35 −0 scrdump.h
View
22 WHATSNEW.251 → CHANGELOG
@@ -1,3 +1,25 @@
+2.51s2final release:
+
++ Deleted cpu checking code, was unnecesary and caused errors.
++ Fixed bug involving mod * settings being lost when loading
++ Should have fixed ems problems some were reporting, if not, just
+ try to get more conventional memory.
+
+2.5.1s2beta release:
+
++ added MOD "*", which allows a board to use whatever module the previous
+ board was using; this necessitated a change in the .SAV file format
+ (still need changes in the editor UI to access this feature outside of
+ Robotic)
++ inmate's semantics for MOD "SOMETHIN.MOD*" aren't immediately possible,
+ although a rough hack is in already
++ char edits are now not displayed until the beginning of the next cycle;
+ the deferred display should eliminate a lot of flickering
++ an (at least partial) fix for the infamous UNDER bug (thanks JZig!)
++ MOUSEX, MOUSEY and BUTTONS are now buffered.
++ more sane magic handling
++ can load MZX 2.51 and 2.51S1 worlds, but will only save 2.5.1spider2 format
+
2.51S1 release:
View
8 Makefile
@@ -32,8 +32,8 @@ ems.obj error.obj ezboard.obj fill.obj game.obj game2.obj getkey.obj \
graphics.obj helpsys.obj hexchar.obj idarray.obj idput.obj intake.obj \
main.obj meminter.obj meter.obj mouse.obj new_mod.obj palette.obj \
pal_ed.obj param.obj password.obj random.obj retrace.obj roballoc.obj \
-runrobot.obj runrobo2.obj saveload.obj scrdisp.obj sfx.obj sfx_edit.obj \
-string.obj timer.obj window.obj
+runrobot.obj runrobo2.obj saveload.obj scrdisp.obj scrdump.obj sfx.obj \
+sfx_edit.obj string.obj timer.obj window.obj
#
# I'd rather this wasn't necessary, but I can't think of a way either in
@@ -48,8 +48,8 @@ ems.obj+error.obj+ezboard.obj+fill.obj+game.obj+game2.obj+getkey.obj+\
graphics.obj+helpsys.obj+hexchar.obj+idarray.obj+idput.obj+intake.obj+\
main.obj+meminter.obj+meter.obj+mouse.obj+new_mod.obj+palette.obj+\
pal_ed.obj+param.obj+password.obj+random.obj+retrace.obj+roballoc.obj+\
-runrobot.obj+runrobo2.obj+saveload.obj+scrdisp.obj+sfx.obj+sfx_edit.obj+\
-string.obj+timer.obj+window.obj
+runrobot.obj+runrobo2.obj+saveload.obj+scrdisp.obj+scrdump.obj+sfx.obj+\
+sfx_edit.obj+string.obj+timer.obj+window.obj
all: megazeux.exe fix.exe getpw.exe killgbl.exe txt2hlp.exe ver1to2.exe
View
85 README.1ST
@@ -1,46 +1,59 @@
-IMPORNAT NOTICE:
- PLEASE READ THIS FILE BEFORE TRYING TO USE MZX 2.51S1b! YOU ALREADY DID,
+IMPORTANT NOTICE:
+ PLEASE READ THIS FILE BEFORE TRYING TO USE MZX 2.51S2! YOU ALREADY DID,
DIDN'T YOU? YOU RAN THE PROGRAM AND IT DIDN'T WORK AND NOW YOU'RE ALL
UPSET AND YOU THINK IT'S OUR FAULT, DON'T YOU? HA HA HA! SEE IF I HELP
YOU OUT! I'M GUESSING THE SOUND DOESN'T WORK, RIGHT? TOO BAD! MAYBE
YOU SHOULD HAVE READ THIS FILE EARLIER, THAT'S WHY IT'S NAMED README.1ST!
- Okay, This is sort of a betaish release, in the sense that I'm pretty sure
- everything works right, but you never know :) It's also the first release
- since I plan on adding more improvements over time. So even if everything
- works perfectly, I still get to call it a beta since it's not really done.
-
- First big thing is that this software is protected by the General Public
- License, a copy of which has been included for your convenience.
-
- Second big thing is that as of right now, you must have MZX 2.51 installed
- on your system. This is because I haven't included all the various support
- files that MegaZeux needs. In light of this, you MUST copy the included
- .EXE file into your normal MegaZeux directory, if you don't, your sound
- will not function, and the help files will be missing, and other nasty
- things.
-
- In accordance with the General Public License, the source code for
- MZX 2.51S1 is available, and you are free to use/modify it under the
- terms set forth in the General Public License. The source code should be
- available wherever you got this binary package, if not, you should always
- be able to obtain the source at:
- http://www.execpc.com/~tgoetzma/
- Barring server failures or me changing ISPs or something :)
-
- Changes are outlined in whatsnew.251. If you find a major bug in the
- program, please email me at the address below. But ONLY for bugs (or
- perhaps cash donations, complements, etc...:) PLEASE DO NOT EMAIL me
- with questions on how to use the new stuff, or amazing ideas that you
- have for MZX 2.51S2. I may or may not release some more detailed info
- on using MZX 2.51Sx, or perhaps some kind of FAQ. Keep an eye on any
- zeux.org or some other popular mzx news page.
-
- I guess that's it...Enjoy!
+ First, if you care, old readme for s1 is in readme.s1, it's prolly outdated
+
+ Like s1, this is a pretty darn beta release. It SHOULD work fine, and has,
+ so far, worked fine on my computer. Use it with care, though, and send any
+ bug reports to jzig@cncn.com.
+
+ Second, this release incorporates more than just spider's input, as you can
+ tell from this readme. Mental contributed a large amount of code, and I
+ (JZig) got the whole thing working and fixed, and fixed that under bug.
+ (more on that later).
+
+ Now, what's actually different (read whatsnew.251 for specifics):
+ The mod "*" command works in robotic. Basically, this command sets it so
+ that the current board will keep playing whatever mod was playing last,
+ and is useful for status screens and the like. Ask inmate for more
+ detail. In a related note, mod "foo*" loads module foo than runs mod "*"
+ The under direction now works. Ie, you can check for stuff underneath
+ anything in the game world. This is very useful when you need to check
+ what floor tile a robot is on, and should save programmers much trouble
+ and hacking to get around this bug. Enjoy.
+ The counters MOUSEX, MOUSEY, and BUTTONS are now buffered, meaning they
+ won't change in the middle of the cycle.
+ There are several other internal changes that should not effect the user,
+ except by making mzx easier to look at and nicer, read whatsnew.251 for
+ details
+
+ In accordance with the GNU GPL, the full source for this program is
+ available. The download page of zeux.org should have the source, and any
+ number of other places will as well.
+
+ As for this package, it contains every file VITAL for mzx to run, but does
+ not contain any mods or mzx worlds, you can get them from the original
+ package if you feel the need to hear cv_magic.mod again. You can safely
+ copy over your old megazeux directory, if you feel the desire. Just
+ overwrite everything you feel like.
+
+ Finally, if you have any bug reports, or REASONABLE suggestions, email me
+ at jzig@cncn.com, but if the suggestions are NOT reasonable, expect them
+ to be ignored, so don't spam me, please.
+
+ And, uh, that's it, or something. Leave.
+
+ Ben Zeigler
+ jzig@cncn.com
Charles Goetzman
- tgoetzma@execpc.com
+ spider@aether.dhs.org
+ spider@zeux.org
+
-
View
46 README.S1
@@ -0,0 +1,46 @@
+
+IMPORNAT NOTICE:
+ PLEASE READ THIS FILE BEFORE TRYING TO USE MZX 2.51S1b! YOU ALREADY DID,
+ DIDN'T YOU? YOU RAN THE PROGRAM AND IT DIDN'T WORK AND NOW YOU'RE ALL
+ UPSET AND YOU THINK IT'S OUR FAULT, DON'T YOU? HA HA HA! SEE IF I HELP
+ YOU OUT! I'M GUESSING THE SOUND DOESN'T WORK, RIGHT? TOO BAD! MAYBE
+ YOU SHOULD HAVE READ THIS FILE EARLIER, THAT'S WHY IT'S NAMED README.1ST!
+
+ Okay, This is sort of a betaish release, in the sense that I'm pretty sure
+ everything works right, but you never know :) It's also the first release
+ since I plan on adding more improvements over time. So even if everything
+ works perfectly, I still get to call it a beta since it's not really done.
+
+ First big thing is that this software is protected by the General Public
+ License, a copy of which has been included for your convenience.
+
+ Second big thing is that as of right now, you must have MZX 2.51 installed
+ on your system. This is because I haven't included all the various support
+ files that MegaZeux needs. In light of this, you MUST copy the included
+ .EXE file into your normal MegaZeux directory, if you don't, your sound
+ will not function, and the help files will be missing, and other nasty
+ things.
+
+ In accordance with the General Public License, the source code for
+ MZX 2.51S1 is available, and you are free to use/modify it under the
+ terms set forth in the General Public License. The source code should be
+ available wherever you got this binary package, if not, you should always
+ be able to obtain the source at:
+ http://www.execpc.com/~tgoetzma/
+ Barring server failures or me changing ISPs or something :)
+
+ Changes are outlined in whatsnew.251. If you find a major bug in the
+ program, please email me at the address below. But ONLY for bugs (or
+ perhaps cash donations, complements, etc...:) PLEASE DO NOT EMAIL me
+ with questions on how to use the new stuff, or amazing ideas that you
+ have for MZX 2.51S2. I may or may not release some more detailed info
+ on using MZX 2.51Sx, or perhaps some kind of FAQ. Keep an eye on any
+ zeux.org or some other popular mzx news page.
+
+ I guess that's it...Enjoy!
+
+ Charles Goetzman
+ tgoetzma@execpc.com
+
+
+
View
142 README.TXT
@@ -1,141 +1 @@
-
-**SUPPORT/UPDATES
-
- Up-to-the-minute upgrades of the official MegaZeux distributation are available via FTP at:
-
- http://www.scsn.net/users/dbwilli/
-
- Contact Matt Williams:
-
- Internet: dbwilli@scsn.net
- WWW: http://www.scsn.net/users/dbwilli/
-
-**NEW MUSIC CODE
-
- MegaZeux 2.51 has all-new music code. Some important new features-
-
- * Up to 32 music/sound channels playing simultaneously
- * Up to 4 simultaneous sound effects
- * Support for stereo and 16-bit sound cards
- * Support for SoundBlaster (1.x/2.x/16/Pro) GUS and PAS-16
- * Support for almost all file formats through a conversion program
-
- Sorry, but Sound Source and PC Speaker output have been removed.
- Note that MID and XM are NOT supported. MOD files can be loaded as
- normal, but all other supported formats MUST be converted to a GDM
- file first using the included 2GDM utility. Supported formats
- include MOD/NST/WOW/OCT, S3M, 669, and MTM.
-
- See the 'MegaZeux's Sound System' section of Help for details.
-
-**GETTING MEGAZEUX STARTED-
-
- Many people have had problems getting MegaZeux to run on their
- systems. MegaZeux requires EMS for most usage, and many computers
- will need to use a boot disk.
-
- MegaZeux makes extensive use of EMS and conventional (first
- 640k) memory. The more you have available, the better it will
- run.
-
- To have EMS memory available, you must have an EMS driver
- installed. Most EMS drivers also require an XMS/HIMEM driver
- loaded first. You will need lines similar to the following in
- your CONFIG.SYS to load HIMEM and an EMS driver, respectively-
-
- DEVICE=C:\DOS\HIMEM.SYS
- DEVICEHIGH=C:\DOS\EMM386.EXE 3072 H=160
-
- The 3072 tells DOS to reserve up to 3072K of memory (3
- megabytes) for EMS. Feel free to lower or raise this value,
- but a minimum of 2048K (2 megabytes) is recommended.
-
- It is also recommended that you load SmartDrive to run MegaZeux.
- SmartDrive is a disk-cache utility that is usually loaded,
- because it greatly speeds up repeat disk accesses. You probably
- already have a line such as SMARTDRV.EXE /X in your AUTOEXEC.BAT;
- if not, you should consider adding it somewhere after the PATH
- statement.
-
- To help free up conventional memory, you may need to create a
- boot disk. This is a common procedure for games that use less
- conventional setups (such as MegaZeux), and if a certain boot disk
- works for one game, it may work just fine for MegaZeux. However,
- you must remember to include HIMEM and an EMS driver, and include
- a mouse driver if you want your mouse to be available.
-
- To create a boot disk, stick a blank disk into your A: drive and
- type the following:
-
- FORMAT A: /S <enter>
-
- Answer Yes to all questions. Give the disk a label if you wish.
- Answer No to "Format another?" and then type:
-
- COPY CON A:CONFIG.SYS <enter>
- DEVICE=C:\DOS\HIMEM.SYS <enter>
- DEVICEHIGH=C:\DOS\EMM386.EXE 4096 H=160 <enter>
- DOS=HIGH <enter>
- <ctrl+z>
-
- COPY CON A:AUTOEXEC.BAT <enter>
- PATH C:\DOS;C:\WINDOWS <enter>
- SMARTDRV /X <enter>
- C:\MOUSE\MOUSE <enter>
- C: <enter>
- CD \MEGAZEUX <enter>
- MEGAZEUX <enter>
- <ctrl+z>
-
- The line to load the mouse driver is optional, and may vary on
- different computers. The drive and directory you have MegaZeux
- in may differ as well. Your windows and dos paths may differ.
-
- Once you've followed these instructions, you can insert the
- disk and reboot the computer to run MegaZeux. It is best if you
- get a computer-wise friend to help you, if you can't get the
- above to work.
-
- One note- most newer sound cards require drivers or other
- programs to be run before they can be used. Check your existing
- configuration files and/or manuals to find out what these
- commands are if you intend to use MegaZeux with a boot disk.
-
-**PREVIOUS VERSION USERS-
-
- If you have used versions 2.00 or 2.01 of MegaZeux at any time,
- you should run the program FIX.EXE in every directory containing
- .MZX and .MZB files. This fixes a small bug in version 2.00/2.01.
- .SAV files may still run strangely- if so, start the game anew.
-
-**NEW USERS-
-
- Welcome to MegaZeux!
-
- As you may already know, MegaZeux is a game system which
- allows you to play almost limitless worlds in EGA graphics
- and with beautiful digitized music and sound. MegaZeux comes
- with worlds, and new worlds are being uploaded every day to
- major on-line services such as America Online. But the most
- fabulous feature of MegaZeux is the World Editor.
-
- Using the World Editor, ANYONE can create the world of their
- dreams. Make it as simple or complex, as easy or difficult,
- as long or short as you please. And we aren't just talking
- about worlds made up of petty, pre-programmed enemies and
- objects. MegaZeux has it's own, easy to use PROGRAMMING
- LANGUAGE called Robotic that allows you to create enemies,
- objects, and worlds that do almost anything you desire.
-
- For the new user, I recommend you play Caverns, the first
- included game, to get the feel of MegaZeux. You may wish
- to read the help or .DOC section entitled "Controls" to
- learn how to play MegaZeux.
-
- Once you have the feel for the game, however, feel free
- to dive into the World Editor and get messy! You should
- probably read the help or .DOC section entitled "The World
- Editor" first.
-
- Use F1 to read help, or read MEGAZEUX.DOC, for more detailed
- information.
+Read readme.1st, this is empty.
View
2  arrowkey.asm
@@ -448,4 +448,4 @@ public getch
ends
-end
+end
View
10 boardmem.cpp
@@ -38,6 +38,8 @@
#include <dos.h>
#include "mod.h"
+#define SAVE_INDIVIDUAL
+
//Normalize an unsigned char far * ptr-
#define normalize(x) {\
x=(unsigned char far *)MK_FP(FP_SEG(x)+(FP_OFF(x)>>4),FP_OFF(x)&15); }
@@ -472,6 +474,7 @@ char store_current(unsigned char id) {
//also included in case this ever fails. To use the individual
//code, define the symbol SAVE_INDIVIDUAL.
#ifndef SAVE_INDIVIDUAL
+
mem_cpy((char far *)ptr,mod_playing,207+FILENAME_SIZE);
ptr+=207+FILENAME_SIZE;
#else
@@ -884,13 +887,15 @@ char grab_current(unsigned char id) {
//also included in case this ever fails. To use the individual
//code, define the symbol SAVE_INDIVIDUAL.
#ifndef SAVE_INDIVIDUAL
+
mem_cpy(mod_playing,(char far *)ptr,207+FILENAME_SIZE);
ptr+=207+FILENAME_SIZE;
#else
mem_cpy(mod_playing,(char far *)ptr,FILENAME_SIZE);
ptr+=FILENAME_SIZE;
viewport_x=*(ptr++);
- viewport_y=*(ptr++);
+
+ viewport_y=*(ptr++);
viewport_xsiz=*(ptr++);
viewport_ysiz=*(ptr++);
can_shoot=*(ptr++);
@@ -1055,6 +1060,7 @@ char grab_current(unsigned char id) {
#else
fread(mod_playing,1,FILENAME_SIZE,fp);
viewport_x=fgetc(fp);
+
viewport_y=fgetc(fp);
viewport_xsiz=fgetc(fp);
viewport_ysiz=fgetc(fp);
@@ -1405,4 +1411,4 @@ void convert_max_bsiz_mode(void) {
max_bysiz=25;
break;
}
-}
+}
View
2  boardmem.h
@@ -26,7 +26,7 @@
#include <stdio.h>
-char allocate_board_space(long size,unsigned char id,char conv_mem_ok=1);
+char allocate_board_space(long size,unsigned char id,char conv_mem_ok=0);
void deallocate_board_space(unsigned char id);
unsigned int RLE2_size(unsigned char far *plane);
unsigned int RLE2_store(unsigned char far *where,unsigned char far *plane);
View
17 comp_chk.cpp
@@ -35,27 +35,16 @@
//Global variable for VGA availability
char vga_avail=0;
//Card/processor
-char card=0,proc=0;
+char card;
//Some strings for output
-char far *sorry1="\r\n\r\nSorry, MegaZeux requires a 186 processor or better.\r\n$";
+
char far *sorry2="\r\n\r\nSorry, MegaZeux requires an EGA graphics card or better.\r\n$";
//Check graphics card and processor.
char computer_check(void) {
card=detect_graphics();
- proc=detect_processor();
//Uses DOS services to print stuff
- if(proc<P186) {
- asm push ds
- asm mov dx,SEG sorry1
- asm mov ds,dx
- asm lds dx,ds:sorry1
- asm mov ah,9
- asm int 21h
- asm pop ds
- return -1;
- }
if(card<EGA) {
asm push ds
asm mov dx,SEG sorry2
@@ -68,4 +57,4 @@ char computer_check(void) {
}
if(card>=VGAm) vga_avail=1;//VGA/MCGA/SVGA card
return 0;
-}
+}
View
4 comp_chk.h
@@ -30,6 +30,6 @@ char computer_check(void);
//Global variable- Set to 1 for VGA, 0 otherwise
extern char vga_avail;
//Card and processor codes
-extern char card,proc;
+extern char card;
-#endif
+#endif
View
20 convmem.txt
@@ -0,0 +1,20 @@
+JZig's guide to freeing conventional memory.
+NOTE NOTE: BACK UP CONFIG.SYS AND AUTOEXEC.BAT RIGHT NOW
+
+ The first thing you need to do is back up your config.sys and autoexec.bat
+in your root directory. Next, take a look at these files. First, autoexec.
+If you see anything mentioning mscdex, delete that line. Also, delete any
+line that mentions load, loadhigh, or is a command, that does not appear to
+be important. Remember, you backed up the files so if something goes wrong
+you can start over. Copy the lines you removed to c:\windows\dosstart.bat,
+this file is runwhen you select shut down to dos on the shutdown window.
+
+Now, on to config.sys. Do the same thing, remove anything that doesn't look
+important. Leave mentions of emm386 and himem in. Okay, now reset your
+computer. Hopefully, it should work fine, and you should have more memory.
+if it doesn't, figure out what doesn't work and add the line related to that
+device back to config.sys or autoexec.bat. Okay, good luck, and stop
+complaining about not having enough memory.
+
+-JZig
+
View
15 counter.cpp
@@ -36,7 +36,6 @@
#include "game.h"
#include "game2.h"
-
int player_restart_x=0,player_restart_y=0,gridxsize=1,gridysize=1;
int myscrolledx=0,myscrolledy=0;
char was_zapped=0;
@@ -84,9 +83,9 @@ int get_counter(char far *name,unsigned char id) {
if(!str_cmp(name,"PLAYERFACEDIR")) return player_last_dir>>4;
if(!str_cmp(name,"PLAYERLASTDIR")) return player_last_dir&15;
// Mouse info Spid
- if(!str_cmp(name,"MOUSEX")) return mousex;
- if(!str_cmp(name,"MOUSEY")) return mousey;
- if(!str_cmp(name,"BUTTONS")) return mybutton;
+ if(!str_cmp(name,"MOUSEX")) return saved_mouse_x;
+ if(!str_cmp(name,"MOUSEY")) return saved_mouse_y;
+ if(!str_cmp(name,"BUTTONS")) return saved_mouse_buttons;
// scroll_x and scroll_y never work, always return 0. Spid
if(!str_cmp(name,"SCROLLEDX")) {
calculate_xytop(myscrolledx,myscrolledy);
@@ -163,15 +162,17 @@ void set_counter(char far *name,int value,unsigned char id) {
if(!str_cmp(name,"MOUSEX")) {
if(value>79) value=79;
if(value<0) value=0;
+ saved_mouse_y = value;
m_move(value,mousey);
return;
- }
+ }
if(!str_cmp(name,"MOUSEY")) {
if(value>24) value=24;
if(value<0) value=0;
+ saved_mouse_x = value;
m_move(mousex,value);
return;
- }
+ }
if(!str_cmp(name,"INPUT")) {
num_input=value;
return;
@@ -311,4 +312,4 @@ void dec_counter(char far *name,int value,unsigned char id) {
if(t>32767L) t=32767L;
if(t<-32768L) t=-32768L;
set_counter(name,(int)t,id);
-}
+}
View
2  cursor.asm
@@ -134,4 +134,4 @@ endp move_cursor
ends
-end
+end
View
9 data.asm
@@ -59,9 +59,16 @@ max_bsiz_mode db 2
max_bxsiz dw 100
max_bysiz dw 100
+; Mouse state stuff
+saved_mouse_x dw 0
+saved_mouse_y dw 0
+saved_mouse_buttons dw 0
+
; Board "save chunk"
mod_playing db 0,FILENAME_SIZE-1 dup ( ? ) ;Mod currently playing
+real_mod_playing db 0,FILENAME_SIZE-1 dup ( ? ) ;Real mod currently playing
+refresh_mod_playing db 1 ;Load mod no matter what
viewport_x db 3 ;X pos of UL corner of view
viewport_y db 2
viewport_xsiz db 74 ;Size of view
@@ -264,4 +271,4 @@ update_done dd 0 ; Whether it's been updated
ends
-end
+end
View
7 data.h
@@ -37,11 +37,16 @@ extern unsigned char bullet_color[3];
extern unsigned char missile_color;
extern unsigned char bullet_char[12];
+extern char refresh_mod_playing;
extern char mesg_edges;
+extern unsigned int saved_mouse_x;
+extern unsigned int saved_mouse_y;
+extern unsigned int saved_mouse_buttons;
extern unsigned char board_where[NUM_BOARDS];
extern unsigned char keys[NUM_KEYS];
extern unsigned long score;
extern char mod_playing[FILENAME_SIZE];
+extern char real_mod_playing[FILENAME_SIZE];
extern unsigned char curr_board;
extern char curr_file[FILENAME_SIZE];
extern char curr_sav[FILENAME_SIZE];
@@ -175,4 +180,4 @@ extern char far *music_quality[3];
extern char far *thing_names[128];
-#endif
+#endif
View
8 data.inc
@@ -134,10 +134,16 @@ global C max_bsiz_mode:byte
global C max_bxsiz:word
global C max_bysiz:word
global C mesg_edges:byte
+; New values for s2
+
+global C saved_mouse_x:word
+global C saved_mouse_y:word
+global C saved_mouse_buttons:word
+global C real_mod_playing:byte
; These are from DATA2.CPP
global C robots:dword
global C scrolls:dword
global C sensors:dword
-global C counters:dword
+global C counters:dword
View
80 detect.asm
@@ -103,84 +103,6 @@ proc detect_graphics far
ret
endp detect_graphics
-;
-; Function- detect_processor
-;
-; Returns processor numeric code from detection
-;
-
-proc detect_processor far
- pushf ; Save flags
- xor ax,ax ; Clear AX
- push ax ; Push it on the stack
- popf ; Zero the flags
- pushf ; Try to zero bits 12-15
- pop ax ; Recover flags
- and ax,0F000h ; If bits 12-15 are 1 => i86 or i286
- cmp ax,0F000h
- jne @@1
-
- push cx ; save CX
- mov ax,0FFFFh ; Set all AX bits
- mov cl,33 ; Will shift once on 80186
- shl ax,cl ; or 33 x on 8086
- pop cx
- mov ax,i186
- jnz @@done
- mov ax,i86 ; 0 => 8086/8088
- jmp short @@done
-
-@@1:
- mov ax,07000h ; Try to set bits 12-14
- push ax
- popf
- pushf
- pop ax
- and ax,07000h ; If bits 12-14 are 0 => i286
- mov ax,i286
- jz @@done
-
- ; 386/486 resolution code taken from WHATCPU.ASM by
- ; Dave M. Walker
-
-
-P386
- mov eax,cr0
- mov ebx,eax ;Original CR0 into EBX
- or al,10h ;Set bit
- mov cr0,eax ;Store it
- mov eax,cr0 ;Read it back
- mov cr0,ebx ;Restore CR0
- test al,10h ;Did it set?
- mov ax,i386sx
- jz @@done ;Jump if 386SX
-
- ;*** Test AC bit in EFLAGS (386DX won't change)
- mov ecx,esp ;Original ESP in ECX
- pushfd ;Original EFLAGS in EBX
- pop ebx
- and esp,not 3 ;Align stack to prevent 486
- ; fault when AC is flipped
- mov eax,ebx ;EFLAGS => EAX
- xor eax,40000h ;Flip AC flag
- push eax ;Store it
- popfd
- pushfd ;Read it back
- pop eax
- push ebx ;Restore EFLAGS
- popfd
- mov esp,ecx ;Restore ESP
- cmp eax,ebx ;Compare old/new AC bits
- mov ax,i386dx
- je @@done
-is_486: ;Until the Pentium appears...
- mov ax,i486
-@@done:
- popf
-p8086
- ret
-endp detect_processor
-
ends
-end
+end
View
6 detect.h
@@ -29,7 +29,6 @@ extern "C" {
#endif
int detect_graphics(void);
-int detect_processor(void);
#ifdef __cplusplus
}
@@ -40,7 +39,4 @@ int detect_processor(void);
#define VGAm 5
#define VGAc 6
-//Processor codes- 186 is 1 and above
-#define P186 1
-
-#endif
+#endif
View
1  detect.inc
@@ -3,4 +3,3 @@
; Declarations for DETECT.ASM
global C detect_graphics:far
-global C detect_processor:far
View
4 dt_data.cpp
@@ -30,6 +30,6 @@ char far *gcard_strs[6]={
"EGA mono\0","EGA\0","VGA mono\0",
"VGA+\0","MCGA mono\0","MCGA\0" };
-char far *proc_strs[5]={
+/*char far *proc_strs[5]={
"186\0","286\0","386sx\0","386dx\0",
- "486+\0" };
+ "486+\0" };*/
View
4 dt_data.h
@@ -25,6 +25,6 @@
#define __DT_DATA_H
extern char far *gcard_strs[6];
-extern char far *proc_strs[5];
+//extern char far *proc_strs[5];
-#endif
+#endif
View
81 edit.cpp
@@ -24,6 +24,7 @@
#include "helpsys.h"
#include "runrobot.h"
#include "scrdisp.h"
+#include "scrdump.h"
#include "sfx.h"
#include "sfx_edit.h"
#include "counter.h"
@@ -180,7 +181,7 @@ char far *menu_lines[NUM_MENUS][2]={ {
" Shift+F4:Show Spaces"
} , {
" F1:Help R:Redraw Screen Alt+A:Select Char Set Alt+D:Default Colors",
-" ESC:Exit Alt+L:Test SAM Alt+Y:Debug Mode Alt+N:Music"
+" ESC:Exit Alt+L:Test SAM Alt+Y:Debug Mode Alt+N:Music Alt+8:Mod *"
} };
int far menu_keys[NUM_MENUS+1][2][28]={ {
@@ -222,10 +223,6 @@ void add_ext(char far *str,char far *ext) {
}
void edit_world(void) {
-#ifdef SCREENDUMP
- unsigned char far *scrn=
- (unsigned char far *)MK_FP(current_pg_seg,0);
-#endif
int t1,t2,t3,t4,t5,t6,t7,t8,t9,t0;
int key;
char temp[20];
@@ -575,69 +572,9 @@ void edit_world(void) {
if((key==' ')||(key==13)) key=-48;
re_evaul_key:
switch(key) {
-#ifdef SCREENDUMP
case ']'://Screen .PCX dump
- fp=fopen("dump.pcx","wb");
- //header
- fputc(10,fp);
- fputc(5,fp);
- fputc(1,fp);
- fputc(1,fp);
- t1=0; fwrite(&t1,1,2,fp);
- t1=0; fwrite(&t1,1,2,fp);
- t1=639; fwrite(&t1,1,2,fp);
- t1=349; fwrite(&t1,1,2,fp);
- t1=300; fwrite(&t1,1,2,fp);
- t1=300; fwrite(&t1,1,2,fp);
- //colormap
- for(t1=0;t1<16;t1++) {
- get_rgb(t1,r,g,b);
- fputc(r<<2,fp);
- fputc(g<<2,fp);
- fputc(b<<2,fp);
- }
- //header part 2
- fputc(0,fp);
- fputc(4,fp);
- t1=80; fwrite(&t1,1,2,fp);
- t1=1; fwrite(&t1,1,2,fp);
- t1=640; fwrite(&t1,1,2,fp);
- t1=350; fwrite(&t1,1,2,fp);
- for(t1=0;t1<54;t1++) fputc(0,fp);
- //picture
- for(t1=0;t1<25;t1++) {//25 rows
- for(t5=0;t5<14;t5++) {//14 bitmap rows per char
- t7=1;
- for(t2=0;t2<4;t2++) {//4 planes
- for(t3=0;t3<80;t3++) {//80 columns
- //Check FG color to see if applicable
- t4=(scrn[((t1*80+t3)<<1)+1])&t7;
- if(t4) {
- //Get character
- t4=scrn[(t1*80+t3)<<1];
- //Write character bitmap byte
- t8=ec_read_byte(t4,t5);
- }
- else t8=0;//Byte for this bitplane
- //Check BK color to see if applicable
- t4=((scrn[((t1*80+t3)<<1)+1])>>4)&t7;
- if(t4) {
- //Get character
- t4=scrn[(t1*80+t3)<<1];
- //Write inverse of character bitmap byte
- t8|=255^ec_read_byte(t4,t5);
- }
- //Write byte
- if(t8>191) fputc(193,fp);
- fputc(t8,fp);
- }
- t7<<=1;//Upgrade bit plane
- }
- }
- }
- fclose(fp);
+ dump_screen("SCREEN.PCX");
break;
-#endif
case MOUSE_EVENT://Mouse click
//Possibilities-
//
@@ -3269,6 +3206,16 @@ void edit_world(void) {
}
changed=1;
break;
+ case -127://Alt8
+ if(draw_mode&128) break;
+ //Mod
+ update_menu=1;
+ //Turn off module if one present...
+ if(mod_playing[0]!=0) end_mod();
+ //...else new module
+ str_cpy(mod_playing,"*");
+ changed=1;
+ break;
case -38://AltL
if(draw_mode&128) break;
//Sample
@@ -3451,4 +3398,4 @@ void draw_debug_box(char ypos) {
write_number(t1%10,EC_DEBUG_NUMBER,debug_x+4,ypos+6,current_pg_seg,1);
t1=(unsigned int)(robot_free_mem*100L/62464L);
write_number(t1,EC_DEBUG_NUMBER,debug_x+12,ypos+6,current_pg_seg,0,1);
-}
+}
View
55 egacode.cpp
@@ -31,6 +31,7 @@
//Current set- No reading of characters ever neccesary!
unsigned char far *curr_set;//Size- 14*256 bytes
+static volatile int need_update=1;
//Segment of character set memory
#define CS_Seg 0xb800
@@ -60,7 +61,7 @@ void vga_16p_mode(void) {
int 10h
mov ax,0003h
int 10h
- }
+ }
}
//Access the character set part of the graphics memory (internal function)
@@ -135,13 +136,21 @@ void _access_text(void) {
//Copies the set in memory (curr_set) to the real set in graphics memory
void ec_update_set(void) {
- int t1,t2;
+ int remaining;
unsigned char far *charac=CS_Ptr;
+ unsigned char far *cset=curr_set;
_access_char_sets();
- for(t1=0;t1<256;t1++)
- for(t2=0;t2<14;t2++)
- charac[t1*32+t2]=curr_set[t1*14+t2];
+ for ( remaining = 256 ; remaining
+ ; remaining--, charac += 32, cset += 14 )
+ {
+ mem_cpy(charac, cset, 14);
+ }
_access_text();
+ need_update = 0;
+}
+
+void ec_update_set_if_needed(void) {
+ if (need_update) ec_update_set();
}
//Changes one byte of one character and updates it
@@ -149,33 +158,29 @@ void ec_change_byte(int chr,int byte,int new_value) {
unsigned char far *charac=CS_Ptr;
curr_set[chr*14+byte]=new_value;
_access_char_sets();
- charac[chr*32+byte]=new_value;
+ charac[(chr<<5)+byte]=new_value;
_access_text();
}
//Changes one entire 14-byte character and updates it
-void ec_change_char(int chr,unsigned char far *matrix) {
- int t1;
+void ec_change_char(int chr, unsigned char far *matrix) {
unsigned char far *charac=CS_Ptr;
+ mem_cpy(curr_set+chr*14, matrix, 14);
_access_char_sets();
- for(t1=0;t1<14;t1++) {
- curr_set[chr*14+t1]=matrix[t1];
- charac[chr*32+t1]=matrix[t1];
- }
+ mem_cpy(charac+(chr<<5), matrix, 14);
_access_text();
}
//Changes one byte of one character WITHOUT updating it
void ec_change_byte_nou(int chr,int byte,int new_value) {
curr_set[chr*14+byte]=new_value;
+ need_update = 1;
}
//Changes one entire 14-byte character WITHOUT updating it
void ec_change_char_nou(int chr,unsigned char far *matrix) {
- int t1;
- for(t1=0;t1<14;t1++) {
- curr_set[chr*14+t1]=matrix[t1];
- }
+ mem_cpy(curr_set+chr*14, matrix, 14);
+ need_update = 1;
}
//Reads one byte of a character
@@ -185,8 +190,7 @@ int ec_read_byte(int chr,int byte) {
//Reads an entire 14-byte character
void ec_read_char(int chr,unsigned char far *matrix) {
- int t1;
- for(t1=0;t1<14;t1++) matrix[t1]=curr_set[chr*14+t1];
+ mem_cpy(matrix, curr_set+chr*14, 14);
}
//Initialization function. Call AFTER setting mode with ega_14p.
@@ -198,7 +202,7 @@ char ec_init(void) {
if(curr_set==NULL) return -1;
//Copy default mzx to current and update
mem_cpy((signed char far *)curr_set,
- (signed char far *)default_mzx_char_set,3584);
+ (signed char far *)default_mzx_char_set, 3584);
ec_update_set();
//Done!
return 0;
@@ -220,16 +224,23 @@ char ec_save_set(char far *filename) {
}
//Load a character set from disk
-char ec_load_set(char far *filename) {
+char ec_load_set_nou(char far *filename) {
FILE *fp;
fp=fopen(filename,"rb");
if(fp==NULL) return -1;
fread(curr_set,14,256,fp);
- ec_update_set();
fclose(fp);
+ need_update = 1;
return 0;
}
+char ec_load_set(char far *filename) {
+ char status;
+ status = ec_load_set_nou(filename);
+ if (!status) ec_update_set();
+ return status;
+}
+
//Loads a character set directly from memory (stil 3584 bytes)
void ec_mem_load_set(unsigned char far *chars) {
mem_cpy((signed char far *)curr_set,(signed char far *)chars,3584);
@@ -244,4 +255,4 @@ void ec_load_ascii(void) {
//Loads in the default set (Megazeux)
void ec_load_mzx(void) {
ec_mem_load_set(default_mzx_char_set);
-}
+}
View
4 egacode.h
@@ -48,9 +48,11 @@ char ec_load_set(char far *filename);
//Functions that DON'T auto update
void ec_change_byte_nou(int chr,int byte,int new_value);
void ec_change_char_nou(int chr,unsigned char far *matrix);
+char ec_load_set_nou(char far *filename);
+void ec_update_set_if_needed(void);
void ec_update_set(void);
//The current set (14*256 bytes)
extern unsigned char far *curr_set;
-#endif
+#endif
View
11 ezboard.cpp
@@ -127,7 +127,7 @@ void select_current(unsigned char id) {
int t1;
char temp[FILENAME_SIZE];
//Save current mod...
- str_cpy(temp,mod_playing);
+ str_cpy(temp,real_mod_playing);
//Does board exist?
if(board_where[id]==W_NOWHERE)
error("Attempt to load nonexistent board",2,20,current_pg_seg,0x0401);
@@ -149,15 +149,15 @@ void select_current(unsigned char id) {
board_where[curr_board=id]=W_CURRENT;
board_sizes[id]=0;
//Mods-
- if(str_cmp(mod_playing,temp)) {
+ if( str_cmp(mod_playing,"*") && str_cmp(mod_playing,temp) ) {
//Different mod.
if(mod_playing[0]==0) end_mod();
else {
str_cpy(temp,mod_playing);
load_mod(temp);
volume_mod(volume);
- }
}
+ }
find_player();
//Done!
}
@@ -201,7 +201,8 @@ void clear_current(char adopt_settings) {
if(!adopt_settings) {
end_mod();
mod_playing[0]=0;
- }
+ real_mod_playing[0]=0;
+ }
//Clear page
for(t1=0;t1<10000;t1++) {
level_id[t1]=level_under_id[t1]=level_param[t1]=level_under_param[t1]=0;
@@ -344,4 +345,4 @@ void clear_zero_objects(void) {
clear_robot(0);
clear_scroll(0);
clear_sensor(0);
-}
+}
View
192 game.cpp
@@ -63,6 +63,7 @@
#include "counter.h"
#include "game2.h"
#include "timer.h"
+#include "scrdump.h"
char far *main_menu= "F1/H - Help\n"
"Enter- Menu\n"
@@ -110,14 +111,9 @@ char pal_update=0;//Whether to update a palette from robot activity
void title_screen(void) {
char fadein=0;
int key=0,t1;
-#ifdef SCREENDUMP
- unsigned char far *scrn=
- (unsigned char far *)MK_FP(current_pg_seg,0);
- int t2,t3,t4,t5,t7,t8;
- char r,g,b;
-#endif
FILE *fp;
char temp[FILENAME_SIZE];
+
#ifdef PROFILE
char profiling=0;
#endif
@@ -147,10 +143,10 @@ void title_screen(void) {
set_counter("TIME",time_limit);
insta_fadeout();
fadein=1;
- }
+ }
else goto world_load;//Choose world to load
- goto menu_mesg;
+ if (0 == 0) goto menu_mesg; //stupid hack to shut up tc
//Main game loop
//Mouse remains hidden unless menu/etc. is invoked
@@ -183,69 +179,9 @@ void title_screen(void) {
profiling^=1;
break;
#endif
-#ifdef SCREENDUMP
- case ']'://Screen .PCX dump
- fp=fopen("temp.pcx","wb");
- //header
- fputc(10,fp);
- fputc(5,fp);
- fputc(1,fp);
- fputc(1,fp);
- t1=0; fwrite(&t1,1,2,fp);
- t1=0; fwrite(&t1,1,2,fp);
- t1=639; fwrite(&t1,1,2,fp);
- t1=349; fwrite(&t1,1,2,fp);
- t1=300; fwrite(&t1,1,2,fp);
- t1=300; fwrite(&t1,1,2,fp);
- //colormap
- for(t1=0;t1<16;t1++) {
- get_rgb(t1,r,g,b);
- fputc(r<<2,fp);
- fputc(g<<2,fp);
- fputc(b<<2,fp);
- }
- //header part 2
- fputc(0,fp);
- fputc(4,fp);
- t1=80; fwrite(&t1,1,2,fp);
- t1=1; fwrite(&t1,1,2,fp);
- t1=640; fwrite(&t1,1,2,fp);
- t1=350; fwrite(&t1,1,2,fp);
- for(t1=0;t1<54;t1++) fputc(0,fp);
- //picture
- for(t1=0;t1<25;t1++) {//25 rows
- for(t5=0;t5<14;t5++) {//14 bitmap rows per char
- t7=1;
- for(t2=0;t2<4;t2++) {//4 planes
- for(t3=0;t3<80;t3++) {//80 columns
- //Check FG color to see if applicable
- t4=(scrn[((t1*80+t3)<<1)+1])&t7;
- if(t4) {
- //Get character
- t4=scrn[(t1*80+t3)<<1];
- //Write character bitmap byte
- t8=ec_read_byte(t4,t5);
- }
- else t8=0;//Byte for this bitplane
- //Check BK color to see if applicable
- t4=((scrn[((t1*80+t3)<<1)+1])>>4)&t7;
- if(t4) {
- //Get character
- t4=scrn[(t1*80+t3)<<1];
- //Write inverse of character bitmap byte
- t8|=255^ec_read_byte(t4,t5);
- }
- //Write byte
- if(t8>191) fputc(193,fp);
- fputc(t8,fp);
- }
- t7<<=1;//Upgrade bit plane
- }
- }
- }
- fclose(fp);
- break;
-#endif
+ case ']'://Screen .PCX dump
+ dump_screen("SCREEN.PCX");
+ break;
case 'E'://E
case -66://F8
//Editor
@@ -399,6 +335,9 @@ void title_screen(void) {
if(board_where[curr_board]!=W_NOWHERE)
select_current(curr_board);
else select_current(0);
+ str_cpy(temp,mod_playing);
+ load_mod(temp);
+
send_robot_def(0,10);
//Copy filename
str_cpy(curr_sav,temp);
@@ -493,6 +432,9 @@ void title_screen(void) {
if(board_where[curr_board]!=W_NOWHERE)
select_current(curr_board);
else select_current(0);
+ str_cpy(temp,mod_playing);
+ load_mod(temp);
+
send_robot_def(0,10);
dead=0;
vquick_fadeout();
@@ -877,21 +819,26 @@ void game_settings(void) {
else sfx_on=sfx^1;
//Check- turn music on/off?
if(music==music_on) {
+ char temp2[FILENAME_SIZE];
if(music_on==1) {
music_on=0;
//Turn off music.
- str_cpy(temp,mod_playing);
+ str_cpy(temp,real_mod_playing);
+ str_cpy(temp2,mod_playing);
end_mod();
- str_cpy(mod_playing,temp);
- }
+ str_cpy(real_mod_playing,temp);
+ str_cpy(mod_playing,temp2);
+ }
else if(music_device>0) {
music_on=1;
//Turn on music.
- str_cpy(temp,mod_playing);
+ str_cpy(temp2,mod_playing);
+ str_cpy(temp,real_mod_playing);
load_mod(temp);
- str_cpy(mod_playing,temp);
- }
+ str_cpy(real_mod_playing,temp);
+ str_cpy(mod_playing,temp2);
}
+ }
overall_speed=spd_tmp;
}
@@ -902,16 +849,9 @@ void play_game(char fadein) {
//We have the world loaded, on the proper scene.
//We are faded out. Commence playing!
int t1,key;
-#ifdef SCREENDUMP
- unsigned char far *scrn=
- (unsigned char far *)MK_FP(current_pg_seg,0);
- int t2,t3,t4,t5,t7,t8;
- char r,g,b;
-#endif
FILE *fp;
char temp[FILENAME_SIZE];
char keylbl[5]="KEY?";
-
enter_func("play_game");
set_context(91);
@@ -939,69 +879,9 @@ void play_game(char fadein) {
//...and process
process_key:
switch(key) {
-#ifdef SCREENDUMP
- case ']'://Screen .PCX dump
- fp=fopen("temp.pcx","wb");
- //header
- fputc(10,fp);
- fputc(5,fp);
- fputc(1,fp);
- fputc(1,fp);
- t1=0; fwrite(&t1,1,2,fp);
- t1=0; fwrite(&t1,1,2,fp);
- t1=639; fwrite(&t1,1,2,fp);
- t1=349; fwrite(&t1,1,2,fp);
- t1=300; fwrite(&t1,1,2,fp);
- t1=300; fwrite(&t1,1,2,fp);
- //colormap
- for(t1=0;t1<16;t1++) {
- get_rgb(t1,r,g,b);
- fputc(r<<2,fp);
- fputc(g<<2,fp);
- fputc(b<<2,fp);
- }
- //header part 2
- fputc(0,fp);
- fputc(4,fp);
- t1=80; fwrite(&t1,1,2,fp);
- t1=1; fwrite(&t1,1,2,fp);
- t1=640; fwrite(&t1,1,2,fp);
- t1=350; fwrite(&t1,1,2,fp);
- for(t1=0;t1<54;t1++) fputc(0,fp);
- //picture
- for(t1=0;t1<25;t1++) {//25 rows
- for(t5=0;t5<14;t5++) {//14 bitmap rows per char
- t7=1;
- for(t2=0;t2<4;t2++) {//4 planes
- for(t3=0;t3<80;t3++) {//80 columns
- //Check FG color to see if applicable
- t4=(scrn[((t1*80+t3)<<1)+1])&t7;
- if(t4) {
- //Get character
- t4=scrn[(t1*80+t3)<<1];
- //Write character bitmap byte
- t8=ec_read_byte(t4,t5);
- }
- else t8=0;//Byte for this bitplane
- //Check BK color to see if applicable
- t4=((scrn[((t1*80+t3)<<1)+1])>>4)&t7;
- if(t4) {
- //Get character
- t4=scrn[(t1*80+t3)<<1];
- //Write inverse of character bitmap byte
- t8|=255^ec_read_byte(t4,t5);
- }
- //Write byte
- if(t8>191) fputc(193,fp);
- fputc(t8,fp);
- }
- t7<<=1;//Upgrade bit plane
- }
- }
- }
- fclose(fp);
- break;
-#endif
+ case ']'://Screen .PCX dump
+ dump_screen("SCREEN.PCX");
+ break;
default:
if(key<'1') break;
if((key>'9')&&(key<'A')) break;
@@ -1140,6 +1020,9 @@ void play_game(char fadein) {
if(board_where[curr_board]!=W_NOWHERE)
select_current(curr_board);
else select_current(0);
+ str_cpy(temp,mod_playing);
+ load_mod(temp);
+
send_robot_def(0,10);
//Copy filename
str_cpy(curr_sav,temp);
@@ -1259,6 +1142,10 @@ void play_game(char fadein) {
if(board_where[curr_board]!=W_NOWHERE)
select_current(curr_board);
else select_current(0);
+
+ str_cpy(temp,mod_playing);
+ load_mod(temp);
+
send_robot_def(0,10);
dead=0;
vquick_fadeout();
@@ -1937,6 +1824,8 @@ char update(char game,char &fadein) {
move_player(t1);
}
}
+ //No mouse support on title screen
+ if (game) m_snapshot();
//The following is during gameplay ONLY
if((game)&&(!dead)) {
//Shoot
@@ -2191,6 +2080,7 @@ char update(char game,char &fadein) {
//visible page!
enter_funcn("page_flip",4);
page_flip(current_page);
+ ec_update_set_if_needed();
exit_func();
m_vidseg(current_pg_seg);
}
@@ -2203,12 +2093,14 @@ char update(char game,char &fadein) {
enter_funcn("(update delay)",6);
while(tcycle<(overall_speed-1)*8) ;
exit_func();
- }
- else if(pal_update) update_palette();
+ } else {
+ if(pal_update) update_palette();
+ ec_update_set_if_needed();
+ }
if(fadein) {
vquick_fadein();
fadein=0;
- }
+ }
if(target_board>=0) {
int faded=is_faded();
//Aha.. TELEPORT or ENTRANCE.
View
2  graphics.asm
@@ -617,4 +617,4 @@ endp
ends
-end
+end
View
96 help.doc
@@ -113,32 +113,7 @@ $James "Raptor" Wong
:Please:Registration Info
-MegaZeux is being presented as shareware, that is, try before
-you buy. The unregistered version is completely intact- All
-features are available. However, if you continue to use it,
-you are required to pay for it. Your payment not only gets
-you the registered version, including the additional three
-games available by registration only, but it tells us that
-you enjoy getting great games at such low costs.
-
-If you enjoy MegaZeux and wish to register your copy, send
-15 dollars (US) plus $2 shipping and handling in the USA,
-or $3 shipping and handling in all other countries, to:
-
-$Software Visions
-$4875 Sunset Ave.
-$La Crescenta, CA
-$ 91214-3052
-
-Make out all checks and money orders to Gregory Janson, or
-your order WILL be returned. Please include a copy of our
-order form or a note stating the desired product.
-
-If this is your legally registered copy of MegaZeux, then we
-thank you for supporting shareware. Please remember that you
-may not distribute the registered copy of MegaZeux or the
-game modules that come with it. (CATACOMB.MZX, FOREST.MZX, and
-CHRONOS.MZX) Thank you for not pirating software.
+Megazeux is now freeware, no registration required.
>072:Table of Contents
#HELPONHE.HLP
@@ -172,7 +147,7 @@ $~EWelcome to MegaZeux! Use the arrow keys to Scroll
$~Ethis text, and ESC when you are done reading.
$~BPress END to learn about the NEW FEATURES in
-$~BMegaZeux 2.51!
+$~BMegaZeux 2.51s2!
As you may already know, MegaZeux is a game system which
allows you to play almost limitless worlds in EGA graphics
@@ -206,7 +181,7 @@ ESC now to exit to the game.
>#CONTROLS.HLP:091:Controls
>#THEWORLD.HLP:1st:The World Editor
->#NEWINVER.HLP:1st:WHAT'S NEW in version 2.51!
+>#NEWINVER.HLP:1st:WHAT'S NEW in version 2.51s2!
#CONTROLS.HLP
:091:Controls
@@ -526,6 +501,11 @@ can select an option. The Right mouse button ALWAYS means
Escape or Cancel, just as if you had pressed the ESC key.
This will not work in certain areas.
+***ADDENDUM*** as of mzxs1, certain games may make use of
+the mouse. The right mouse button will no longer emulate
+ESC key. The left likewise does not emulate Enter.
+
+
>#DIALOGBO.HLP:098:How to use dialog boxes
>#MAIN.HLP:072:Table of Contents
#FRIENDSA.HLP
@@ -1104,28 +1084,9 @@ bugs you find in MegaZeux. We also welcome any comments,
criticism, or suggestions. We especially appreciate QUALITY
MegaZeux worlds.
-If you want to contact us, you can reach myself, Gregory Janson,
-creator of MegaZeux, at any of the following locations-
-
- America On-line: GJanson
- Internet: GJanson@@aol.com
-
- US Mail: Software Visions
- 4875 Sunset Ave.
- La Crescenta, CA 91214-3052
-
- Telephone: 818-249-1030
- Non-School hours, Pacific Standard Time
+Since greg has left the community, please email me, JZig,
+at jzig@cncn.com if you have any bug reports.
-These addresses are valid through 6-31-97 or the next release
-of MegaZeux, whichever is first.
-
-If you lead us to fixing a serious bug in MegaZeux (versions
-2.51 and above) we will ship you a free Registered version of
-MegaZeux or another free game if you are already a registered
-user of MegaZeux. Serious bugs are those that cannot easily
-be worked around or can cause damage to hardware or software
-other than MegaZeux itself.
>#MAIN.HLP:072:Table of Contents
#FAQ.HLP
@@ -1254,6 +1215,7 @@ Counters 50 active (value other than 0) at a time,
not including built-in counters such as
Ammo. Setting a counter to 0 clears up a
spot for another counter.
+Note: counters increased to about 1000 in s1.
>#MAIN.HLP:072:Table of Contents
#THEWORLD.HLP
@@ -5933,7 +5895,9 @@ Formatting' section for more advanced programming.
#NEWINVER.HLP
:1st:NEW in Version 2.51! (Changes Since Version 1.03)
-$~ENEW in version 2.50- ALL NEW music/sound code! 32-channels;
+For information on mzx s2, read readme.1st.
+
+$~ENEW in version 2.51- ALL NEW music/sound code! 32-channels;
$~Ebug-free; support for stereo, 16-bit, GUS, and PAS-16;
$~Esupport for many formats and effects; up to four
$~Esimultaneous sound effects!
@@ -5944,10 +5908,40 @@ Sound System' for details on the NEW music system.
>#SOUNDEFX.HLP:1st:MegaZeux's Sound System
-Note- This is a direct translation from the file WHATSNEW.250,
+Note- This is a direct translation from the file WHATSNEW.251,
included with MegaZeux. If you haven't used version 1.03 or
before, you probably won't understand much of this list.
+~E2.51s2final release:
+
+ + Fixed bug involving mod * settings being lost when loading
+ + Should have fixed ems problems some were reporting, if not,
+ just try to get more conventional memory. Enclosed document
+ (convmem.txt) should help you.
+ + Fixed a bug involving direction checking.
+ + Pressing ']' at most any time will now save a screenshot to
+ screen.pcx
+ + Pressing alt+8 in the editor will set the current mod to *.
+
+
+~E2.5.1s2beta release:
+
+ + Added MOD "*", which allows a board to use whatever module
+ the previous board was using; this necessitated a change in
+ the .SAV file format (still need changes in the editor UI
+ to access this feature outside of Robotic)
+ + inmate's semantics for MOD "SOMETHIN.MOD*" aren't
+ immediately possible, although a rough hack is in already
+ + char edits are now not displayed until the beginning of the
+ next cycle; the deferred display should eliminate a lot of
+ flickering
+ + an (at least partial) fix for the infamous UNDER bug
+ + MOUSEX, MOUSEY and BUTTONS are now buffered.
+ + more sane magic handling
+ + can load MZX 2.51 and 2.51S1 worlds, but will only save
+ 2.5.1spider2 format
+
+
~ENew in version 2.51: (quick fix before I do 3.00!)
* Bug where moving north or west towards a board that is
View
2  idput.asm
@@ -1199,4 +1199,4 @@ ends
end
-end
+end
View
44 main.cpp
@@ -58,6 +58,8 @@
#include "mod.h"
#include "game.h"
#include "error.h"
+#define SAVE_INDIVIDUAL
+
//new_settings=1 if Addr IRQ or DMA was updated via CMD line so we
//should keep them even if config is entered
@@ -66,30 +68,19 @@ jmp_buf exit_jump;//Used in error function and nowhere else
extern unsigned int Addr,IRQ,DMA;//Sound card parameters (-1=detect)
#ifdef UNREG
-char *unreg_exit_mesg =
-"Thank you for playing MegaZeux! If you enjoy MegaZeux, you should register it.\n"
-"Registration gets you the remaining three games in the Zeux series and pays\n"
-"for the actual MegaZeux program. When you register, you tell us that you enjoy\n"
-"getting such intellegent games at low costs. To register, send 15 dollars, plus\n"
-"2 for shipping/handling (3 outside the US) to:\n\n"
-"\tSoftware Visions\n"
-"\t4875 Sunset Ave.\n"
-"\tLa Crescenta, CA 91214\n\n"
-"Make checks and money orders payable to Gregory Janson. Include a copy of our\n"
-"order form, or a note stating your name and address and the desired product.\n\n"
-"Remember to read CONTEST.TXT about a world design contest!\n\n"
-"See README.TXT if you are having problems with EMS, memory, or bugs/support.\n"
-"See the Frequently Asked Questions section of MEGAZEUX.DOC if you have a\n"
-"problem, before contacting Software Visions.\n\n$";
+char *unreg_exit_mesg=
+"This message should not be displayed, it is a bug, if it is.";
+
+
#else
-char *reg_exit_mesg =
-"Thank you for registering MegaZeux.\n\n"
-"Remember to read CONTEST.TXT about a world design contest!\n\n"
-"See README.TXT if you are having problems with EMS, memory, or bugs/support.\n"
-"See the Frequently Asked Questions section of MEGAZEUX.DOC if you have a\n"
-"problem, before contacting Software Visions.\n\n"
-" \n\n"
-" MZX2.51S1 improvements by Charles Goetzman \n\n$";
+char *reg_exit_mesg=
+"Thank you for registering MegaZeux.\n\n\n\r"
+"Read the files megazeux.doc and readme.1st if you need help.\n\n\r"
+"Contributors to MZX2.51 version s2:\n\n\r"
+"Charles Goetzman - mzx s1 base and misc. code\n\r"
+"MenTaLguY - anti-flicker code, mouse buffering, mod \"*\"\n\r"
+"Ben Zeigler - under bug fix and getting the thing to run\n\n\r"
+"Visit zeux.org for newer versions of this software\n\n\r$";
#endif
@@ -156,7 +147,7 @@ int main(int argc,char **argv) {
draw_window_box(2,1,77,3,0xB800,120,127,113,0);
draw_window_box(2,4,77,16,0xB800,120,127,113,0);
draw_window_box(2,17,77,23,0xB800,120,127,113,0);
- write_string("MegaZeux version 2.51S1",27,2,127,0xB800);
+ write_string("MegaZeux version 2.51S2",27,2,127,0xB800);
// #ifdef BETA
write_string("BETA- PLEASE DISTRIBUTE",27,17,127,0xB800);
// #endif
@@ -167,7 +158,7 @@ int main(int argc,char **argv) {
write_string("Unregistered Evaluation Copy",25,0,122,0xB800);
#endif
write_string("Graphics card:",4,18,122,0xB800);
- write_string("Processor:",8,19,122,0xB800);
+
write_string("EMS available:",4,20,122,0xB800);
write_string("Core mem free:",4,21,122,0xB800);
write_string("Memory allocs:",4,22,122,0xB800);
@@ -192,7 +183,6 @@ int main(int argc,char **argv) {
//First, show graphics card and processor
if(force_ega) write_string("EGA (command line)",19,18,125,0xB800);
else write_string(gcard_strs[card-3],19,18,121,0xB800);
- write_string(proc_strs[proc-1],19,19,121,0xB800);
//Initialize EMS systems
if(no_ems) write_string("Forced off",19,20,125,0xB800);
else if(setup_EMS()) write_string("None",19,20,124,0xB800);
@@ -657,4 +647,4 @@ void update_config_file(void) {//Updates the speed setting in the .CFG file
fputc(music_gvol,fp);
fputc(sound_gvol,fp);
fclose(fp);
-}
+}
View
1  main.h
@@ -30,4 +30,5 @@ char load_config_file(void);//Returns non-0 if not found
void save_config_file(void);//Saves the .CFG file
void update_config_file(void);//Updates the speed setting in the .CFG file
+
#endif
View
10 mouse.cpp
@@ -26,6 +26,7 @@
#include "beep.h"
#include <_null.h>
#include "mouse.h"
+#include "data.h"
#pragma inline
@@ -170,6 +171,13 @@ void m_init(void) {
//Done!
}
+//Save current mouse state to saved_mouse_* globals
+void m_snapshot(void) {
+ saved_mouse_x = mousex;
+ saved_mouse_y = mousey;
+ saved_mouse_buttons = mybutton;
+}
+
//Change the current video segment
void m_vidseg(unsigned int newseg) {
if(!driver_activated) return;
@@ -313,4 +321,4 @@ int m_buttonstatus(void) {
}
return bits;
-}
+}
View
5 mouse.h
@@ -63,6 +63,9 @@ void m_init(void);
//Deinitialize the mouse routines
void m_deinit(void);
+//Take a snapshot of current mouse state (in saved_mouse_x, etc)
+void m_snapshot(void);
+
//Change the current video segment
void m_vidseg(unsigned int newseg);
@@ -87,4 +90,4 @@ void m_get(mouse_info_rec *mir);
//Return the current status of the mouse buttons
int m_buttonstatus(void);
-#endif
+#endif
View
45 new_mod.cpp
@@ -41,6 +41,7 @@
extern char no_ems;
extern int rob_global_ems;
+
//Error leniency, 0 is least lenient, 2 is most lenient.
//
//Errors in most lenient: (normal game)
@@ -62,6 +63,8 @@ GDMHeader ModHeader; /* Module header */
int ErrorFlag;
int file, MusChans, t1;
unsigned int Addr=0xFFFF,IRQ=0xFF,DMA=0xFF;
+char refresh_mod_playing;
+//char mod_playing[FILENAME_SIZE];
char sfx_chan[4]={ -1,-1,-1,-1 };//Actual IDs of SFX channels (left)
char sfx_chan2[4]={ -1,-1,-1,-1 };//Actual IDs of SFX channels (right)
@@ -110,10 +113,29 @@ int ConvertMOD(int file,int type);
void load_mod(char far *filename) {
int t1,t2;
+ char temp3[FILENAME_SIZE];
+
SCDoing|=512;
SCLoadingName=filename;
if(!music_device) music_on=0;
+ if (!str_cmp(filename, "*")) {
+ if (refresh_mod_playing) {
+ //str_cpy(temp, real_mod_playing);
+ if (str_cmp(real_mod_playing, "*")) {
+
+ str_cpy(temp3, real_mod_playing);
+ load_mod(temp3);
+ } else { // just so we don't eat ourselves recursively
+ error("load_mod(): real_mod_playing is ``*'' -- this is a bug\n",0,8,current_pg_seg,0x0f00);
+ }
+ }
+ str_cpy(mod_playing, "*");
+ refresh_mod_playing = 0;
+ return;
+ }
+ refresh_mod_playing = 0;
+
free_sam_cache(1);//Clear entire sfx cache
save_map_state_EMS(rob_global_ems);
@@ -121,21 +143,23 @@ SCLoadingName=filename;
StopMusic();
StopOutput();
UnloadModule();
- }
+ }
mod_active=0;
mod_playing[0]=0;
+ real_mod_playing[0]=0;
if(!music_on) {
//Save mod playing...
if(filename!=NULL) {
str_cpy(mod_playing,filename);
+ str_cpy(real_mod_playing,filename);
if(!error_mode) error("Music is off- Module is set for board but not loaded",
0,24,current_pg_seg,0x3201);
- }
+ }
restore_map_state_EMS(rob_global_ems);
SCDoing&=~512;
return;
- }
+ }
if(filename==NULL) goto load_empty_mod;
retry_1:
@@ -236,6 +260,7 @@ SCDoing&=~512;
StartOutput(MusChans,0);
StartMusic();
str_cpy(mod_playing,filename);
+ str_cpy(real_mod_playing,filename);
mod_active=2;
restore_map_state_EMS(rob_global_ems);
SCDoing&=~512;
@@ -292,11 +317,14 @@ SCDoing&=~512;
ModHeader.PanMap[(t1<<1)+1]=0xF;
sfx_chan[t1]=(t1<<1);
sfx_chan2[t1]=(t1<<1)+1;
- }
+ }
//Activate up to 4 SFX channels
StartOutput(MusChans,0);
StartMusic();
- if(filename!=NULL) str_cpy(mod_playing,filename);
+ if(filename!=NULL) {
+ str_cpy(mod_playing,filename);
+ str_cpy(real_mod_playing,filename);
+ }
mod_active=1;
restore_map_state_EMS(rob_global_ems);
SCDoing&=~512;
@@ -304,7 +332,10 @@ SCDoing&=~512;
load_no_mod:
mod_active=actual_num_sfx=0;
- if(filename!=NULL) str_cpy(mod_playing,filename);
+ if(filename!=NULL) {
+ str_cpy(mod_playing,filename);
+ str_cpy(real_mod_playing,filename);
+ }
restore_map_state_EMS(rob_global_ems);
SCDoing&=~512;
return;
@@ -1078,4 +1109,4 @@ void fix_global_volumes(void) {
//Call this when music_gvol and/or sound_gvol changes
//This resets all the volumes properly
MusicVolume((volume*music_gvol)>>5);
-}
+}
View
2  random.asm
@@ -72,4 +72,4 @@ endp random_num
ends
-end
+end
View
2  retrace.asm
@@ -60,4 +60,4 @@ endp wait_retrace
ends
-end
+end
View
4,708 runrobo2.cpp
2,365 additions, 2,343 deletions not shown
View
172 saveload.cpp
@@ -22,15 +22,17 @@
// Saving/loading worlds- dialogs and functions
// *** READ THIS!!!! ****
-/* New naming conventions:
+/* New magic strings
.MZX files:
MZX - Ver 1.x MegaZeux
MZ2 - Ver 2.x MegaZeux
- MZA - Ver 2.51S1+ Megazeux, may change to MZB,MZC, up in letters etc.. if neccesary
+ MZA - Ver 2.51S1 Megazeux
+ M\002\011 - 2.5.1spider2+, 2.9.x
.SAV files:
MZSV2 - Ver 2.x MegaZeux
- MZXSA - Ver 2.51S1+ MegaZeux, again, may change if necessary
+ MZXSA - Ver 2.51S1 MegaZeux
+ MZS\002\011 - 2.5.1spider2+, 2.9.x
All others are unchanged.
@@ -62,7 +64,7 @@
#include "roballoc.h"
#include "ems.h"
#include "counter.h"
-
+#define SAVE_INDIVIDUAL
char sd_types[3]={ DE_INPUT,DE_BUTTON,DE_BUTTON };
char sd_xs[3]={ 5,15,37 };
char sd_ys[3]={ 2,4,4 };
@@ -73,6 +75,56 @@ void far *cf_ptr=(void far *)(curr_file);
dialog s_di={ 10,8,69,14,"Save World",3,sd_types,sd_xs,sd_ys,sd_strs,sd_p1s,
&sd_p2s,&cf_ptr,0 };
+static int world_magic(const char magic_string[3]) {
+ if ( magic_string[0] == 'M' ) {
+ if ( magic_string[1] == 'Z' ) {
+ switch (magic_string[2]) {
+ case 'X':
+ return 0x0100;
+ case '2':
+ return 0x0205;
+ case 'A':
+ return 0x0209;
+ default:
+ return 0;
+ }
+ } else {
+ if ( ( magic_string[1] > 1 ) && ( magic_string[1] < 10 ) ) { // I hope to God that MZX doesn't last beyond 9.x
+ return ( (int)magic_string[1] << 8 ) + (int)magic_string[2];
+ } else {
+ return 0;
+ }
+ }
+ } else {
+ return 0;
+ }
+}
+
+static int save_magic(const char magic_string[5]) {
+ if ( ( magic_string[0] == 'M' ) && ( magic_string[1] == 'Z' ) ) {
+ switch (magic_string[2]) {
+ case 'S':
+ if ( ( magic_string[3] == 'V' ) && ( magic_string[4] == '2' ) ) {
+ return 0x0205;
+ } else if ( ( magic_string[3] >= 2 ) && ( magic_string[3] <= 10 ) ) {
+ return ( (int)magic_string[3] << 8 ) + magic_string[4];
+ } else {
+ return 0;
+ }
+ case 'X':
+ if ( ( magic_string[3] == 'S' ) && ( magic_string[4] == 'A' ) ) {
+ return 0x0209;
+ } else {
+ return 0;
+ }
+ default:
+ return 0;
+ }
+ } else {
+ return 0;
+ }
+}
+
char save_world_dialog(void) {
set_context(76);
char t1=run_dialog(&s_di,current_pg_seg);
@@ -114,25 +166,24 @@ void save_world(char far *file,char savegame,char faded) {
if(fp==NULL) {
error("Error saving world",1,24,current_pg_seg,0x0C01);
return;
- }
+ }
//Save it...
save_screen(current_pg_seg);
meter("Saving...",current_pg_seg,meter_curr,meter_target);
- if(savegame) {
- fwrite("MZXSA",1,6,fp);
+ if (savegame) {
+ fwrite("MZS\002\011",1,5,fp);
fputc(curr_board,fp);
xor=0;
- }
- else {
+ } else {
//Name of game-
fwrite(board_list,1,BOARD_NAME_SIZE,fp);
//Pw info-
write_password(fp);
//File type id-
- fwrite("MZA",1,3,fp);
+ fwrite("M\002\011",1,3,fp);
//Get xor code...
xor=get_pw_xor_code();
- }
+ }
//Rest of file is xor encoded. Write character set...
if(xor) mem_xor((char far *)curr_set,3584,xor);
fwrite(curr_set,1,3584,fp);
@@ -156,7 +207,8 @@ void save_world(char far *file,char savegame,char faded) {
fputc(scroll_pointer_color,fp);
fputc(scroll_title_color,fp);
fputc(scroll_arrow_color,fp);
- }
+ fwrite(real_mod_playing,1,FILENAME_SIZE,fp);
+ }
if(xor) mem_xor((char far *)&edge_color,24,xor);
fwrite(&edge_color,1,24,fp);
if(xor) mem_xor((char far *)&edge_color,24,xor);
@@ -182,7 +234,8 @@ void save_world(char far *file,char savegame,char faded) {
fputc(scroll_pointer_color,fp);
fputc(scroll_title_color,fp);
fputc(scroll_arrow_color,fp);
- }
+ fwrite(real_mod_playing,1,FILENAME_SIZE,fp);
+ }
fputc(edge_color^xor,fp);
fputc(first_board^xor,fp);
fputc(endgame_board^xor,fp);
@@ -353,6 +406,7 @@ void save_world(char far *file,char savegame,char faded) {
//set edit to -1 to mean swap world; ie for a game but ignore password if
//it is the same as the current.
char load_world(char far *file,char edit,char savegame,char *faded) {
+ int version;
int t1,t2,nmb;
unsigned char xor;
unsigned long temp,temp2,gl_rob;
@@ -372,17 +426,22 @@ char load_world(char far *file,char edit,char savegame,char *faded) {
save_screen(current_pg_seg);
meter("Loading...",current_pg_seg,meter_curr,meter_target);
if(savegame) {
- fread(tempstr,1,6,fp);
- if(str_cmp(tempstr,"MZXSA")) {
+ fread(tempstr,1,5,fp);
+ version = save_magic(tempstr);
+ if ( version != 0x0209 ) {
restore_screen(current_pg_seg);
- error("Error loading save game",1,24,current_pg_seg,0x2101);
+ if (!version) {
+ error(".SAV files from other versions of MZX are not supported",1,24,current_pg_seg,0x2101);
+ } else {
+ error("Unrecognized magic: file may not be .SAV file",1,24,current_pg_seg,0x2101);
+ }
fclose(fp);
return 1;
- }
+ }
curr_board=fgetc(fp);
xor=0;
- }
- else {
+ refresh_mod_playing = 1;
+ } else {
//Name of game- skip it.
fseek(fp,BOARD_NAME_SIZE,SEEK_CUR);
//Pw info- Save current...
@@ -408,54 +467,33 @@ char load_world(char far *file,char edit,char savegame,char *faded) {
}
}
pw_okay:
- //File type id- check it.
- if(fgetc(fp)!='M') {
- if((protection_method)&&(fgetc(fp)=='M')) {
- //Could be ver 1.0?
- if(fgetc(fp)=='Z')
- if(fgetc(fp)=='X') goto ver1;
- }
- restore_screen(current_pg_seg);
- error("Error loading world",1,24,current_pg_seg,0x0D02);
- protection_method=p_m;
- str_cpy(password,tempstr);
- fclose(fp);
- return 1;
- }
- if(fgetc(fp)!='Z') {
- restore_screen(current_pg_seg);
- error("Error loading world",1,24,current_pg_seg,0x0D03);
- protection_method=p_m;
- str_cpy(password,tempstr);
- fclose(fp);
- return 1;
+ {
+ char magic[3];
+ char error_string[80];
+ fread(magic,1,3,fp);
+ version = world_magic(magic);
+ if ( version < 0x0205 ) {
+ sprintf(error_string, "World is from old version (%d.%d); use converter", ( version & 0xff00 ) >> 8, version & 0xff);
+ version = 0;
+ } else if ( version > 0x0209 ) {
+ sprintf(error_string, "World is from more recent version (%d.%d)", ( version & 0xff00 ) >> 8, version & 0xff);
+ version = 0;
+ } else if ( version == 0 ) {
+ sprintf(error_string, "Unrecognized magic; file may not be MZX world");
}
- //File type id- check ver...
- t1=fgetc(fp);
- if(t1=='X') {
- ver1:
- restore_screen(current_pg_seg);
- //Version 1.02 or earlier
- error("World is from version 1- Use conversion program",
- 0,24,current_pg_seg,0x1C02);
- protection_method=p_m;
- str_cpy(password,tempstr);
- fclose(fp);
- return 1;
- }
- else if((t1!='2')&&(t1!='A')) {
- restore_screen(current_pg_seg);
- //This is not a version 2.00 file
- error("World is from a more recent version of MegaZeux",0,24,
- current_pg_seg,0x0E01);
- fclose(fp);
- protection_method=p_m;
- str_cpy(password,tempstr);
- return 1;
+ if (!version) {
+ restore_screen(current_pg_seg);
+ error(error_string,1,24,current_pg_seg,0x0D02);
+ protection_method=p_m;
+ str_cpy(password,tempstr);
+ fclose(fp);
+ restore_screen(current_pg_seg);
+ return 1;
}
+ }
//Get xor code...
xor=get_pw_xor_code();
- }
+ }
//Version 2.00
//Clear gl robot...
clear_robot(GLOBAL_ROBOT);
@@ -485,7 +523,8 @@ char load_world(char far *file,char edit,char savegame,char *faded) {
scroll_pointer_color=fgetc(fp);
scroll_title_color=fgetc(fp);
scroll_arrow_color=fgetc(fp);
- }
+ fread(real_mod_playing,1,FILENAME_SIZE,fp);
+ }
fread(&edge_color,1,24,fp);
if(xor) mem_xor((char far *)&edge_color,24,xor);
#else
@@ -510,7 +549,8 @@ char load_world(char far *file,char edit,char savegame,char *faded) {
scroll_pointer_color=fgetc(fp);
scroll_title_color=fgetc(fp);
scroll_arrow_color=fgetc(fp);
- }
+ fread(real_mod_playing,1,FILENAME_SIZE,fp);
+ }
edge_color=fgetc(fp)^xor;
first_board=fgetc(fp)^xor;
endgame_board=fgetc(fp)^xor;
@@ -646,4 +686,4 @@ char load_world(char far *file,char edit,char savegame,char *faded) {
fclose(fp);
restore_screen(current_pg_seg);
return 0;
-}
+}
View
101 scrdump.cpp
@@ -0,0 +1,101 @@
+/* $Id: scrdump.c,v 1.4 1999/02/16 05:45:41 mental Exp $
+ * MegaZeux
+ *
+ * Copyright (C) 1996 Greg Janson
+ * Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <dos.h>
+#include "const.h"
+#include "data.h"
+#include "egacode.h"
+#include "palette.h"
+
+//static volatile char rcsid[] = "$Id: scrdump.c,v 1.4 1999/02/16 05:45:41 mental Exp $";
+
+/* FIXME: not endian-safe */
+void dump_screen(const char far *filename) {
+ FILE *fp;
+ int t1, t2, t3, t4, t5, t7, t8;
+ unsigned char *scrn = (unsigned char*)MK_FP(current_pg_seg,0);
+ char r,g,b;
+
+ if (!filename) filename = "screen.pcx";
+ fp=fopen(filename,"wb");
+ //header
+ fputc(10,fp);
+ fputc(5,fp);
+ fputc(1,fp);
+ fputc(1,fp);
+ t1=0; fwrite(&t1,1,2,fp);
+ t1=0; fwrite(&t1,1,2,fp);
+ t1=639; fwrite(&t1,1,2,fp);
+ t1=349; fwrite(&t1,1,2,fp);
+ t1=300; fwrite(&t1,1,2,fp);
+ t1=300; fwrite(&t1,1,2,fp);
+ //colormap
+ for(