Skip to content
Browse files

MegaZeux 2.69b release.

  • Loading branch information...
1 parent 378f1e3 commit a4001e3a59d75da8768d01ff6ed0edea6e03558b @ajs1984 committed Aug 11, 2008
Showing with 115 additions and 41 deletions.
  1. +77 −27 counter.cpp
  2. +4 −0 expr.cpp
  3. +9 −0 game.cpp
  4. +2 −2 main.cpp
  5. +2 −2 main_run.cpp
  6. +6 −3 mouse.cpp
  7. +1 −0 mouse.h
  8. +1 −1 palette.cpp
  9. +7 −2 runrobo2.cpp
  10. +6 −4 saveload.cpp
View
104 counter.cpp
@@ -103,11 +103,31 @@ int get_counter(char far *name,unsigned char id)
// They go up here since they're the most important. - Exo
- if (!str_cmp(name,"LOOPCOUNT"))
+ if(!str_cmp(name,"LOOPCOUNT"))
return robots[id].loop_count;
- if (!str_cmp(name,"LOCAL"))
- return robots[id].blank;
+ if(!strn_cmp(name, "LOCAL", 5))
+ {
+ if(*(name + 5) == 0)
+ {
+ return robots[id].blank;
+ }
+ if((*(name + 6) == 0) && (version_loaded >= 0x246))
+ {
+ switch(*(name + 5))
+ {
+ case '2':
+ {
+ return(((int)robots[id].walk_dir << 8) | ((unsigned int)robots[id].is_locked));
+ }
+ case '3':
+ {
+ return(((int)robots[id].last_touch_dir << 8) |
+ ((unsigned int)robots[id].last_shot_dir));
+ }
+ }
+ }
+ }
//a few counters convert to var's for speed.
if (!strn_cmp(name,"CHAR_", 5))
@@ -733,6 +753,17 @@ int get_counter(char far *name,unsigned char id)
// Mouse info Spid
if(!strn_cmp(name, "MOUSE", 5))
{
+ if(!strn_cmp(name + 5, "_M", 2))
+ {
+ if(!str_cmp(name + 7, "X"))
+ {
+ return mmx;
+ }
+ if(!str_cmp(name + 7, "Y"))
+ {
+ return mmy;
+ }
+ }
if(!str_cmp(name + 5,"X")) return saved_mouse_x;
if(!str_cmp(name + 5,"Y")) return saved_mouse_y;
@@ -802,30 +833,26 @@ int get_counter(char far *name,unsigned char id)
}
}
- if((name[0] == 'R') || (name[0] == 'r'))
+ if(!strn_cmp(name, "RID", 3))
{
- unsigned int n;
-
- if(name[2] == '.')
+ int i;
+ for(i = 0; i < NUM_ROBOTS; i++)
{
- n = (name[1] - 48);
- return(get_counter(name + 3, n));
+ if(!str_cmp(robots[i].robot_name, name + 9))
+ {
+ return(i);
+ }
}
+ }
- if(name[3] == '.')
+ if((name[0] == 'R') || (name[0] == 'r'))
+ {
+ char far *next;
+ unsigned int n = strtol(name + 1, &next, 10);
+ if(*next == '.')
{
- n = (name[1] - 48) * 10;
- n += (name[2] - 48);
- return(get_counter(name + 4, n));
+ return(get_counter(next + 1, n));
}
-
- if(name[4] == '.')
- {
- n = (name[1] - 48) * 100;
- n += (name[2] - 48) * 10;
- n += (name[3] - 48);
- return(get_counter(name + 5, n));
- }
}
if(!strn_cmp(name, "OVERLAY_", 8))
@@ -1026,7 +1053,7 @@ void set_counter(char far *name,int value,unsigned char id)
fclose(input_file);
file_in[0] = 0;
}
- input_file = fopen(name,"rb");
+ input_file = fopen(name, "rb");
str_cpy(file_in, name);
break;
}
@@ -1039,7 +1066,7 @@ void set_counter(char far *name,int value,unsigned char id)
fclose(output_file);
file_out[0] = 0;
}
- output_file = fopen(name,"wb");
+ output_file = fopen(name, "wb");
str_cpy(file_out, name);
break;
}
@@ -1052,8 +1079,9 @@ void set_counter(char far *name,int value,unsigned char id)
fclose(output_file);
file_out[0] = 0;
}
- output_file = fopen(name,"ab");
+ output_file = fopen(name, "ab");
str_cpy(file_out, name);
+ break;
}
case 4:
{
@@ -1116,10 +1144,32 @@ void set_counter(char far *name,int value,unsigned char id)
return;
}
- if(!str_cmp(name,"LOCAL"))
+ if(!strn_cmp(name, "LOCAL", 5))
{
- robots[id].blank=value;
- return;
+ if(*(name + 5) == 0)
+ {
+ robots[id].blank=value;
+ return;
+ }
+ if((*(name + 6) == 0) && (version_loaded >= 0x246))
+ {
+ switch(*(name + 5))
+ {
+ case '2':
+ {
+ robots[id].walk_dir = (unsigned char)(value >> 8);
+ robots[id].is_locked = (unsigned char)(value & 0xFF);
+ return;
+ }
+ case '3':
+ {
+ robots[id].last_touch_dir = (unsigned char)(value >> 8);
+ robots[id].last_shot_dir = (unsigned char)(value & 0xFF);
+ return;
+ }
+
+ }
+ }
}
// Char in a string - Exo
View
4 expr.cpp
@@ -410,6 +410,10 @@ long int evaluate_operation(long int operand_a, int c_operator,
// Division
case 4:
{
+ if(operand_b == 0)
+ {
+ return 0;
+ }
return(operand_a / operand_b);
}
// Modulo
View
9 game.cpp
@@ -1890,6 +1890,15 @@ char update(char game,char &fadein) {
enter_func("update");
pal_update=0;
tcycle=0;//For speed setting
+
+ // Update mouse motion
+ asm {
+ mov ax, 027h
+ int 33h
+ mov mmx, cx
+ mov mmy, dx
+ }
+
if(fadein) {
clear_screen(1824,current_pg_seg);
insta_fadein();
View
4 main.cpp
@@ -153,7 +153,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.69",27,2,127,0xB800);
+ write_string("MegaZeux version 2.69b",27,2,127,0xB800);
// #ifdef BETA
write_string("Beta; please distribute",27,17,127,0xB800);
// #endif
@@ -573,7 +573,7 @@ char scan_options(void) {
if(help) {
if(help==1) puts("\a");
else puts("");
- puts("MegaZeux version 2.69\tCommand line parameters-\n");
+ puts("MegaZeux version 2.69b\tCommand line parameters-\n");
puts(" -? Help with parameters.");
puts("-nomouse Don't use mouse, even if found.");
puts(" -noems Don't use EMS memory, even if available. (NOT RECOMMENDED)");
View
4 main_run.cpp
@@ -150,7 +150,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("MZXRun version 2.68b",27,2,127,0xB800);
+ write_string("MZXRun version 2.69b",27,2,127,0xB800);
// #ifdef BETA
write_string("Beta; please distribute",27,17,127,0xB800);
// #endif
@@ -563,7 +563,7 @@ char scan_options(void) {
if(help) {
if(help==1) puts("\a");
else puts("");
- puts("MZXRun version 2.68b\tCommand line parameters-\n");
+ puts("MZXRun version 2.69b\tCommand line parameters-\n");
puts(" -? Help with parameters.");
puts("-nomouse Don't use mouse, even if found.");
puts(" -noems Don't use EMS memory, even if available. (NOT RECOMMENDED)");
View
9 mouse.cpp
@@ -35,6 +35,7 @@ unsigned int mouseinstalled=0;//Is the mouse installed?
char driver_activated=0;//Is our driver installed?
volatile int mousex,mousey,mybutton;//Character position of mouse
+volatile int mmx, mmy;
volatile int mbufin=0,mbufout=0;//Mouse buffer pointers
char mousefreeze=0;//Is mouse frozen in place?
mouse_info_rec mbuf[MOUSE_BUFFERSIZE];//Mouse event buffer
@@ -57,6 +58,8 @@ int mouse_count=5000;//Countdown to pseudo-hide from non-activity.
//The new mouse handler.
static void far mousehandler(void) {
+ int mmx, mmy;
+
register int conditionmask;
asm {
push ds
@@ -245,8 +248,8 @@ void m_move(int newx,int newy) {
//Convert x/y to pixels
mousex=newx;
mousey=newy;
- newx*=8;
- newy*=14;
+ newx = (newx * 8) + 4;
+ newy = (newy * 14) + 7;
m_hide();
asm {
@@ -321,4 +324,4 @@ int m_buttonstatus(void) {
}
return bits;
-}
+}
View
1 mouse.h
@@ -55,6 +55,7 @@ extern char mousehidden;
extern unsigned int mouseinstalled;
extern char driver_activated;
extern volatile int mousex,mousey,mybutton;
+extern volatile int mmx, mmy;
extern int mouse_count;
//Initialize the mouse routines
View
2 palette.cpp
@@ -213,7 +213,7 @@ void init_smzx_mode()
m_init();
ec_update_set();
default_EGA_hardware_pal[6] = 6;
- //reinit_palette();
+ reinit_palette();
m_show();
if(smzx_mode == 2)
View
9 runrobo2.cpp
@@ -361,8 +361,6 @@ do
case 12://dec c #
unsigned char far *temp_ptr;
tr_msg(&cmd_ptr[2], id);
- if(str_len(ibuff)>=COUNTER_NAME_SIZE)
- ibuff[COUNTER_NAME_SIZE-1]=0;
tr_msg(&cmd_ptr[next_param(cmd_ptr,1)], id, ibuff2);
temp_ptr = ibuff2;
if(string_type(ibuff) == 1)
@@ -423,6 +421,11 @@ do
{
cp = board_list + (curr_board * BOARD_NAME_SIZE);
}
+ if(!str_cmp(tp_2, "ROBOT_NAME"))
+ {
+ cp = robots[id].robot_name;
+ }
+
if(!str_cmp(tp_2, "MOD_NAME"))
{
if(*mod_playing == 0)
@@ -518,6 +521,8 @@ do
}
else
{
+ if(str_len(ibuff)>=COUNTER_NAME_SIZE)
+ ibuff[COUNTER_NAME_SIZE-1]=0;
t1=parse_param(&cmd_ptr[next_param(cmd_ptr,1)],id);
if(cmd==10) set_counter(ibuff,t1,id);
else if(cmd==11) inc_counter(ibuff,t1,id);
View
10 saveload.cpp
@@ -32,6 +32,7 @@
M\x02\x41 - MZX 2.65
M\x02\x44 - MZX 2.68
M\x02\x45 - MZX 2.69
+ M\x02\x46 - MZX 2.69b
.SAV files:
MZSV2 - Ver 2.x MegaZeux
@@ -41,6 +42,7 @@
MZS\x02\x41 - MZX 2.65
MZS\x02\x44 - MZX 2.68
MZS\x02\x45 - MZX 2.69
+ MZS\x02\x46 - MZX 2.69b
All others are unchanged.
@@ -72,10 +74,10 @@
#include "counter.h"
#include "mstring.h"
#include "runrobot.h"
-#define VERSION 0x245
+#define VERSION 0x246
#define SAVE_INDIVIDUAL
-int version_loaded;
+int version_loaded = VERSION;
char sd_types[3]={ DE_INPUT,DE_BUTTON,DE_BUTTON };
char sd_xs[3]={ 5,15,37 };
@@ -183,7 +185,7 @@ void save_world(char far *file,char savegame,char faded) {
save_screen(current_pg_seg);
meter("Saving...",current_pg_seg,meter_curr,meter_target);
if (savegame) {
- fwrite("MZS\x02\x45",1,5,fp);
+ fwrite("MZS\x02\x46",1,5,fp);
fputc(curr_board,fp);
xor=0;
} else {
@@ -192,7 +194,7 @@ void save_world(char far *file,char savegame,char faded) {
//Pw info-
write_password(fp);
//File type id-
- fwrite("M\x02\x45",1,3,fp);
+ fwrite("M\x02\x46",1,3,fp);
//Get xor code...
xor=get_pw_xor_code();
}

0 comments on commit a4001e3

Please sign in to comment.
Something went wrong with that request. Please try again.