diff -u3 mzx_demu/charset.cpp mzxdbg/charset.cpp --- mzx_demu/charset.cpp Sat May 16 20:53:59 1998 +++ mzxdbg/charset.cpp Tue Mar 10 17:36:56 1998 @@ -21,7 +21,7 @@ //CHARSET.CPP- The default mzx char set -#include "f:\svprod\megazeux\source\charset.h" +#include "charset.h" unsigned char far default_mzx_char_set[]={ 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, @@ -503,4 +503,4 @@ 0x0,0x0,0x0,0x0,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x70,0xd8,0x30,0x60,0xc8,0xf8,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x0,0x0,0x0,0x0, -0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 }; +0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0 }; diff -u3 mzx_demu/const.h mzxdbg/const.h --- mzx_demu/const.h Thu Mar 12 04:25:40 1998 +++ mzxdbg/const.h Fri Mar 13 18:00:56 1998 @@ -134,11 +134,11 @@ //VIDEO_SEG is the segment of the first video page. VIDEO_ADD is what to //add per page. #define VIDEO_SEG 0x0b800 -#define VIDEO_ADD 0x0100 +#define VIDEO_ADD 0x0200 //VIDEO_NUM2SEG gives video segment of 0 or 1. Add a ! before your number //for the segment of the opposite number. -#define VIDEO_NUM2SEG(x) ((x)?VIDEO_SEG+VIDEO_ADD:VIDEO_SEG) +#define VIDEO_NUM2SEG(x) ((x)?VIDEO_SEG+VIDEO_ADD:VIDEO_SEG) //Actual number is one less due to reservation of ID #TEMP_STORAGE. #define NUM_ROBOTS 200 @@ -168,4 +168,13 @@ #define MIN_VIEWPORT_X 1 #define MIN_VIEWPORT_Y 1 -#endif +//not a bad place to put in my global stuff.. +extern volatile char robo_on; +extern void robo_activate(); +extern void robo_deactivate(); +extern void robo_toggle(); +extern void robo_push(char *); +extern void robo_watch_id(int); +extern void robo_counters(); + +#endif diff -u3 mzx_demu/edit.cpp mzxdbg/edit.cpp --- mzx_demu/edit.cpp Thu Mar 12 04:25:42 1998 +++ mzxdbg/edit.cpp Wed Mar 11 17:09:30 1998 @@ -63,6 +63,12 @@ #include "saveload.h" #include +int page_opp(int x) +{ + if(x == 0) return 2; + return 0; +} + /* Edit menu- (w/box ends on sides) Current menu name is highlighted. The bottom section zooms to show a list of options for the current menu, although all keys are available at all times. PGUP/PGDN changes menu. @@ -266,7 +272,7 @@ goto no_pflip; } //Pre-page flip - current_pg_seg=VIDEO_NUM2SEG(!current_page); + current_pg_seg=VIDEO_NUM2SEG(current_page); //Draw view OR copy view from old page if(update_view) { //Fill area to blot out overflow @@ -483,7 +489,8 @@ m_show(); } //Page flip - current_page=1-current_page; +// current_page=1-current_page; + current_page=0; //Page flip automatically doesn't occur until NEXT retrace. //But we wait until then so we don't start writing on the //visible page! @@ -586,7 +593,7 @@ 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=349 * 2; fwrite(&t1,1,2,fp); t1=300; fwrite(&t1,1,2,fp); t1=300; fwrite(&t1,1,2,fp); //colormap @@ -602,11 +609,11 @@ 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); + t1=350 * 2; 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 + for(t1=0;t1<50;t1++) {//50 rows + for(t5=0;t5<7;t5++) {//7 bitmap rows per char t7=1; for(t2=0;t2<4;t2++) {//4 planes for(t3=0;t3<80;t3++) {//80 columns @@ -815,7 +822,7 @@ scroll_x=scroll_y=0; do { //Select OTHER page for seg - current_pg_seg=VIDEO_NUM2SEG(!current_page); + current_pg_seg=VIDEO_NUM2SEG(page_opp(current_page)); //Draw border draw_viewport(); //Figure out x/y of top @@ -823,7 +830,7 @@ //Draw screen draw_game_window(t1,t2,current_pg_seg); //Page flip - current_page=1-current_page; + current_page=0; page_flip(current_page); m_vidseg(current_pg_seg); //Retrace diff -u3 mzx_demu/egacode.cpp mzxdbg/egacode.cpp --- mzx_demu/egacode.cpp Thu Mar 12 04:25:44 1998 +++ mzxdbg/egacode.cpp Sat Mar 14 21:46:52 1998 @@ -26,6 +26,7 @@ #include "charset.h" #include "string.h" #include +#include #include #include "egacode.h" @@ -49,6 +50,7 @@ mov ax,0003h int 10h } + textmode(C4350); } //Enter 16-byte high character mode and reset character sets @@ -134,48 +136,95 @@ } //Copies the set in memory (curr_set) to the real set in graphics memory +//We're in 50-line mode, so cut out every other line void ec_update_set(void) { int t1,t2; unsigned char far *charac=CS_Ptr; _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(t1=0;t1<256;t1++) { + for(t2=0;t2<7;t2++) { + if(t2 != 7) { + if(curr_set[t1*14+t2] + + curr_set[t1*14+t2+1] + + curr_set[t1*14+t2+2] + + curr_set[t1*14+t2+3] + + curr_set[t1*14+t2+4] + + curr_set[t1*14+t2+5] + + curr_set[t1*14+t2+6] + + curr_set[t1*14+t2+7] + + curr_set[t1*14+t2+8] + + curr_set[t1*14+t2+9] + + curr_set[t1*14+t2+10] + + curr_set[t1*14+t2+11] + + curr_set[t1*14+t2+12] + + curr_set[t1*14+t2+13] + + curr_set[t1*14+t2+14] < 1792) charac[t1*32+t2]=curr_set[t1*14+(t2*2)] | curr_set[t1*14+(t2*2)+1]; + else charac[t1*32+t2]=curr_set[t1*14+(t2*2)] & curr_set[t1*14+(t2*2)+1]; + } + else charac[t1*32+t2]=curr_set[t1*14+(t2*2)]; + } + } _access_text(); } //Changes one byte of one character and updates it +//We're in 50-line mode, so only do it if it's on an even line 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; - _access_text(); + if(byte % 2 == 0) { + curr_set[chr*14+byte]=new_value; + _access_char_sets(); + charac[chr*32+byte]=new_value; + _access_text(); + } } //Changes one entire 14-byte character and updates it +//We're in 50-line mode, so cut out every other line void ec_change_char(int chr,unsigned char far *matrix) { int t1; unsigned char far *charac=CS_Ptr; _access_char_sets(); - for(t1=0;t1<14;t1++) { - curr_set[chr*14+t1]=matrix[t1]; - charac[chr*32+t1]=matrix[t1]; + for(t1 = 0; t1 < 7; t1++) { + if(t1 != 6) { + if(matrix[t1*14+(t1*2)] + matrix[t1*14+(t1*2)+1] < 254) curr_set[t1*32+t1]=matrix[t1*14+(t1*2)] | matrix[t1*14+(t1*2)+1]; + else curr_set[t1*32+t1]=matrix[t1*14+(t1*2)] & matrix[t1*14+(t1*2)+1]; + + if(matrix[t1*14+(t1*2)] + matrix[t1*14+(t1*2)+1] < 254) charac[t1*32+t1]=matrix[t1*14+(t1*2)] | matrix[t1*14+(t1*2)+1]; + else charac[t1*32+t1]=matrix[t1*14+(t1*2)] & matrix[t1*14+(t1*2)+1]; + +/* curr_set[chr*14+t1]=matrix[t1*2] | matrix[(t1*2)+1]; + charac[chr*32+t1]=matrix[t1*2] | matrix[(t1*2)+1];*/ + } + else { + curr_set[chr*14+t1]=matrix[t1*2]; + charac[chr*32+t1]=matrix[t1*2]; } + } _access_text(); } //Changes one byte of one character WITHOUT updating it +//We're in 50-line mode, so only do it if it's on an even line void ec_change_byte_nou(int chr,int byte,int new_value) { - curr_set[chr*14+byte]=new_value; + if(byte % 2 == 0) { + curr_set[chr*14+byte]=new_value; + } } //Changes one entire 14-byte character WITHOUT updating it +//We're in 50-line mode, so cut out every other line 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]; + for(t1=0;t1<7;t1++) { + if(t1 != 6) { + if(matrix[t1*14+(t1*2)] + matrix[t1*14+(t1*2)+1] < 254) curr_set[t1*32+t1]=matrix[t1*14+(t1*2)] | matrix[t1*14+(t1*2)+1]; + else curr_set[t1*32+t1]=matrix[t1*14+(t1*2)] & matrix[t1*14+(t1*2)+1]; + } + else { + curr_set[chr*14+t1]=matrix[t1*2]; } + } } //Reads one byte of a character diff -u3 mzx_demu/ezboard.cpp mzxdbg/ezboard.cpp --- mzx_demu/ezboard.cpp Sat Feb 28 12:06:36 1998 +++ mzxdbg/ezboard.cpp Fri Mar 13 16:03:28 1998 @@ -307,7 +307,7 @@ pl_saved_x[t1]=pl_saved_y[t1]=pl_saved_board[t1]=0; //Clear counters for(t1=0;t1 #include "egacode.h" #include "profile.h" @@ -56,6 +58,14 @@ #include "game2.h" #include "timer.h" +extern char *robo_buffer; +extern char robo_on; + +extern char far *s; + +int robo_offset, robo_current = 0, rcount, counter_current = 0, counter_offset; +extern int robo_watch; + char far *main_menu= "F1/H - Help\n" "Enter- Menu\n" "Esc - Exit to DOS\n" @@ -74,9 +84,11 @@ "F3 - Save game\n" "F4 - Restore game\n" "F5/Ins- Toggle bomb type\n" - "F6 - Debug menu\n" - "F9 - Quicksave\n" - "F10 - Quickload\n" + "F6 - Become normal\n" + "F7 - Step 1 cycle\n" + "F8 - Toggle robotic\n" + "F9 - Watch robot\n" + "F10 - Watch counter\n" "Arrows- Move\n" "Space - Shoot (w/dir)\n" "Delete- Bomb"; @@ -125,6 +137,9 @@ m_vidseg(current_pg_seg); //Clear screen clear_screen(1824,current_pg_seg); + write_string(robo_buffer, 0, 25, 7, 0xb800); + robo_counters(); + //Palette default_palette(); insta_fadein(); @@ -150,6 +165,7 @@ //Update if(update(0,fadein)) continue; //Keycheck + if(keywaiting()) { //Get key... key=getkey(); @@ -182,7 +198,7 @@ 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=349 * 2; fwrite(&t1,1,2,fp); t1=300; fwrite(&t1,1,2,fp); t1=300; fwrite(&t1,1,2,fp); //colormap @@ -198,11 +214,11 @@ 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); + t1=350 * 2; 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 + for(t1=0;t1<50;t1++) {//50 rows + for(t5=0;t5<14;t5++) {//7 bitmap rows per char t7=1; for(t2=0;t2<4;t2++) {//4 planes for(t3=0;t3<80;t3++) {//80 columns @@ -427,6 +443,7 @@ insta_fadeout(); fadein=1; gameplay: + clear_sfx_queue(); player_restart_x=player_x; player_restart_y=player_y; @@ -881,11 +898,11 @@ void play_game(char fadein) { //We have the world loaded, on the proper scene. //We are faded out. Commence playing! - int t1,key; + int t1,t2,key; #ifdef SCREENDUMP unsigned char far *scrn= (unsigned char far *)MK_FP(current_pg_seg,0); - int t2,t3,t4,t5,t7,t8; + int t3,t4,t5,t7,t8; char r,g,b; #endif FILE *fp; @@ -912,6 +929,10 @@ //Update if(update(1,fadein)) continue; //Keycheck + write_string(robo_buffer, 0, 25, 7, 0xb800); + robo_counters(); + if(robo_on == 2) robo_on = 0; + if(keywaiting()) { //Get key... key=getkey(); @@ -930,7 +951,7 @@ 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=349 * 2; fwrite(&t1,1,2,fp); t1=300; fwrite(&t1,1,2,fp); t1=300; fwrite(&t1,1,2,fp); //colormap @@ -946,11 +967,11 @@ 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); + t1=350 * 2; 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 + for(t1=0;t1<50;t1++) {//50 rows + for(t5=0;t5<7;t5++) {//7 bitmap rows per char t7=1; for(t2=0;t2<4;t2++) {//4 planes for(t3=0;t3<80;t3++) {//80 columns @@ -1013,9 +1034,9 @@ clear_screen(1824,current_pg_seg); insta_fadein(); } - draw_window_box(8,5,35,19,current_pg_seg,25,16,24); - write_string(game_menu,10,6,31,current_pg_seg); - write_string(" Game Menu ",13,5,30,current_pg_seg); + draw_window_box(8,4,35,20,current_pg_seg,25,16,24); + write_string(game_menu,10,5,31,current_pg_seg); + write_string(" Game Menu ",13,4,30,current_pg_seg); show_status();//Status screen too m_show(); do { @@ -1145,107 +1166,158 @@ } break; case -64://F6 - //Debug menu - debug_mode^=1; - if(error_mode) {//If error_mode==0 don't change! - if(debug_mode) error_mode=1; - else error_mode=2; - } + //Debug menu removed + //reset + robo_push("Being normal now."); + robo_on = 1; + for(t2 = 0; t2 < NUM_COUNTERS; t2++) + counters[t2].iswatched = 0; + robo_watch = -1; break; case -65://F7 - //Cheat #1- Give all - if(cheats_active) { - set_counter("GEMS",32767); - set_counter("AMMO",32767); - set_counter("HEALTH",32767); - set_counter("COINS",32767); - set_counter("LIVES",32767); - set_counter("TIME",time_limit); - set_counter("LOBOMBS",32767); - set_counter("HIBOMBS",32767); - score=0; - for(t1=0;t1<16;t1++) keys[t1]=t1; - dead=0;// :) - player_ns_locked=player_ew_locked= - player_attack_locked=0; - } + //Cheat #1 removed + //Step ahead 1 + if(robo_on == 0) { + robo_push("(new cycle)"); + robo_on = 2; + } break; case -66://F8 - //Cheat #2- Zap surrounding - if((cheats_active)&&(!dead)) { - if(player_x>0) { - id_clear(player_x-1,player_y); - if(player_y>0) id_clear(player_x-1,player_y-1); - if(player_y<(board_ysiz-1)) - id_clear(player_x-1,player_y+1); - } - if(player_x<(board_xsiz-1)) { - id_clear(player_x+1,player_y); - if(player_y>0) id_clear(player_x+1,player_y-1); - if(player_y<(board_ysiz-1)) - id_clear(player_x+1,player_y+1); - } - if(player_y>0) id_clear(player_x,player_y-1); - if(player_y<(board_ysiz-1)) - id_clear(player_x,player_y+1); - } + //Cheat #2 removed + //Toggle robot activity + robo_toggle(); break; case -67://F9 - //Quicksave - if(cheats_active>1) break; - if(curr_sav[0]==0) break; - if(!dead) { - //Can we? - if(save_mode==CANT_SAVE) break; - if(save_mode==CAN_SAVE_ON_SENSOR) - if(level_under_id[player_x+max_bxsiz*player_y]!=122) break; - m_show(); - switch_keyb_table(1); - //If faded... - t1=is_faded(); - if(t1) { - clear_screen(1824,current_pg_seg); - insta_fadein(); - } - //Store current - store_current(); - //Save entire game - save_world(curr_sav,1,t1); - //Reload current - select_current(curr_board); - if(t1) insta_fadeout(); - switch_keyb_table(0); - m_hide(); + //Quicksave removed + //Watch robot + save_screen(current_pg_seg); + t1=is_faded(); + if(robo_watch < 0) robo_current = 0; + else robo_current = robo_watch; + if(t1) { + clear_screen(1824,current_pg_seg); + insta_fadein(); } + draw_window_box(30,7,52,18,current_pg_seg,25,16,24); + write_string(" Watch Robot ",35,7,30,current_pg_seg); + + switch_keyb_table(1); /* I need my arrows */ + + wrdrw: + draw_window_box(32,8,50,17,current_pg_seg,16,25,24,0,1); + + for(t2 = 1; t2 < NUM_ROBOTS; t2++) + if(robots[t2].used) rcount = t2; + if(rcount < robo_current) robo_current = 0; + + for(t2 = robo_offset; t2 < rcount + robo_offset + 1; t2++) { + if(t2 == 8 + robo_offset) break; + if(t2 < 0) t2 = 1; /* so i'm lazy.. so what? */ + sprintf(s, "%s (id %d)", robots[t2].robot_name, t2); + s[17] = '\0'; + if(t2 == robo_current) { + write_string(" ", 33, 9 + t2 - robo_offset, 0x3f, current_pg_seg); + if(t2 != 0) write_string(s, 33, 9 + t2 - robo_offset, 0x3f, current_pg_seg); + else write_string("(none)", 33, 9 + t2 - robo_offset, 0x3f, current_pg_seg); + } + else if(t2 != 0) write_string(s, 33, 9 + t2 - robo_offset, 0x1f, current_pg_seg); + else write_string("(none)", 33, 9 + t2 - robo_offset, 0x1f, current_pg_seg); + } + + do { + if(robo_current > 6 + robo_offset & robo_current < rcount) { robo_offset++; goto wrdrw; } + else if(robo_current < robo_offset) { robo_offset--; goto wrdrw; } + key=getkey(); + if(key == -72 & robo_current > 0) { robo_current--; goto wrdrw; } + if(key == -80) { + if(robo_current < rcount) { + robo_current++; + goto wrdrw; + } + } + } while(key != 27 & key != 13); + switch_keyb_table(0); /* back to game mode */ + if(t1) insta_fadeout(); + if(key==27) key=0; + if(key==13) { + key = 0; + if(robo_current != 0) + robo_watch_id(robo_current); + else + robo_watch_id(-1); + } + m_hide(); + restore_screen(current_pg_seg); + break; case -68://F10 - //Quickload - if(cheats_active>1) break; - if(curr_sav[0]==0) break; - m_show(); - switch_keyb_table(1); - //Swap out current board... - store_current(); - clear_current(); - //Load game - fadein=0; - if(load_world(curr_sav,0,1,&fadein)) { - vquick_fadeout(); - m_hide(); - switch_keyb_table(1); - clear_world(); - return; + //Quickload removed + //Watch counter + save_screen(current_pg_seg); + t1=is_faded(); + if(t1) { + clear_screen(1824,current_pg_seg); + insta_fadein(); } - //Swap in starting board - if(board_where[curr_board]!=W_NOWHERE) - select_current(curr_board); - else select_current(0); - send_robot_def(0,10); - dead=0; - vquick_fadeout(); - fadein^=1; - switch_keyb_table(0); + draw_window_box(30,7,52,18,current_pg_seg,25,16,24); + write_string(" Watch Counter ",34,7,30,current_pg_seg); + + switch_keyb_table(1); /* I need my arrows */ + + cwrdrw: + draw_window_box(32,8,50,17,current_pg_seg,16,25,24,0,1); + + for(t2 = 0; t2 < NUM_COUNTERS; t2++) + if(counters[t2].counter_value != 0) rcount = t2; + + if(rcount < counter_current) counter_current = 0; + + for(t2 = counter_offset; t2 < rcount + counter_offset + 1; t2++) { + if(t2 == 8 + counter_offset) break; + if(t2 < 0) t2 = 0; /* so i'm lazy.. so what? */ + sprintf(s, "%s(%d)", counters[t2].counter_name, counters[t2].counter_value); + s[17] = '\0'; + if(t2 == counter_current) { + write_string(" ", 33, 9 + t2 - counter_offset, 0x3f, current_pg_seg); + if(counters[t2].iswatched == 0) write_string(s, 33, 9 + t2 - counter_offset, 0x3f, current_pg_seg); + else write_string(s, 33, 9 + t2 - counter_offset, 0x3e, current_pg_seg); + } + else { + if(counters[t2].iswatched == 0) write_string(s, 33, 9 + t2 - counter_offset, 0x1f, current_pg_seg); + else write_string(s, 33, 9 + t2 - counter_offset, 0x1e, current_pg_seg); + } + } + + do { + if(counter_current > 6 + counter_offset & counter_current < rcount) { counter_offset++; goto cwrdrw; } + else if(counter_current < counter_offset) { counter_offset--; goto cwrdrw; } + key=getkey(); + if(key == -72 & counter_current > 0) { counter_current--; goto cwrdrw; } + if(key == -80) { + if(counter_current < rcount) { + counter_current++; + goto cwrdrw; + } + } + } while(key != 27 & key != 13); + switch_keyb_table(0); /* back to game mode */ + if(t1) insta_fadeout(); + if(key==27) key=0; + if(key==13) { + key = 0; + if(counters[counter_current].iswatched != 1) { + sprintf(s, "--> watching counter \"%s\"(%d)", counters[counter_current].counter_name, counters[counter_current].counter_value); + counters[counter_current].iswatched = 1; + } + else { + sprintf(s, "--> no longer watching counter \"%s\"(%d)", counters[counter_current].counter_name, counters[counter_current].counter_value); + counters[counter_current].iswatched = 0; + } + robo_push(s); + } m_hide(); + restore_screen(current_pg_seg); + break; } } @@ -2007,6 +2079,7 @@ } //Global robot BEFORE other stuff run_robot(NUM_ROBOTS,-1,-1); + if(!slowed) { if(flags[level_under_id[player_x+player_y*max_bxsiz]]&A_ENTRANCE) t1=0; else t1=1;//Not on an entrance yet... @@ -2055,7 +2128,7 @@ set_counter("HEALTH",1); } else { - set_mesg("Game over"); + set_mesg("Thou hast died one too many times!"); b_mesg_row=24; b_mesg_col=255; if(game_over_sfx) play_sfx(24); @@ -2065,7 +2138,7 @@ else if(get_counter("HEALTH")==0) {/* Death */ set_counter("HEALTH",starting_health); dec_counter("Lives"); - set_mesg("You have died..."); + set_mesg("Death befalls thou.."); /* it's my compilation, i can do what i want */ clear_sfx_queue(); play_sfx(23); //Go somewhere else? @@ -2095,7 +2168,7 @@ } //Select OTHER page for seg if(target_where!=-1) { - current_pg_seg=VIDEO_NUM2SEG(!current_page); + current_pg_seg=VIDEO_NUM2SEG(current_page); if(fadein) insta_fadeout(); //Draw border draw_viewport(); @@ -2156,7 +2229,7 @@ write_number(player_y,EC_DEBUG_NUMBER,76,18,current_pg_seg,3); } //Page flip - current_page=1-current_page; + current_page= 0; //Page flip automatically doesn't occur until NEXT retrace. //But we wait until then so we don't start writing on the //visible page! diff -u3 mzx_demu/main.bak mzxdbg/main.bak --- mzx_demu/main.bak Thu Mar 12 04:25:48 1998 +++ mzxdbg/main.bak Wed Apr 8 21:55:48 1998 @@ -57,6 +57,7 @@ #include "mod.h" #include "game.h" #include "error.h" +#include "const.h" //new_settings=1 if Addr IRQ or DMA was updated via CMD line so we //should keep them even if config is entered @@ -64,21 +65,27 @@ jmp_buf exit_jump;//Used in error function and nowhere else extern unsigned int Addr,IRQ,DMA;//Sound card parameters (-1=detect) -char exit_mesg[]= -"MegaZeux 2.51\n\n" -" Copyright (C) 1996 Greg Janson\n" -" Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net\n\n" -" This program is free software; you can redistribute it and/or"\n -" modify it under the terms of the GNU General Public License as\n" -" published by the Free Software Foundation; either version 2 of\n" -" the License, or (at your option) any later version.\n\n" -" This program is distributed in the hope that it will be useful,\n" -" but WITHOUT ANY WARRANTY; without even the implied warranty of\n" -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" -" General Public License for more details.\n\n" -" You should have received a copy of the GNU General Public License\n" -" along with this program; if not, write to the Free Software\n" -" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n\n"; +char exit_mesg[]="\ +MegaZeux 2.51+mzx_dbg_not_as_early_beta\nDO NOT DISTRIBUTE$!&@*()$!@(*$!@\n\n\ + Copyright (C) 1996 Greg Janson\n\ + Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net\n\ + MZX_DBG Copyright (C) Kev Vance 1998 - kvance@uscom.com\n\n\ + This program is free software; you can redistribute it and/or\n\ + modify it under the terms of the GNU General Public License as\n\ + published by the Free Software Foundation; either version 2 of\n\ + the License, or (at your option) any later version.\n\n\ + This program is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\ + General Public License for more details.\n\n\ + You should have received a copy of the GNU General Public License\n\ + along with this program; if not, write to the Free Software\n\ + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n"; + +extern char far *robo_buffer; +extern char far *robo_buffer2; +extern char far *s; + #pragma warn -par int main(int argc,char **argv) { //Temp var for number->string conversion @@ -94,6 +101,9 @@ //Set if we need first time help char first_time=0; //Jump destination for exiting to DOS + + robo_buffer[0] = '\0'; + if(setjmp(exit_jump)) {//Exiting to DOS mod_exit(); ret=3; @@ -109,6 +119,16 @@ //Init palette system and fade out init_palette(); vquick_fadeout(); + + robo_push("--> Welcome to mzxdbg by Kev Vance '98. Commands:"); + robo_push("--> F6 -- become normal"); + robo_push("--> F7 -- robot step ahead"); + robo_push("--> F8 -- toggle robot activity"); + robo_push("--> F9 -- watch robot"); + robo_push("--> F10 -- watch counter"); + robo_activate(); + robo_watch_id(-1); + //Setup directory strings //Get megazeux directory str_cpy(help_file,argv[0]); @@ -205,6 +225,7 @@ install_timer(); //Allocate misc. memory t1=0;//Set to 1 for error + board_list=(char far *)farmalloc(NUM_BOARDS*BOARD_NAME_SIZE); if(board_list==NULL) t1=1; board_offsets=(bOffset far *)farmalloc(NUM_BOARDS*sizeof(bOffset)); @@ -429,6 +450,9 @@ sfx_exit(); clear_world(); exit_robot_mem(); + free(s); + free(robo_buffer); + free(robo_buffer2); if(board_list!=NULL) farfree(board_list); if(board_offsets!=NULL) farfree(board_offsets); if(board_sizes!=NULL) farfree(board_sizes); @@ -460,13 +484,15 @@ if((vga_avail)||((force_ega)&&(card>=VGAm))) vga_16p_mode(); cursor_underline(); - asm push ds +/* asm push ds asm mov dx,SEG exit_mesg asm mov ds,dx asm lds dx,ds:exit_mesg asm mov ah,9 asm int 21h - asm pop ds + asm pop ds */ /* screw this.. */ + + printf(exit_mesg); profiling_summary(); diff -u3 mzx_demu/main.cpp mzxdbg/main.cpp --- mzx_demu/main.cpp Thu Mar 12 04:26:42 1998 +++ mzxdbg/main.cpp Tue Apr 21 11:21:16 1998 @@ -57,6 +57,7 @@ #include "mod.h" #include "game.h" #include "error.h" +#include "const.h" //new_settings=1 if Addr IRQ or DMA was updated via CMD line so we //should keep them even if config is entered @@ -64,21 +65,27 @@ jmp_buf exit_jump;//Used in error function and nowhere else extern unsigned int Addr,IRQ,DMA;//Sound card parameters (-1=detect) -char exit_mesg[]= -"MegaZeux 2.51\n\n" -" Copyright (C) 1996 Greg Janson\n" -" Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net\n\n" -" This program is free software; you can redistribute it and/or\n" -" modify it under the terms of the GNU General Public License as\n" -" published by the Free Software Foundation; either version 2 of\n" -" the License, or (at your option) any later version.\n\n" -" This program is distributed in the hope that it will be useful,\n" -" but WITHOUT ANY WARRANTY; without even the implied warranty of\n" -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" -" General Public License for more details.\n\n" -" You should have received a copy of the GNU General Public License\n" -" along with this program; if not, write to the Free Software\n" -" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n\n"; +char exit_mesg[]="\ +MegaZeux 2.51+mzx_dbg_pre1\nDO NOT DISTRIBUTE$!&@*()$!@(*$!@\n\n\ + Copyright (C) 1996 Greg Janson\n\ + Copyright (C) 1998 Matthew D. Williams - dbwilli@scsn.net\n\ + MZX_DBG Copyright (C) Kev Vance 1998 - kvance@uscom.com\n\n\ + This program is free software; you can redistribute it and/or\n\ + modify it under the terms of the GNU General Public License as\n\ + published by the Free Software Foundation; either version 2 of\n\ + the License, or (at your option) any later version.\n\n\ + This program is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n\ + General Public License for more details.\n\n\ + You should have received a copy of the GNU General Public License\n\ + along with this program; if not, write to the Free Software\n\ + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n"; + +extern char far *robo_buffer; +extern char far *robo_buffer2; +extern char far *s; + #pragma warn -par int main(int argc,char **argv) { //Temp var for number->string conversion @@ -94,6 +101,9 @@ //Set if we need first time help char first_time=0; //Jump destination for exiting to DOS + + robo_buffer[0] = '\0'; + if(setjmp(exit_jump)) {//Exiting to DOS mod_exit(); ret=3; @@ -109,6 +119,16 @@ //Init palette system and fade out init_palette(); vquick_fadeout(); + + robo_push("--> Welcome to mzxdbg by Kev Vance '98. Commands:"); + robo_push("--> F6 -- become normal"); + robo_push("--> F7 -- robot step ahead"); + robo_push("--> F8 -- toggle robot activity"); + robo_push("--> F9 -- watch robot"); + robo_push("--> F10 -- watch counter"); + robo_activate(); + robo_watch_id(-1); + //Setup directory strings //Get megazeux directory str_cpy(help_file,argv[0]); @@ -205,6 +225,7 @@ install_timer(); //Allocate misc. memory t1=0;//Set to 1 for error + board_list=(char far *)farmalloc(NUM_BOARDS*BOARD_NAME_SIZE); if(board_list==NULL) t1=1; board_offsets=(bOffset far *)farmalloc(NUM_BOARDS*sizeof(bOffset)); @@ -429,6 +450,9 @@ sfx_exit(); clear_world(); exit_robot_mem(); + free(s); + free(robo_buffer); + free(robo_buffer2); if(board_list!=NULL) farfree(board_list); if(board_offsets!=NULL) farfree(board_offsets); if(board_sizes!=NULL) farfree(board_sizes); @@ -460,13 +484,14 @@ if((vga_avail)||((force_ega)&&(card>=VGAm))) vga_16p_mode(); cursor_underline(); - /*asm push ds +/* asm push ds asm mov dx,SEG exit_mesg asm mov ds,dx asm lds dx,ds:exit_mesg asm mov ah,9 asm int 21h - asm pop ds*/ + asm pop ds */ /* screw this.. */ + printf(exit_mesg); profiling_summary(); diff -u3 mzx_demu/runrobo2.cpp mzxdbg/runrobo2.cpp --- mzx_demu/runrobo2.cpp Thu Mar 12 04:25:52 1998 +++ mzxdbg/runrobo2.cpp Sun Apr 26 08:47:06 1998 @@ -52,10 +52,117 @@ #include "roballoc.h" #include +#include + #define parsedir(a,b,c,d) parsedir(a,b,c,d,_bl[0],_bl[1],_bl[2],_bl[3]) #pragma warn -sig +volatile char robo_on = 0; +volatile int robo_newlines = 0; +char far *robo_buffer = (char *) malloc(80*25); +char far *robo_buffer2 = (char *) malloc(80*25); +char far *s = (char *) malloc(80); +int robo_watch = 65535, robo_temp; + +char *dir2string(int d) +{ + if(d == 0) return "IDLE"; + if(d == 1) return "NORTH"; + if(d == 2) return "SOUTH"; + if(d == 3) return "EAST"; + if(d == 4) return "WEST"; + if(d == 5) return "RANDNE"; + if(d == 6) return "RANDEW"; + if(d == 7) return "RANDNE"; + if(d == 8) return "RANDNB"; + if(d == 9) return "SEEK"; + if(d == 10) return "RANDANY"; + if(d == 11) return "BENEATH"; + if(d == 12) return "ANYDIR"; + if(d == 13) return "FLOW"; + if(d == 14) return "NODIR"; + if(d == 15) return "RANDB"; + return "???"; +} + +void robo_counters() +{ + int t1, t2; + char *q, *b; + + for(t1 = 0; t1 < 43 - 25; t1++) + write_string(" ", 59, 25 + t1, 7, 0xb800); + + for(t1 = 0, t2 = 0; t1 < NUM_COUNTERS; t1++) { + if(counters[t1].iswatched == 1) { + itoa(counters[t1].counter_value, b, 10); + write_string(counters[t1].counter_name, 59, 25 + t2, 7, 0xb800); + write_string(b, 79 - str_len(b), 25 + t2, 7, 0xb800); + t2++; + } + if(t2 == 43 - 25) break; + } +} + +void robo_push(char *str1) +{ + int t1, t2; + robo_newlines++; + if(robo_newlines == 18) { + robo_newlines--; + _fmemcpy(robo_buffer2, robo_buffer, 80*25); + for(t1 = 0; t1 < 31337; t1++) { + if(robo_buffer2[t1] == '\0') break; + if(robo_buffer2[t1] != '\n') robo_buffer2[t1] = ' '; + } + write_string(robo_buffer2, 0, 25, 7, 0xb800); + for(t1 = 0; t1 < 31337; t1++) { + if(robo_buffer[t1] == '\n') break; + } + t1++; + for(t2 = 0; t2 < 31337; t2++) { + if(robo_buffer[t1 + t2 - 1] == '\0') break; + robo_buffer[t2] = robo_buffer[t1 + t2]; + } + } + str_cat(robo_buffer, str1); + str_cat(robo_buffer, "\n"); + write_string(robo_buffer, 0, 25, 7, 0xb800); +} + +void robo_activate() +{ + robo_on = 1; + robo_push("--> Robot activity is toggled on."); +} + +void robo_deactivate() +{ + robo_on = 0; + robo_push("--> Robot activity is toggled off."); +} + +void robo_toggle() +{ + if(robo_on == 0) robo_activate(); + else robo_deactivate(); +} + +void robo_watch_id(int r) +{ + if(r == -1) { + robo_push("--> Not watching robots"); + r = 65535; + } + else { + sprintf(s, "--> Watching robot \"%s\" (id %d) (char '%c'[%d])", robots[r].robot_name, r, robots[r].robot_char, robots[r].robot_char); + robo_push(s); + } + robo_watch = r; +} + + //Run a single robot through a single cycle. //If id is negative, only run it if .status is 2 void run_robot(int id,int x,int y) { @@ -76,6 +183,9 @@ FILE *fp; //Reset global prefixes first_prefix=mid_prefix=last_prefix=0; + + if(robo_on == 0) goto no_running_this_time; + if(id<0) { id=-id; robots[id].xpos=x; @@ -154,9 +264,12 @@ switch(cmd) { case 0://End if(first_cmd) robots[id].status=1; + if(robo_watch == id) robo_push("END"); goto end_prog; case 1://Die + if(robo_watch == id) robo_push("DIE"); case 80://Die item + if(robo_watch == id) robo_push("DIE ITEM"); die: clear_robot(id); if(id4)) { robots[id].walk_dir=0; @@ -217,6 +356,14 @@ break; case 6://Become color thing param if(id==NUM_ROBOTS) goto die; + + if(robo_watch == id) { + t4=next_param(cmd_ptr,1); + t1=parse_param(&cmd_ptr[t4],id); + sprintf(s, "BECOME c%02X %s p%02X", fix_color(parse_param(&cmd_ptr[1],id),level_color[x+y*max_bxsiz]), thing_names[t1], parse_param(&cmd_ptr[t4+3],id)); + robo_push(s); + } + t1=x+y*max_bxsiz; //Color- t2=level_color[t1]; @@ -245,16 +392,30 @@ //Became a robot. Whoopi. break; case 7://Char + if(robo_watch == id) { + t1 = parse_param(&cmd_ptr[1],id); + if(t1 < 32) t1 = ' '; + sprintf(s, "CHAR '%c' (%d)", t1, parse_param(&cmd_ptr[1],id), parse_param(&cmd_ptr[1],id)); + robo_push(s); + } robots[id].robot_char=(unsigned char)parse_param(&cmd_ptr[1],id); break; case 8://Color if(id==NUM_ROBOTS) break; + if(robo_watch == id) { + sprintf(s, "COLOR c%02X", fix_color(parse_param(&cmd_ptr[1],id), level_color[x+y*max_bxsiz])); + robo_push(s); + } level_color[x+y*max_bxsiz]=fix_color(parse_param(&cmd_ptr[1],id), level_color[x+y*max_bxsiz]); break; case 9://Gotoxy if(id==NUM_ROBOTS) break; done=1; + if(robo_watch == id) { + sprintf(s, "GOTOXY %d %d", parse_param(&cmd_ptr[1],id), parse_param(&cmd_ptr[next_param(cmd_ptr,1)],id)); + robo_push(s); + } t1=parse_param(&cmd_ptr[1],id); t2=parse_param(&cmd_ptr[next_param(cmd_ptr,1)],id); prefix_xy(t3,t3,t1,t2,t3,t3,x,y); @@ -282,9 +443,27 @@ 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); - else dec_counter(ibuff,t1,id); + if(cmd==10) { + if(robo_watch == id) { + sprintf(s, "SET \"%s\"(%d) to %d", ibuff, get_counter(ibuff, id), t1); + robo_push(s); + } + set_counter(ibuff,t1,id); + } + else if(cmd==11) { + if(robo_watch == id) { + sprintf(s, "INC \"%s\"(%d) by %d", ibuff, get_counter(ibuff, id), t1); + robo_push(s); + } + inc_counter(ibuff,t1,id); + } + else { + if(robo_watch == id) { + sprintf(s, "DEC \"%s\"(%d) by %d", ibuff, get_counter(ibuff, id), t1); + robo_push(s); + } + dec_counter(ibuff,t1,id); + } last_label=-1;//Allows looping "infinitely" break; case 16://if c?n l @@ -297,20 +476,56 @@ switch(parse_param(&cmd_ptr[next_param(cmd_ptr,1)],id)) { case 0: if(t1==t2) t4=1; + if(robo_watch == id) { + sprintf(s, "IF %d == %d \"%s\"", t1, t2, tr_msg(&cmd_ptr[1+next_param(cmd_ptr,3+next_param(cmd_ptr,1))],id),1); + if(t4 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + robo_push(s); + } break; case 1: if(t1t2) t4=1; + if(robo_watch == id) { + sprintf(s, "IF %d > %d \"%s\"", t1, t2, tr_msg(&cmd_ptr[1+next_param(cmd_ptr,3+next_param(cmd_ptr,1))],id),1); + if(t4 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + robo_push(s); + } break; case 3: if(t1>=t2) t4=1; + if(robo_watch == id) { + sprintf(s, "IF %d >= %d \"%s\"", t1, t2, tr_msg(&cmd_ptr[1+next_param(cmd_ptr,3+next_param(cmd_ptr,1))],id),1); + if(t4 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + robo_push(s); + } break; case 4: if(t1<=t2) t4=1; + if(robo_watch == id) { + sprintf(s, "IF %d <= %d \"%s\"", t1, t2, tr_msg(&cmd_ptr[1+next_param(cmd_ptr,3+next_param(cmd_ptr,1))],id),1); + if(t4 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + robo_push(s); + } break; case 5: + if(robo_watch == id) { + sprintf(s, "IF %d != %d \"%s\"", t1, t2, tr_msg(&cmd_ptr[1+next_param(cmd_ptr,3+next_param(cmd_ptr,1))],id),1); + if(t4 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + robo_push(s); + } if(t1!=t2) t4=1; break; } @@ -321,7 +536,18 @@ } break; case 18://if condition label + if(robo_watch == id) { + sprintf(s, "IF "); + robo_temp = 0; + goto c19; + } case 19://if not cond. label + if(robo_watch == id) { + sprintf(s, "IF NOT "); + robo_temp = 1; + goto c19; + } + c19: t1=parse_param(&cmd_ptr[1],id); t2=((unsigned int)t1)>>8; t1=((unsigned int)t1)&255; @@ -332,24 +558,54 @@ case 0://Walking dir if(t2<5) { if(robots[id].walk_dir==t2) t3=1; - break; } - if(t2==14) { + else if(t2==14) { if(robots[id].walk_dir==0) t3=1; - break; } //assumed anydir - if(robots[id].walk_dir!=0) t3=1; + else if(robots[id].walk_dir!=0) t3=1; + if(robo_watch == id) { + str_cat(s, "WALKING "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 1://swimming if(id==NUM_ROBOTS) break; t2=level_under_id[x+y*max_bxsiz]; if((t2>19)&&(t2<25)) t3=1; + if(robo_watch == id) { + str_cat(s, "SWIMMING \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 2://firewalking if(id==NUM_ROBOTS) break; t2=level_under_id[x+y*max_bxsiz]; if((t2==26)||(t2==63)) t3=1; + if(robo_watch == id) { + str_cat(s, "FIREWALKING \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 3://touching dir if(id==NUM_ROBOTS) break; @@ -358,7 +614,7 @@ t4=x; t5=y; if(move_dir(t4,t5,t2-1)) break; if((player_x==t4)&&(player_y==t5)) t3=1; - break; + goto case3fin; } //either anydir or nodir //is player touching at all? @@ -370,6 +626,19 @@ //t3=1 for anydir if((t2==14)||(t2==0)) //We want NODIR though, so t3^=1; //reverse t3. + case3fin: + if(robo_watch == id) { + str_cat(s, "TOUCHING "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 4://Blocked dir //If REL PLAYER or REL COUNTERS, use special code @@ -449,7 +718,7 @@ //Same as player except with anything if((t2<5)&&(t2>0)) { t3=_bl[t2-1]; - break; + goto case4fin; } //either anydir or nodir //is blocked any dir at all? @@ -458,53 +727,218 @@ if((t2==14)||(t2==0)) //We want NODIR though, so t3^=1; //reverse t3. } + case4fin: + if(robo_watch == id) { + str_cat(s, "BLOCKED "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 5://Aligned if(id==NUM_ROBOTS) break; if((player_x==x)||(player_y==y)) t3=1; + if(robo_watch == id) { + str_cat(s, "ALIGNED \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 6://AlignedNS if(id==NUM_ROBOTS) break; if(player_x==x) t3=1; + if(robo_watch == id) { + str_cat(s, "ALIGNEDNS \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 7://AlignedEW if(id==NUM_ROBOTS) break; if(player_y==y) t3=1; + if(robo_watch == id) { + str_cat(s, "ALIGNEDEW \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 8://LASTSHOT dir (only 1-4 accepted) if(id==NUM_ROBOTS) break; - if((t2<1)||(t2>4)) break; + if((t2<1)||(t2>4)) goto case8fin; if(t2==robots[id].last_shot_dir) t3=1; + case8fin: + if(robo_watch == id) { + str_cat(s, "LASTSHOT "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 9://LASTTOUCH dir (only 1-4 accepted) if(id==NUM_ROBOTS) break; t2=parsedir(t2,x,y,robots[id].walk_dir); - if((t2<1)||(t2>4)) break; + if((t2<1)||(t2>4)) goto case9fin; + case9fin: if(t2==robots[id].last_touch_dir) t3=1; + if(robo_watch == id) { + str_cat(s, "LASTTOUCH "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 10://RTpressed if(rt_pressed) t3=1; + if(robo_watch == id) { + str_cat(s, "RIGHTPRESSED "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 11://LTpressed if(lf_pressed) t3=1; + if(robo_watch == id) { + str_cat(s, "LEFTPRESSED "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 12://UPpressed if(up_pressed) t3=1; + if(robo_watch == id) { + str_cat(s, "UPPRESSED "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 13://dnpressed if(dn_pressed) t3=1; + if(robo_watch == id) { + str_cat(s, "DOWNPRESSED "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 14://sppressed if(sp_pressed) t3=1; + if(robo_watch == id) { + str_cat(s, "SPACEPRESSED "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 15://delpressed if(del_pressed) t3=1; + if(robo_watch == id) { + str_cat(s, "DELPRESSED "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 16://musicon if(music_on) t3=1; + if(robo_watch == id) { + str_cat(s, "MUSICON "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; case 17://soundon if(sfx_on) t3=1; + if(robo_watch == id) { + str_cat(s, "SOUNDON "); + str_cat(s, dir2string(t2)); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[5],id)); + str_cat(s, "\""); + if(robo_temp == 1) t3 ^= 1; + if(t3 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t3 ^= 1; + robo_push(s); + } break; } if(cmd==19) t3^=1;//Reverse truth if NOT is present @@ -514,7 +948,17 @@ } break; case 20://if any thing label + if(robo_watch == id) { + sprintf(s, "IF ANY c"); + robo_temp = 0; + goto c21; + } case 21://if no thing label + if(robo_watch == id) { + sprintf(s, "IF NO c"); + robo_temp = 0; + } + c21: //Get foreg/backg allowed in t1/t2 t1=parse_param(&cmd_ptr[1],id);//Color t3=parse_param(&cmd_ptr[next_param(cmd_ptr,1)],id);//Thing @@ -548,23 +992,63 @@ if(t6!=t4) continue; } t5=21-cmd; - break; + goto c21fin; } if(t5) { send_robot_id(id,tr_msg(&cmd_ptr[1+next_param(cmd_ptr, next_param(cmd_ptr,next_param(cmd_ptr,1)))],id),1); gotoed=1; } + c21fin: + if(robo_watch == id) { + sprintf(ibuff, "%02X", t1); + str_cat(s, ibuff); + str_cat(s, " "); + str_cat(s, thing_names[t3]); + str_cat(s, " p"); + sprintf(ibuff, "%02X", t4); + str_cat(s, ibuff); + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[1+next_param(cmd_ptr, next_param(cmd_ptr,next_param(cmd_ptr,1)))],id)); + str_cat(s, "\""); + if(robo_temp == 1) t5 ^= 1; + if(t5 == 1) str_cat(s, " (true)"); + else str_cat(s, " (false)"); + if(robo_temp == 1) t5 ^= 1; + robo_push(s); + } break; case 22://if thing dir + if(robo_watch == id) { + sprintf(s, "IF "); + robo_temp = 0; + goto c23; + } case 23://if NOT thing dir + if(robo_watch == id) { + sprintf(s, "IF NOT "); + robo_temp = 1; + } + c23: t1=x; t2=y; t4=1; t3=next_param(cmd_ptr,next_param(cmd_ptr,next_param(cmd_ptr,t4))); t9=1+next_param(cmd_ptr,t3); t3=parse_param(&cmd_ptr[t3],id); + if(robo_watch == id) { + sprintf(ibuff, "c%02X ", parse_param(&cmd_ptr[t4],id)); + str_cat(s, ibuff); + str_cat(s, thing_names[parse_param(&cmd_ptr[next_param(cmd_ptr,t4)],id)]); + sprintf(ibuff, " p%02X %s \"%s\" ", parse_param(&cmd_ptr[next_param(cmd_ptr,next_param(cmd_ptr,t4))],id), dir2string(t3), tr_msg(&cmd_ptr[next_param(cmd_ptr,next_param(cmd_ptr,next_param(cmd_ptr,next_param(cmd_ptr,1))))], id)); + str_cat(s, ibuff); + robo_push(s); + } goto if_thing_dir; case 24://if thing x y + if(robo_watch == id) { + sprintf(s, "IF "); + robo_temp = 1; + } t4=1; t3=next_param(cmd_ptr,next_param(cmd_ptr,next_param(cmd_ptr,t4))); t9=1+next_param(cmd_ptr,next_param(cmd_ptr,t3)); @@ -2354,7 +2838,12 @@ exit_func(); return; case 227://If allignedrobot str str - if(id==NUM_ROBOTS) break; + if(id==NUM_ROBOTS) { + if(robo_watch == id) { + robo_push("IF ALLIGNEDROBOT(false)..."); + } + break; + } tr_msg(&cmd_ptr[2],id); for(t1=0;t1=0) input_string[t1]=32; + if(robo_watch == id) { + str_cat(s, " \""); + str_cat(s, tr_msg(&cmd_ptr[2],id)); + str_cat(s, "\" \""); + str_cat(s,tr_msg(&cmd_ptr[1+next_param(cmd_ptr,1)], id)); + str_cat(s, "\""); + if(t1 == -1) str_cat(s, "(false)"); + else str_cat(s, "(true)"); + robo_push(s); + } break; case 233://Wait mod fade + if(robo_watch == id) { + sprintf(s, "WAIT MOD FADE (%d -> %d)", volume, volume_target); + robo_push(s); + } if(volume!=volume_target) goto breaker; break; case 235://Enable saving + if(robo_watch == id) { + robo_push("ENABLE SAVING"); + goto c237; + } case 236://Disable saving + if(robo_watch == id) { + robo_push("DISABLE SAVING"); + goto c237; + } case 237://Enable sensoronly saving + if(robo_watch == id) { + robo_push("ENABLE SENSORONLY SAVING"); + } + c237: save_mode=cmd-235; break; case 238://Status counter ## str t1=parse_param(&cmd_ptr[1],id); t2=1+next_param(cmd_ptr,1); - if((t1<1)||(t1>6)) break; + if(robo_watch == id) { + sprintf(s, "STATUS COUNTER %d", t1); + } + if((t1<1)||(t1>6)) { + if(robo_watch == id) { + str_cat(s, "(invalid)..."); + robo_push(s); + } + break; + } tr_msg(&cmd_ptr[t2],id); if(str_len(ibuff)>=COUNTER_NAME_SIZE) ibuff[COUNTER_NAME_SIZE-1]=0; + if(robo_watch == id) { + str_cat(s, " \""); + str_cat(s, ibuff); + str_cat(s, "\""); + robo_push(s); + } str_cpy(&status_shown_counters[COUNTER_NAME_SIZE*(t1-1)],ibuff); break; case 239://Overlay on + if(robo_watch == id) { + robo_push("OVERLAY ON"); + } + goto c241; case 240://Overlay static + if(robo_watch == id) { + robo_push("OVERLAY STATIC"); + } + goto c241; case 241://Overlay transparent + if(robo_watch == id) { + robo_push("OVERLAY TRANSPARENT"); + } + c241: overlay_mode=cmd-238; break; case 242://put col ch overlay x y @@ -2429,6 +2992,10 @@ t2=parse_param(&cmd_ptr[t0],id); t0=next_param(cmd_ptr,t0); t3=parse_param(&cmd_ptr[t0],id); t0=next_param(cmd_ptr,t0); t4=parse_param(&cmd_ptr[t0],id); + if(robo_watch == id) { + sprintf(s, "PUT c%02X '%c'(%d) OVERLAY %d %d", t1, t2, t2, t3, t4); + robo_push(s); + } prefix_xy(t9,t9,t3,t4,t9,t9,x,y); //t1=color t2=char t3/t4=pos t1=fix_color(t1,overlay_color[t3+t4*max_bxsiz]); @@ -2448,7 +3015,14 @@ if(cmd==245) { t0=next_param(cmd_ptr,t0); t7=parse_param(&cmd_ptr[t0],id); + if(robo_watch == id) { + sprintf(s, "CHANGE OVERLAY c%02X '%c'(%d) c%02X '%c'(%d)", t1, t3, t3, t5, t7, t7); + } } + else { + sprintf(s, "CHANGE OVERLAY c%02X c%02X", t1, t5); + } + robo_push(s); //Change fgbk code to seperate fg/bk codes if(t1&256) { t1^=256; @@ -2484,6 +3058,10 @@ t2=t0+1; t0=next_param(cmd_ptr,t0); t3=parse_param(&cmd_ptr[t0],id); t0=next_param(cmd_ptr,t0); t4=parse_param(&cmd_ptr[t0],id); + if(robo_watch == id) { + sprintf(s, "WRITE OVERLAY c%02X \"%s\" %d %d", t1, tr_msg(&cmd_ptr[t2],id), t3, t4); + robo_push(s); + } prefix_xy(t9,t9,t3,t4,t9,t9,x,y); //Write str cmd_ptr[t2] at t3/t4 in color t1 t5=str_len(tr_msg(&cmd_ptr[t2],id)); @@ -2495,10 +3073,17 @@ } break; case 251://Loop start + if(robo_watch == id) { + robo_push("LOOP START"); + } robots[id].loop_count=0; break; case 252://Loop # t1=parse_param(&cmd_ptr[1],id); + if(robo_watch == id) { + sprintf(s, "LOOP %d", t1); + robo_push(s); + } if((robots[id].loop_count++)>=t1) break; //Search backwards for a cmd 251 or start of program t2=robots[id].cur_prog_line; @@ -2510,6 +3095,9 @@ last_label=-1;//Allows looping "infinitely" even w/label inside break; case 253://Abort loop + if(robo_watch == id) { + robo_push("ABORT LOOP"); + } //Search forwards for a cmd 252 or start of program t2=robots[id].cur_prog_line; do { @@ -2520,7 +3108,15 @@ if(!robot[t2]) goto end_prog; break; case 254://Disable mesg edge + if(robo_watch == id) { + robo_push("DISABLE MESG EDGE"); + goto c255; + } case 255://Enable mesg edge + if(robo_watch == id) { + robo_push("ENABLE MESG EDGE"); + } + c255: mesg_edges=cmd-254; break; } @@ -2558,5 +3154,7 @@ //Reset x/y (from movements) robots[id].xpos=x; robots[id].ypos=y; + +no_running_this_time: exit_func(); } diff -u3 mzx_demu/struct.h mzxdbg/struct.h --- mzx_demu/struct.h Sat Feb 28 12:06:40 1998 +++ mzxdbg/struct.h Thu Mar 12 16:30:12 1998 @@ -77,6 +77,7 @@ struct Counter { char counter_name[15]; int counter_value; + char iswatched; }; typedef struct Counter Counter;