From 4f767d54c7ac468e9a42e22caf716111be1ceba9 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Mon, 23 Nov 1998 01:29:06 +0100 Subject: [PATCH] rnd-19981123-2 --- src/buttons.c | 317 ++++++++++++++++++++++++++++++++++++++++++ src/buttons.h | 374 +++++--------------------------------------------- src/editor.c | 18 +++ src/editor.h | 19 +-- src/events.c | 5 + src/files.c | 70 +++++++--- src/game.c | 80 +++++++++++ src/game.h | 22 --- src/main.c | 1 - src/main.h | 152 +++----------------- src/misc.c | 3 + src/screens.c | 23 +++- src/screens.h | 11 -- 13 files changed, 550 insertions(+), 545 deletions(-) diff --git a/src/buttons.c b/src/buttons.c index d3eb443a..d9c2c47f 100644 --- a/src/buttons.c +++ b/src/buttons.c @@ -17,6 +17,323 @@ #include "editor.h" #include "tape.h" +/* some positions in the video tape control window */ +#define VIDEO_BUTTON_EJECT_XPOS (VIDEO_CONTROL_XPOS + 0 * VIDEO_BUTTON_XSIZE) +#define VIDEO_BUTTON_STOP_XPOS (VIDEO_CONTROL_XPOS + 1 * VIDEO_BUTTON_XSIZE) +#define VIDEO_BUTTON_PAUSE_XPOS (VIDEO_CONTROL_XPOS + 2 * VIDEO_BUTTON_XSIZE) +#define VIDEO_BUTTON_REC_XPOS (VIDEO_CONTROL_XPOS + 3 * VIDEO_BUTTON_XSIZE) +#define VIDEO_BUTTON_PLAY_XPOS (VIDEO_CONTROL_XPOS + 4 * VIDEO_BUTTON_XSIZE) +#define VIDEO_BUTTON_ANY_YPOS (VIDEO_CONTROL_YPOS) +#define VIDEO_DATE_LABEL_XPOS (VIDEO_DISPLAY1_XPOS) +#define VIDEO_DATE_LABEL_YPOS (VIDEO_DISPLAY1_YPOS) +#define VIDEO_DATE_LABEL_XSIZE (VIDEO_DISPLAY_XSIZE) +#define VIDEO_DATE_LABEL_YSIZE (VIDEO_DISPLAY_YSIZE) +#define VIDEO_DATE_XPOS (VIDEO_DISPLAY1_XPOS+1) +#define VIDEO_DATE_YPOS (VIDEO_DISPLAY1_YPOS+14) +#define VIDEO_DATE_XSIZE (VIDEO_DISPLAY_XSIZE) +#define VIDEO_DATE_YSIZE 16 +#define VIDEO_REC_LABEL_XPOS (VIDEO_DISPLAY2_XPOS) +#define VIDEO_REC_LABEL_YPOS (VIDEO_DISPLAY2_YPOS) +#define VIDEO_REC_LABEL_XSIZE 20 +#define VIDEO_REC_LABEL_YSIZE 12 +#define VIDEO_REC_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS+20) +#define VIDEO_REC_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS) +#define VIDEO_REC_SYMBOL_XSIZE 16 +#define VIDEO_REC_SYMBOL_YSIZE 16 +#define VIDEO_PLAY_LABEL_XPOS (VIDEO_DISPLAY2_XPOS+65) +#define VIDEO_PLAY_LABEL_YPOS (VIDEO_DISPLAY2_YPOS) +#define VIDEO_PLAY_LABEL_XSIZE 22 +#define VIDEO_PLAY_LABEL_YSIZE 12 +#define VIDEO_PLAY_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS+52) +#define VIDEO_PLAY_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS) +#define VIDEO_PLAY_SYMBOL_XSIZE 11 +#define VIDEO_PLAY_SYMBOL_YSIZE 13 +#define VIDEO_PAUSE_LABEL_XPOS (VIDEO_DISPLAY2_XPOS) +#define VIDEO_PAUSE_LABEL_YPOS (VIDEO_DISPLAY2_YPOS+20) +#define VIDEO_PAUSE_LABEL_XSIZE 35 +#define VIDEO_PAUSE_LABEL_YSIZE 8 +#define VIDEO_PAUSE_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS+35) +#define VIDEO_PAUSE_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS) +#define VIDEO_PAUSE_SYMBOL_XSIZE 17 +#define VIDEO_PAUSE_SYMBOL_YSIZE 13 +#define VIDEO_TIME_XPOS (VIDEO_DISPLAY2_XPOS+38) +#define VIDEO_TIME_YPOS (VIDEO_DISPLAY2_YPOS+14) +#define VIDEO_TIME_XSIZE 50 +#define VIDEO_TIME_YSIZE 16 + +/* special */ +#define VIDEO_PBEND_LABEL_XPOS 6 +#define VIDEO_PBEND_LABEL_YPOS 220 +#define VIDEO_PBEND_LABEL_XSIZE 35 +#define VIDEO_PBEND_LABEL_YSIZE 30 + +#define ON_VIDEO_BUTTON(x,y) ((x)>=(VX+VIDEO_CONTROL_XPOS) && \ + (x)< (VX+VIDEO_CONTROL_XPOS + \ + VIDEO_CONTROL_XSIZE) && \ + (y)>=(VY+VIDEO_CONTROL_YPOS) && \ + (y)< (VY+VIDEO_CONTROL_YPOS + \ + VIDEO_CONTROL_YSIZE)) +#define VIDEO_BUTTON(x) (((x)-(VX+VIDEO_CONTROL_XPOS))/VIDEO_BUTTON_XSIZE) + +#define VIDEO_STATE_OFF (VIDEO_STATE_PLAY_OFF | \ + VIDEO_STATE_REC_OFF | \ + VIDEO_STATE_PAUSE_OFF | \ + VIDEO_STATE_FFWD_OFF | \ + VIDEO_STATE_PBEND_OFF | \ + VIDEO_STATE_DATE_OFF | \ + VIDEO_STATE_TIME_OFF) +#define VIDEO_PRESS_OFF (VIDEO_PRESS_PLAY_OFF | \ + VIDEO_PRESS_REC_OFF | \ + VIDEO_PRESS_PAUSE_OFF | \ + VIDEO_PRESS_STOP_OFF | \ + VIDEO_PRESS_EJECT_OFF) +#define VIDEO_ALL_OFF (VIDEO_STATE_OFF | VIDEO_PRESS_OFF) + +#define VIDEO_STATE_ON (VIDEO_STATE_PLAY_ON | \ + VIDEO_STATE_REC_ON | \ + VIDEO_STATE_PAUSE_ON | \ + VIDEO_STATE_FFWD_ON | \ + VIDEO_STATE_PBEND_ON | \ + VIDEO_STATE_DATE_ON | \ + VIDEO_STATE_TIME_ON) +#define VIDEO_PRESS_ON (VIDEO_PRESS_PLAY_ON | \ + VIDEO_PRESS_REC_ON | \ + VIDEO_PRESS_PAUSE_ON | \ + VIDEO_PRESS_STOP_ON | \ + VIDEO_PRESS_EJECT_ON) +#define VIDEO_ALL_ON (VIDEO_STATE_ON | VIDEO_PRESS_ON) + +#define VIDEO_STATE (VIDEO_STATE_ON | VIDEO_STATE_OFF) +#define VIDEO_PRESS (VIDEO_PRESS_ON | VIDEO_PRESS_OFF) +#define VIDEO_ALL (VIDEO_ALL_ON | VIDEO_ALL_OFF) + + +/* some positions in the sound control window */ +#define SOUND_BUTTON_XSIZE 30 +#define SOUND_BUTTON_YSIZE 30 +#define SOUND_CONTROL_XPOS 5 +#define SOUND_CONTROL_YPOS 245 +#define SOUND_CONTROL_XSIZE (3*SOUND_BUTTON_XSIZE) +#define SOUND_CONTROL_YSIZE (1*SOUND_BUTTON_YSIZE) +#define SOUND_BUTTON_MUSIC_XPOS (SOUND_CONTROL_XPOS + 0 * SOUND_BUTTON_XSIZE) +#define SOUND_BUTTON_LOOPS_XPOS (SOUND_CONTROL_XPOS + 1 * SOUND_BUTTON_XSIZE) +#define SOUND_BUTTON_SIMPLE_XPOS (SOUND_CONTROL_XPOS + 2 * SOUND_BUTTON_XSIZE) +#define SOUND_BUTTON_ANY_YPOS (SOUND_CONTROL_YPOS) + +#define ON_SOUND_BUTTON(x,y) ((x)>=(DX+SOUND_CONTROL_XPOS) && \ + (x)< (DX+SOUND_CONTROL_XPOS + \ + SOUND_CONTROL_XSIZE) && \ + (y)>=(DY+SOUND_CONTROL_YPOS) && \ + (y)< (DY+SOUND_CONTROL_YPOS + \ + SOUND_CONTROL_YSIZE)) +#define SOUND_BUTTON(x) (((x)-(DX+SOUND_CONTROL_XPOS))/SOUND_BUTTON_XSIZE) + +/* some positions in the game control window */ +#define GAME_BUTTON_STOP_XPOS (GAME_CONTROL_XPOS + 0 * GAME_BUTTON_XSIZE) +#define GAME_BUTTON_PAUSE_XPOS (GAME_CONTROL_XPOS + 1 * GAME_BUTTON_XSIZE) +#define GAME_BUTTON_PLAY_XPOS (GAME_CONTROL_XPOS + 2 * GAME_BUTTON_XSIZE) +#define GAME_BUTTON_ANY_YPOS (GAME_CONTROL_YPOS) + +#define ON_GAME_BUTTON(x,y) ((x)>=(DX+GAME_CONTROL_XPOS) && \ + (x)< (DX+GAME_CONTROL_XPOS + \ + GAME_CONTROL_XSIZE) && \ + (y)>=(DY+GAME_CONTROL_YPOS) && \ + (y)< (DY+GAME_CONTROL_YPOS + \ + GAME_CONTROL_YSIZE)) +#define GAME_BUTTON(x) (((x)-(DX+GAME_CONTROL_XPOS))/GAME_BUTTON_XSIZE) + +/* some positions in the asking window */ +#define OK_BUTTON_XPOS 2 +#define OK_BUTTON_YPOS 250 +#define OK_BUTTON_GFX_YPOS 0 +#define OK_BUTTON_XSIZE 46 +#define OK_BUTTON_YSIZE 28 +#define NO_BUTTON_XPOS 52 +#define NO_BUTTON_YPOS OK_BUTTON_YPOS +#define NO_BUTTON_XSIZE OK_BUTTON_XSIZE +#define NO_BUTTON_YSIZE OK_BUTTON_YSIZE +#define CONFIRM_BUTTON_XPOS 2 +#define CONFIRM_BUTTON_GFX_YPOS 30 +#define CONFIRM_BUTTON_YPOS OK_BUTTON_YPOS +#define CONFIRM_BUTTON_XSIZE 96 +#define CONFIRM_BUTTON_YSIZE OK_BUTTON_YSIZE + +#define ON_YESNO_BUTTON(x,y) (((x)>=(DX+OK_BUTTON_XPOS) && \ + (x)< (DX+OK_BUTTON_XPOS + \ + OK_BUTTON_XSIZE) && \ + (y)>=(DY+OK_BUTTON_YPOS) && \ + (y)< (DY+OK_BUTTON_YPOS + \ + OK_BUTTON_YSIZE)) || \ + ((x)>=(DX+NO_BUTTON_XPOS) && \ + (x)< (DX+NO_BUTTON_XPOS + \ + NO_BUTTON_XSIZE) && \ + (y)>=(DY+NO_BUTTON_YPOS) && \ + (y)< (DY+NO_BUTTON_YPOS + \ + NO_BUTTON_YSIZE))) +#define ON_CONFIRM_BUTTON(x,y) (((x)>=(DX+CONFIRM_BUTTON_XPOS) && \ + (x)< (DX+CONFIRM_BUTTON_XPOS + \ + CONFIRM_BUTTON_XSIZE) && \ + (y)>=(DY+CONFIRM_BUTTON_YPOS) && \ + (y)< (DY+CONFIRM_BUTTON_YPOS + \ + CONFIRM_BUTTON_YSIZE))) +#define YESNO_BUTTON(x) (((x)-(DX+OK_BUTTON_XPOS))/OK_BUTTON_XSIZE) + +/* some positions in the choose player window */ +#define PLAYER_BUTTON_XSIZE 30 +#define PLAYER_BUTTON_YSIZE 30 +#define PLAYER_BUTTON_GFX_XPOS 5 +#define PLAYER_BUTTON_GFX_YPOS (215-30) +#define PLAYER_CONTROL_XPOS (5 + PLAYER_BUTTON_XSIZE/2) +#define PLAYER_CONTROL_YPOS (215 - PLAYER_BUTTON_YSIZE/2) +#define PLAYER_CONTROL_XSIZE (2*PLAYER_BUTTON_XSIZE) +#define PLAYER_CONTROL_YSIZE (2*PLAYER_BUTTON_YSIZE) +#define PLAYER_BUTTON_1_XPOS (PLAYER_CONTROL_XPOS + 0 * PLAYER_BUTTON_XSIZE) +#define PLAYER_BUTTON_2_XPOS (PLAYER_CONTROL_XPOS + 1 * PLAYER_BUTTON_XSIZE) +#define PLAYER_BUTTON_3_XPOS (PLAYER_CONTROL_XPOS + 0 * PLAYER_BUTTON_XSIZE) +#define PLAYER_BUTTON_4_XPOS (PLAYER_CONTROL_XPOS + 1 * PLAYER_BUTTON_XSIZE) +#define PLAYER_BUTTON_1_YPOS (PLAYER_CONTROL_YPOS + 0 * PLAYER_BUTTON_YSIZE) +#define PLAYER_BUTTON_2_YPOS (PLAYER_CONTROL_YPOS + 0 * PLAYER_BUTTON_YSIZE) +#define PLAYER_BUTTON_3_YPOS (PLAYER_CONTROL_YPOS + 1 * PLAYER_BUTTON_YSIZE) +#define PLAYER_BUTTON_4_YPOS (PLAYER_CONTROL_YPOS + 1 * PLAYER_BUTTON_YSIZE) + +#define ON_PLAYER_BUTTON(x,y) ((x)>=(DX+PLAYER_CONTROL_XPOS) && \ + (x)< (DX+PLAYER_CONTROL_XPOS + \ + PLAYER_CONTROL_XSIZE) && \ + (y)>=(DY+PLAYER_CONTROL_YPOS) && \ + (y)< (DY+PLAYER_CONTROL_YPOS + \ + PLAYER_CONTROL_YSIZE)) +#define PLAYER_BUTTON(x,y) ((((x)-(DX+PLAYER_CONTROL_XPOS)) / \ + PLAYER_BUTTON_XSIZE) + 2 * \ + (((y)-(DY+PLAYER_CONTROL_YPOS)) / \ + PLAYER_BUTTON_YSIZE)) + + +/* some definitions for the editor control window */ + +#define ON_EDIT_BUTTON(x,y) (((x)>=(VX+ED_BUTTON_CTRL_XPOS) && \ + (x)< (VX+ED_BUTTON_CTRL_XPOS + \ + ED_BUTTON_CTRL_XSIZE) && \ + (y)>=(VY+ED_BUTTON_CTRL_YPOS) && \ + (y)< (VY+ED_BUTTON_CTRL_YPOS + \ + ED_BUTTON_CTRL_YSIZE + \ + ED_BUTTON_FILL_YSIZE)) || \ + ((x)>=(VX+ED_BUTTON_LEFT_XPOS) && \ + (x)< (VX+ED_BUTTON_LEFT_XPOS + \ + ED_BUTTON_LEFT_XSIZE + \ + ED_BUTTON_UP_XSIZE + \ + ED_BUTTON_RIGHT_XSIZE) && \ + (y)>=(VY+ED_BUTTON_LEFT_YPOS) && \ + (y)< (VY+ED_BUTTON_LEFT_YPOS + \ + ED_BUTTON_LEFT_YSIZE)) || \ + ((x)>=(VX+ED_BUTTON_UP_XPOS) && \ + (x)< (VX+ED_BUTTON_UP_XPOS + \ + ED_BUTTON_UP_XSIZE) && \ + (y)>=(VY+ED_BUTTON_UP_YPOS) && \ + (y)< (VY+ED_BUTTON_UP_YPOS + \ + ED_BUTTON_UP_YSIZE + \ + ED_BUTTON_DOWN_YSIZE))) + +#define ON_CTRL_BUTTON(x,y) ((x)>=(VX+ED_BUTTON_EDIT_XPOS) && \ + (x)< (VX+ED_BUTTON_EDIT_XPOS + \ + ED_BUTTON_EDIT_XSIZE) && \ + (y)>=(VY+ED_BUTTON_EDIT_YPOS) && \ + (y)< (VY+ED_BUTTON_EDIT_YPOS + \ + ED_BUTTON_EDIT_YSIZE + \ + ED_BUTTON_CLEAR_YSIZE + \ + ED_BUTTON_UNDO_YSIZE + \ + ED_BUTTON_EXIT_YSIZE)) + +#define ON_ELEM_BUTTON(x,y) (((x)>=(DX+ED_BUTTON_EUP_XPOS) && \ + (x)< (DX+ED_BUTTON_EUP_XPOS + \ + ED_BUTTON_EUP_XSIZE) && \ + (y)>=(DY+ED_BUTTON_EUP_YPOS) && \ + (y)< (DY+ED_BUTTON_EUP_YPOS + \ + ED_BUTTON_EUP_YSIZE)) || \ + ((x)>=(DX+ED_BUTTON_EDOWN_XPOS) && \ + (x)< (DX+ED_BUTTON_EDOWN_XPOS + \ + ED_BUTTON_EDOWN_XSIZE) && \ + (y)>=(DY+ED_BUTTON_EDOWN_YPOS) && \ + (y)< (DY+ED_BUTTON_EDOWN_YPOS + \ + ED_BUTTON_EDOWN_YSIZE)) || \ + ((x)>=(DX+ED_BUTTON_ELEM_XPOS) && \ + (x)< (DX+ED_BUTTON_ELEM_XPOS + \ + MAX_ELEM_X*ED_BUTTON_ELEM_XSIZE) && \ + (y)>=(DY+ED_BUTTON_ELEM_YPOS) && \ + (y)< (DY+ED_BUTTON_ELEM_YPOS + \ + MAX_ELEM_Y*ED_BUTTON_ELEM_YSIZE))) + +#define ON_COUNT_BUTTON(x,y) (((((x)>=ED_COUNT_GADGET_XPOS && \ + (x)<(ED_COUNT_GADGET_XPOS + \ + ED_BUTTON_MINUS_XSIZE)) || \ + ((x)>=(ED_COUNT_GADGET_XPOS + \ + (ED_BUTTON_PLUS_XPOS - \ + ED_BUTTON_MINUS_XPOS)) && \ + (x)<(ED_COUNT_GADGET_XPOS + \ + (ED_BUTTON_PLUS_XPOS - \ + ED_BUTTON_MINUS_XPOS) + \ + ED_BUTTON_PLUS_XSIZE))) && \ + ((y)>=ED_COUNT_GADGET_YPOS && \ + (y)<(ED_COUNT_GADGET_YPOS + \ + 16*ED_COUNT_GADGET_YSIZE)) && \ + (((y)-ED_COUNT_GADGET_YPOS) % \ + ED_COUNT_GADGET_YSIZE) < \ + ED_BUTTON_MINUS_YSIZE) || \ + ((((x)>=ED_SIZE_GADGET_XPOS && \ + (x)<(ED_SIZE_GADGET_XPOS + \ + ED_BUTTON_MINUS_XSIZE)) || \ + ((x)>=(ED_SIZE_GADGET_XPOS + \ + (ED_BUTTON_PLUS_XPOS - \ + ED_BUTTON_MINUS_XPOS)) && \ + (x)<(ED_SIZE_GADGET_XPOS + \ + (ED_BUTTON_PLUS_XPOS - \ + ED_BUTTON_MINUS_XPOS) + \ + ED_BUTTON_PLUS_XSIZE))) && \ + ((y)>=ED_SIZE_GADGET_YPOS && \ + (y)<(ED_SIZE_GADGET_YPOS + \ + 2*ED_SIZE_GADGET_YSIZE)) && \ + (((y)-ED_SIZE_GADGET_YPOS) % \ + ED_SIZE_GADGET_YSIZE) < \ + ED_BUTTON_MINUS_YSIZE)) + +#define EDIT_BUTTON(x,y) (((y) < (VY + ED_BUTTON_CTRL_YPOS + \ + ED_BUTTON_CTRL_YSIZE)) ? 0 : \ + ((y) < (VY + ED_BUTTON_CTRL_YPOS + \ + ED_BUTTON_CTRL_YSIZE + \ + ED_BUTTON_FILL_YSIZE)) ? 1 : \ + ((x) < (VX + ED_BUTTON_LEFT_XPOS + \ + ED_BUTTON_LEFT_XSIZE) ? 2 : \ + (x) > (VX + ED_BUTTON_LEFT_XPOS + \ + ED_BUTTON_LEFT_XSIZE + \ + ED_BUTTON_UP_XSIZE) ? 5 : \ + 3+(((y)-(VY + ED_BUTTON_CTRL_YPOS + \ + ED_BUTTON_CTRL_YSIZE + \ + ED_BUTTON_FILL_YSIZE)) / \ + ED_BUTTON_UP_YSIZE))) + +#define CTRL_BUTTON(x,y) (((y) < (VY + ED_BUTTON_EDIT_YPOS + \ + ED_BUTTON_EDIT_YSIZE)) ? 0 : \ + 1+(((y)-(VY + ED_BUTTON_EDIT_YPOS + \ + ED_BUTTON_EDIT_YSIZE)) / \ + ED_BUTTON_CLEAR_YSIZE)) + +#define ELEM_BUTTON(x,y) (((y) < (DY + ED_BUTTON_EUP_YPOS + \ + ED_BUTTON_EUP_YSIZE)) ? 0 : \ + ((y) > (DY + ED_BUTTON_EDOWN_YPOS)) ? 1 : \ + 2+(((y) - (DY + ED_BUTTON_ELEM_YPOS)) / \ + ED_BUTTON_ELEM_YSIZE)*MAX_ELEM_X + \ + ((x) - (DX + ED_BUTTON_ELEM_XPOS)) / \ + ED_BUTTON_ELEM_XSIZE) + +#define COUNT_BUTTON(x,y) ((x) < ED_SIZE_GADGET_XPOS ? \ + ((((y) - ED_COUNT_GADGET_YPOS) / \ + ED_COUNT_GADGET_YSIZE)*2 + \ + ((x) < (ED_COUNT_GADGET_XPOS + \ + ED_BUTTON_MINUS_XSIZE) ? 0 : 1)) : \ + 32+((((y) - ED_SIZE_GADGET_YPOS) / \ + ED_SIZE_GADGET_YSIZE)*2 + \ + ((x) < (ED_SIZE_GADGET_XPOS + \ + ED_BUTTON_MINUS_XSIZE) ? 0 : 1))) + /****************************************************************/ /********** drawing buttons and corresponding displays **********/ /****************************************************************/ diff --git a/src/buttons.h b/src/buttons.h index c34a1ab6..8111aaeb 100644 --- a/src/buttons.h +++ b/src/buttons.h @@ -16,10 +16,7 @@ #include "main.h" -/* tags to draw video display labels or symbols only */ -#define VIDEO_DISPLAY_DEFAULT 0 -#define VIDEO_DISPLAY_LABEL_ONLY 1 -#define VIDEO_DISPLAY_SYMBOL_ONLY 2 +/* the following definitions are also used by tools.c */ /* some positions in the video tape control window */ #define VIDEO_DISPLAY1_XPOS 5 @@ -34,62 +31,30 @@ #define VIDEO_CONTROL_YPOS 77 #define VIDEO_CONTROL_XSIZE (VIDEO_DISPLAY_XSIZE) #define VIDEO_CONTROL_YSIZE (VIDEO_BUTTON_YSIZE) -#define VIDEO_BUTTON_EJECT_XPOS (VIDEO_CONTROL_XPOS + 0 * VIDEO_BUTTON_XSIZE) -#define VIDEO_BUTTON_STOP_XPOS (VIDEO_CONTROL_XPOS + 1 * VIDEO_BUTTON_XSIZE) -#define VIDEO_BUTTON_PAUSE_XPOS (VIDEO_CONTROL_XPOS + 2 * VIDEO_BUTTON_XSIZE) -#define VIDEO_BUTTON_REC_XPOS (VIDEO_CONTROL_XPOS + 3 * VIDEO_BUTTON_XSIZE) -#define VIDEO_BUTTON_PLAY_XPOS (VIDEO_CONTROL_XPOS + 4 * VIDEO_BUTTON_XSIZE) -#define VIDEO_BUTTON_ANY_YPOS (VIDEO_CONTROL_YPOS) -#define VIDEO_DATE_LABEL_XPOS (VIDEO_DISPLAY1_XPOS) -#define VIDEO_DATE_LABEL_YPOS (VIDEO_DISPLAY1_YPOS) -#define VIDEO_DATE_LABEL_XSIZE (VIDEO_DISPLAY_XSIZE) -#define VIDEO_DATE_LABEL_YSIZE (VIDEO_DISPLAY_YSIZE) -#define VIDEO_DATE_XPOS (VIDEO_DISPLAY1_XPOS+1) -#define VIDEO_DATE_YPOS (VIDEO_DISPLAY1_YPOS+14) -#define VIDEO_DATE_XSIZE (VIDEO_DISPLAY_XSIZE) -#define VIDEO_DATE_YSIZE 16 -#define VIDEO_REC_LABEL_XPOS (VIDEO_DISPLAY2_XPOS) -#define VIDEO_REC_LABEL_YPOS (VIDEO_DISPLAY2_YPOS) -#define VIDEO_REC_LABEL_XSIZE 20 -#define VIDEO_REC_LABEL_YSIZE 12 -#define VIDEO_REC_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS+20) -#define VIDEO_REC_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS) -#define VIDEO_REC_SYMBOL_XSIZE 16 -#define VIDEO_REC_SYMBOL_YSIZE 16 -#define VIDEO_PLAY_LABEL_XPOS (VIDEO_DISPLAY2_XPOS+65) -#define VIDEO_PLAY_LABEL_YPOS (VIDEO_DISPLAY2_YPOS) -#define VIDEO_PLAY_LABEL_XSIZE 22 -#define VIDEO_PLAY_LABEL_YSIZE 12 -#define VIDEO_PLAY_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS+52) -#define VIDEO_PLAY_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS) -#define VIDEO_PLAY_SYMBOL_XSIZE 11 -#define VIDEO_PLAY_SYMBOL_YSIZE 13 -#define VIDEO_PAUSE_LABEL_XPOS (VIDEO_DISPLAY2_XPOS) -#define VIDEO_PAUSE_LABEL_YPOS (VIDEO_DISPLAY2_YPOS+20) -#define VIDEO_PAUSE_LABEL_XSIZE 35 -#define VIDEO_PAUSE_LABEL_YSIZE 8 -#define VIDEO_PAUSE_SYMBOL_XPOS (VIDEO_DISPLAY2_XPOS+35) -#define VIDEO_PAUSE_SYMBOL_YPOS (VIDEO_DISPLAY2_YPOS) -#define VIDEO_PAUSE_SYMBOL_XSIZE 17 -#define VIDEO_PAUSE_SYMBOL_YSIZE 13 -#define VIDEO_TIME_XPOS (VIDEO_DISPLAY2_XPOS+38) -#define VIDEO_TIME_YPOS (VIDEO_DISPLAY2_YPOS+14) -#define VIDEO_TIME_XSIZE 50 -#define VIDEO_TIME_YSIZE 16 -/* special */ -#define VIDEO_PBEND_LABEL_XPOS 6 -#define VIDEO_PBEND_LABEL_YPOS 220 -#define VIDEO_PBEND_LABEL_XSIZE 35 -#define VIDEO_PBEND_LABEL_YSIZE 30 +/* values for requests */ +#define BUTTON_OK (1L<<0) +#define BUTTON_NO (1L<<1) +#define BUTTON_CONFIRM (1L<<2) + +/* values for choosing network player */ +#define BUTTON_PLAYER_1 (1L<<10) +#define BUTTON_PLAYER_2 (1L<<11) +#define BUTTON_PLAYER_3 (1L<<12) +#define BUTTON_PLAYER_4 (1L<<13) + +/* for DrawPlayerButton() */ +#define DB_INIT 0 +#define DB_NORMAL 1 -#define ON_VIDEO_BUTTON(x,y) ((x)>=(VX+VIDEO_CONTROL_XPOS) && \ - (x)< (VX+VIDEO_CONTROL_XPOS + \ - VIDEO_CONTROL_XSIZE) && \ - (y)>=(VY+VIDEO_CONTROL_YPOS) && \ - (y)< (VY+VIDEO_CONTROL_YPOS + \ - VIDEO_CONTROL_YSIZE)) -#define VIDEO_BUTTON(x) (((x)-(VX+VIDEO_CONTROL_XPOS))/VIDEO_BUTTON_XSIZE) +/* the following definitions are also used by screens.c */ + +/* buttons of the video tape player */ +#define BUTTON_VIDEO_EJECT 1 +#define BUTTON_VIDEO_STOP 2 +#define BUTTON_VIDEO_PAUSE 3 +#define BUTTON_VIDEO_REC 4 +#define BUTTON_VIDEO_PLAY 5 /* values for video tape control */ #define VIDEO_STATE_PLAY_OFF (1L<<0) @@ -131,64 +96,10 @@ #define VIDEO_STATE_PBEND_ON (1L<<23) #define VIDEO_STATE_PBEND (VIDEO_STATE_PBEND_OFF | VIDEO_STATE_PBEND_ON) -#define BUTTON_VIDEO_EJECT 1 -#define BUTTON_VIDEO_STOP 2 -#define BUTTON_VIDEO_PAUSE 3 -#define BUTTON_VIDEO_REC 4 -#define BUTTON_VIDEO_PLAY 5 - -#define VIDEO_STATE_OFF (VIDEO_STATE_PLAY_OFF | \ - VIDEO_STATE_REC_OFF | \ - VIDEO_STATE_PAUSE_OFF | \ - VIDEO_STATE_FFWD_OFF | \ - VIDEO_STATE_PBEND_OFF | \ - VIDEO_STATE_DATE_OFF | \ - VIDEO_STATE_TIME_OFF) -#define VIDEO_PRESS_OFF (VIDEO_PRESS_PLAY_OFF | \ - VIDEO_PRESS_REC_OFF | \ - VIDEO_PRESS_PAUSE_OFF | \ - VIDEO_PRESS_STOP_OFF | \ - VIDEO_PRESS_EJECT_OFF) -#define VIDEO_ALL_OFF (VIDEO_STATE_OFF | VIDEO_PRESS_OFF) - -#define VIDEO_STATE_ON (VIDEO_STATE_PLAY_ON | \ - VIDEO_STATE_REC_ON | \ - VIDEO_STATE_PAUSE_ON | \ - VIDEO_STATE_FFWD_ON | \ - VIDEO_STATE_PBEND_ON | \ - VIDEO_STATE_DATE_ON | \ - VIDEO_STATE_TIME_ON) -#define VIDEO_PRESS_ON (VIDEO_PRESS_PLAY_ON | \ - VIDEO_PRESS_REC_ON | \ - VIDEO_PRESS_PAUSE_ON | \ - VIDEO_PRESS_STOP_ON | \ - VIDEO_PRESS_EJECT_ON) -#define VIDEO_ALL_ON (VIDEO_STATE_ON | VIDEO_PRESS_ON) - -#define VIDEO_STATE (VIDEO_STATE_ON | VIDEO_STATE_OFF) -#define VIDEO_PRESS (VIDEO_PRESS_ON | VIDEO_PRESS_OFF) -#define VIDEO_ALL (VIDEO_ALL_ON | VIDEO_ALL_OFF) - - -/* some positions in the sound control window */ -#define SOUND_BUTTON_XSIZE 30 -#define SOUND_BUTTON_YSIZE 30 -#define SOUND_CONTROL_XPOS 5 -#define SOUND_CONTROL_YPOS 245 -#define SOUND_CONTROL_XSIZE (3*SOUND_BUTTON_XSIZE) -#define SOUND_CONTROL_YSIZE (1*SOUND_BUTTON_YSIZE) -#define SOUND_BUTTON_MUSIC_XPOS (SOUND_CONTROL_XPOS + 0 * SOUND_BUTTON_XSIZE) -#define SOUND_BUTTON_LOOPS_XPOS (SOUND_CONTROL_XPOS + 1 * SOUND_BUTTON_XSIZE) -#define SOUND_BUTTON_SIMPLE_XPOS (SOUND_CONTROL_XPOS + 2 * SOUND_BUTTON_XSIZE) -#define SOUND_BUTTON_ANY_YPOS (SOUND_CONTROL_YPOS) - -#define ON_SOUND_BUTTON(x,y) ((x)>=(DX+SOUND_CONTROL_XPOS) && \ - (x)< (DX+SOUND_CONTROL_XPOS + \ - SOUND_CONTROL_XSIZE) && \ - (y)>=(DY+SOUND_CONTROL_YPOS) && \ - (y)< (DY+SOUND_CONTROL_YPOS + \ - SOUND_CONTROL_YSIZE)) -#define SOUND_BUTTON(x) (((x)-(DX+SOUND_CONTROL_XPOS))/SOUND_BUTTON_XSIZE) +/* tags to draw video display labels or symbols only */ +#define VIDEO_DISPLAY_DEFAULT 0 +#define VIDEO_DISPLAY_LABEL_ONLY 1 +#define VIDEO_DISPLAY_SYMBOL_ONLY 2 /* values for sound control */ #define BUTTON_SOUND_MUSIC (1L<<0) @@ -205,6 +116,12 @@ #define BUTTON_SOUND_LOOPS_ON (BUTTON_SOUND_LOOPS | BUTTON_ON) #define BUTTON_SOUND_SIMPLE_ON (BUTTON_SOUND_SIMPLE | BUTTON_ON) +/* values for game control */ +#define BUTTON_GAME_STOP (1L<<0) +#define BUTTON_GAME_PAUSE (1L<<1) +#define BUTTON_GAME_PLAY (1L<<2) + +/* the following definitions are also used by game.c */ /* some positions in the game control window */ #define GAME_BUTTON_XSIZE 30 @@ -213,101 +130,8 @@ #define GAME_CONTROL_YPOS 215 #define GAME_CONTROL_XSIZE (3*GAME_BUTTON_XSIZE) #define GAME_CONTROL_YSIZE (1*GAME_BUTTON_YSIZE) -#define GAME_BUTTON_STOP_XPOS (GAME_CONTROL_XPOS + 0 * GAME_BUTTON_XSIZE) -#define GAME_BUTTON_PAUSE_XPOS (GAME_CONTROL_XPOS + 1 * GAME_BUTTON_XSIZE) -#define GAME_BUTTON_PLAY_XPOS (GAME_CONTROL_XPOS + 2 * GAME_BUTTON_XSIZE) -#define GAME_BUTTON_ANY_YPOS (GAME_CONTROL_YPOS) - -#define ON_GAME_BUTTON(x,y) ((x)>=(DX+GAME_CONTROL_XPOS) && \ - (x)< (DX+GAME_CONTROL_XPOS + \ - GAME_CONTROL_XSIZE) && \ - (y)>=(DY+GAME_CONTROL_YPOS) && \ - (y)< (DY+GAME_CONTROL_YPOS + \ - GAME_CONTROL_YSIZE)) -#define GAME_BUTTON(x) (((x)-(DX+GAME_CONTROL_XPOS))/GAME_BUTTON_XSIZE) - -/* values for game control */ -#define BUTTON_GAME_STOP (1L<<0) -#define BUTTON_GAME_PAUSE (1L<<1) -#define BUTTON_GAME_PLAY (1L<<2) - -/* some positions in the asking window */ -#define OK_BUTTON_XPOS 2 -#define OK_BUTTON_YPOS 250 -#define OK_BUTTON_GFX_YPOS 0 -#define OK_BUTTON_XSIZE 46 -#define OK_BUTTON_YSIZE 28 -#define NO_BUTTON_XPOS 52 -#define NO_BUTTON_YPOS OK_BUTTON_YPOS -#define NO_BUTTON_XSIZE OK_BUTTON_XSIZE -#define NO_BUTTON_YSIZE OK_BUTTON_YSIZE -#define CONFIRM_BUTTON_XPOS 2 -#define CONFIRM_BUTTON_GFX_YPOS 30 -#define CONFIRM_BUTTON_YPOS OK_BUTTON_YPOS -#define CONFIRM_BUTTON_XSIZE 96 -#define CONFIRM_BUTTON_YSIZE OK_BUTTON_YSIZE - -#define ON_YESNO_BUTTON(x,y) (((x)>=(DX+OK_BUTTON_XPOS) && \ - (x)< (DX+OK_BUTTON_XPOS + \ - OK_BUTTON_XSIZE) && \ - (y)>=(DY+OK_BUTTON_YPOS) && \ - (y)< (DY+OK_BUTTON_YPOS + \ - OK_BUTTON_YSIZE)) || \ - ((x)>=(DX+NO_BUTTON_XPOS) && \ - (x)< (DX+NO_BUTTON_XPOS + \ - NO_BUTTON_XSIZE) && \ - (y)>=(DY+NO_BUTTON_YPOS) && \ - (y)< (DY+NO_BUTTON_YPOS + \ - NO_BUTTON_YSIZE))) -#define ON_CONFIRM_BUTTON(x,y) (((x)>=(DX+CONFIRM_BUTTON_XPOS) && \ - (x)< (DX+CONFIRM_BUTTON_XPOS + \ - CONFIRM_BUTTON_XSIZE) && \ - (y)>=(DY+CONFIRM_BUTTON_YPOS) && \ - (y)< (DY+CONFIRM_BUTTON_YPOS + \ - CONFIRM_BUTTON_YSIZE))) -#define YESNO_BUTTON(x) (((x)-(DX+OK_BUTTON_XPOS))/OK_BUTTON_XSIZE) - -/* values for asking control */ -#define BUTTON_OK (1L<<0) -#define BUTTON_NO (1L<<1) -#define BUTTON_CONFIRM (1L<<2) - -/* some positions in the choose player window */ - -#define PLAYER_BUTTON_XSIZE 30 -#define PLAYER_BUTTON_YSIZE 30 -#define PLAYER_BUTTON_GFX_XPOS 5 -#define PLAYER_BUTTON_GFX_YPOS (215-30) -#define PLAYER_CONTROL_XPOS (5 + PLAYER_BUTTON_XSIZE/2) -#define PLAYER_CONTROL_YPOS (215 - PLAYER_BUTTON_YSIZE/2) -#define PLAYER_CONTROL_XSIZE (2*PLAYER_BUTTON_XSIZE) -#define PLAYER_CONTROL_YSIZE (2*PLAYER_BUTTON_YSIZE) -#define PLAYER_BUTTON_1_XPOS (PLAYER_CONTROL_XPOS + 0 * PLAYER_BUTTON_XSIZE) -#define PLAYER_BUTTON_2_XPOS (PLAYER_CONTROL_XPOS + 1 * PLAYER_BUTTON_XSIZE) -#define PLAYER_BUTTON_3_XPOS (PLAYER_CONTROL_XPOS + 0 * PLAYER_BUTTON_XSIZE) -#define PLAYER_BUTTON_4_XPOS (PLAYER_CONTROL_XPOS + 1 * PLAYER_BUTTON_XSIZE) -#define PLAYER_BUTTON_1_YPOS (PLAYER_CONTROL_YPOS + 0 * PLAYER_BUTTON_YSIZE) -#define PLAYER_BUTTON_2_YPOS (PLAYER_CONTROL_YPOS + 0 * PLAYER_BUTTON_YSIZE) -#define PLAYER_BUTTON_3_YPOS (PLAYER_CONTROL_YPOS + 1 * PLAYER_BUTTON_YSIZE) -#define PLAYER_BUTTON_4_YPOS (PLAYER_CONTROL_YPOS + 1 * PLAYER_BUTTON_YSIZE) - -#define ON_PLAYER_BUTTON(x,y) ((x)>=(DX+PLAYER_CONTROL_XPOS) && \ - (x)< (DX+PLAYER_CONTROL_XPOS + \ - PLAYER_CONTROL_XSIZE) && \ - (y)>=(DY+PLAYER_CONTROL_YPOS) && \ - (y)< (DY+PLAYER_CONTROL_YPOS + \ - PLAYER_CONTROL_YSIZE)) -#define PLAYER_BUTTON(x,y) ((((x)-(DX+PLAYER_CONTROL_XPOS)) / \ - PLAYER_BUTTON_XSIZE) + 2 * \ - (((y)-(DY+PLAYER_CONTROL_YPOS)) / \ - PLAYER_BUTTON_YSIZE)) - -/* values for choose player control */ -#define BUTTON_PLAYER_1 (1L<<10) -#define BUTTON_PLAYER_2 (1L<<11) -#define BUTTON_PLAYER_3 (1L<<12) -#define BUTTON_PLAYER_4 (1L<<13) +/* the following definitions are also used by editor.c */ /* some positions in the editor control window */ #define ED_BUTTON_EUP_XPOS 35 @@ -399,130 +223,6 @@ #define ED_SIZE_VALUE_XPOS (ED_SIZE_GADGET_XPOS+ED_BUTTON_MINUS_XSIZE+7) #define ED_SIZE_VALUE_YPOS ED_SIZE_TEXT_YPOS -#define ON_EDIT_BUTTON(x,y) (((x)>=(VX+ED_BUTTON_CTRL_XPOS) && \ - (x)< (VX+ED_BUTTON_CTRL_XPOS + \ - ED_BUTTON_CTRL_XSIZE) && \ - (y)>=(VY+ED_BUTTON_CTRL_YPOS) && \ - (y)< (VY+ED_BUTTON_CTRL_YPOS + \ - ED_BUTTON_CTRL_YSIZE + \ - ED_BUTTON_FILL_YSIZE)) || \ - ((x)>=(VX+ED_BUTTON_LEFT_XPOS) && \ - (x)< (VX+ED_BUTTON_LEFT_XPOS + \ - ED_BUTTON_LEFT_XSIZE + \ - ED_BUTTON_UP_XSIZE + \ - ED_BUTTON_RIGHT_XSIZE) && \ - (y)>=(VY+ED_BUTTON_LEFT_YPOS) && \ - (y)< (VY+ED_BUTTON_LEFT_YPOS + \ - ED_BUTTON_LEFT_YSIZE)) || \ - ((x)>=(VX+ED_BUTTON_UP_XPOS) && \ - (x)< (VX+ED_BUTTON_UP_XPOS + \ - ED_BUTTON_UP_XSIZE) && \ - (y)>=(VY+ED_BUTTON_UP_YPOS) && \ - (y)< (VY+ED_BUTTON_UP_YPOS + \ - ED_BUTTON_UP_YSIZE + \ - ED_BUTTON_DOWN_YSIZE))) - -#define ON_CTRL_BUTTON(x,y) ((x)>=(VX+ED_BUTTON_EDIT_XPOS) && \ - (x)< (VX+ED_BUTTON_EDIT_XPOS + \ - ED_BUTTON_EDIT_XSIZE) && \ - (y)>=(VY+ED_BUTTON_EDIT_YPOS) && \ - (y)< (VY+ED_BUTTON_EDIT_YPOS + \ - ED_BUTTON_EDIT_YSIZE + \ - ED_BUTTON_CLEAR_YSIZE + \ - ED_BUTTON_UNDO_YSIZE + \ - ED_BUTTON_EXIT_YSIZE)) - -#define ON_ELEM_BUTTON(x,y) (((x)>=(DX+ED_BUTTON_EUP_XPOS) && \ - (x)< (DX+ED_BUTTON_EUP_XPOS + \ - ED_BUTTON_EUP_XSIZE) && \ - (y)>=(DY+ED_BUTTON_EUP_YPOS) && \ - (y)< (DY+ED_BUTTON_EUP_YPOS + \ - ED_BUTTON_EUP_YSIZE)) || \ - ((x)>=(DX+ED_BUTTON_EDOWN_XPOS) && \ - (x)< (DX+ED_BUTTON_EDOWN_XPOS + \ - ED_BUTTON_EDOWN_XSIZE) && \ - (y)>=(DY+ED_BUTTON_EDOWN_YPOS) && \ - (y)< (DY+ED_BUTTON_EDOWN_YPOS + \ - ED_BUTTON_EDOWN_YSIZE)) || \ - ((x)>=(DX+ED_BUTTON_ELEM_XPOS) && \ - (x)< (DX+ED_BUTTON_ELEM_XPOS + \ - MAX_ELEM_X*ED_BUTTON_ELEM_XSIZE) && \ - (y)>=(DY+ED_BUTTON_ELEM_YPOS) && \ - (y)< (DY+ED_BUTTON_ELEM_YPOS + \ - MAX_ELEM_Y*ED_BUTTON_ELEM_YSIZE))) - -#define ON_COUNT_BUTTON(x,y) (((((x)>=ED_COUNT_GADGET_XPOS && \ - (x)<(ED_COUNT_GADGET_XPOS + \ - ED_BUTTON_MINUS_XSIZE)) || \ - ((x)>=(ED_COUNT_GADGET_XPOS + \ - (ED_BUTTON_PLUS_XPOS - \ - ED_BUTTON_MINUS_XPOS)) && \ - (x)<(ED_COUNT_GADGET_XPOS + \ - (ED_BUTTON_PLUS_XPOS - \ - ED_BUTTON_MINUS_XPOS) + \ - ED_BUTTON_PLUS_XSIZE))) && \ - ((y)>=ED_COUNT_GADGET_YPOS && \ - (y)<(ED_COUNT_GADGET_YPOS + \ - 16*ED_COUNT_GADGET_YSIZE)) && \ - (((y)-ED_COUNT_GADGET_YPOS) % \ - ED_COUNT_GADGET_YSIZE) < \ - ED_BUTTON_MINUS_YSIZE) || \ - ((((x)>=ED_SIZE_GADGET_XPOS && \ - (x)<(ED_SIZE_GADGET_XPOS + \ - ED_BUTTON_MINUS_XSIZE)) || \ - ((x)>=(ED_SIZE_GADGET_XPOS + \ - (ED_BUTTON_PLUS_XPOS - \ - ED_BUTTON_MINUS_XPOS)) && \ - (x)<(ED_SIZE_GADGET_XPOS + \ - (ED_BUTTON_PLUS_XPOS - \ - ED_BUTTON_MINUS_XPOS) + \ - ED_BUTTON_PLUS_XSIZE))) && \ - ((y)>=ED_SIZE_GADGET_YPOS && \ - (y)<(ED_SIZE_GADGET_YPOS + \ - 2*ED_SIZE_GADGET_YSIZE)) && \ - (((y)-ED_SIZE_GADGET_YPOS) % \ - ED_SIZE_GADGET_YSIZE) < \ - ED_BUTTON_MINUS_YSIZE)) - -#define EDIT_BUTTON(x,y) (((y) < (VY + ED_BUTTON_CTRL_YPOS + \ - ED_BUTTON_CTRL_YSIZE)) ? 0 : \ - ((y) < (VY + ED_BUTTON_CTRL_YPOS + \ - ED_BUTTON_CTRL_YSIZE + \ - ED_BUTTON_FILL_YSIZE)) ? 1 : \ - ((x) < (VX + ED_BUTTON_LEFT_XPOS + \ - ED_BUTTON_LEFT_XSIZE) ? 2 : \ - (x) > (VX + ED_BUTTON_LEFT_XPOS + \ - ED_BUTTON_LEFT_XSIZE + \ - ED_BUTTON_UP_XSIZE) ? 5 : \ - 3+(((y)-(VY + ED_BUTTON_CTRL_YPOS + \ - ED_BUTTON_CTRL_YSIZE + \ - ED_BUTTON_FILL_YSIZE)) / \ - ED_BUTTON_UP_YSIZE))) - -#define CTRL_BUTTON(x,y) (((y) < (VY + ED_BUTTON_EDIT_YPOS + \ - ED_BUTTON_EDIT_YSIZE)) ? 0 : \ - 1+(((y)-(VY + ED_BUTTON_EDIT_YPOS + \ - ED_BUTTON_EDIT_YSIZE)) / \ - ED_BUTTON_CLEAR_YSIZE)) - -#define ELEM_BUTTON(x,y) (((y) < (DY + ED_BUTTON_EUP_YPOS + \ - ED_BUTTON_EUP_YSIZE)) ? 0 : \ - ((y) > (DY + ED_BUTTON_EDOWN_YPOS)) ? 1 : \ - 2+(((y) - (DY + ED_BUTTON_ELEM_YPOS)) / \ - ED_BUTTON_ELEM_YSIZE)*MAX_ELEM_X + \ - ((x) - (DX + ED_BUTTON_ELEM_XPOS)) / \ - ED_BUTTON_ELEM_XSIZE) - -#define COUNT_BUTTON(x,y) ((x) < ED_SIZE_GADGET_XPOS ? \ - ((((y) - ED_COUNT_GADGET_YPOS) / \ - ED_COUNT_GADGET_YSIZE)*2 + \ - ((x) < (ED_COUNT_GADGET_XPOS + \ - ED_BUTTON_MINUS_XSIZE) ? 0 : 1)) : \ - 32+((((y) - ED_SIZE_GADGET_YPOS) / \ - ED_SIZE_GADGET_YSIZE)*2 + \ - ((x) < (ED_SIZE_GADGET_XPOS + \ - ED_BUTTON_MINUS_XSIZE) ? 0 : 1))) - /* values for asking control */ #define ED_BUTTON_CTRL (1L<<0) #define ED_BUTTON_FILL (1L<<1) @@ -542,12 +242,6 @@ #define ED_BUTTON_EDOWN 1 #define ED_BUTTON_ELEM 2 - -/* for DrawPlayerButton() */ - -#define DB_INIT 0 -#define DB_NORMAL 1 - void DrawVideoDisplay(unsigned long, unsigned long); void DrawCompleteVideoDisplay(void); void DrawSoundDisplay(unsigned long); diff --git a/src/editor.c b/src/editor.c index c17a4967..8ea4472c 100644 --- a/src/editor.c +++ b/src/editor.c @@ -18,6 +18,24 @@ #include "buttons.h" #include "files.h" +/* positions in the level editor */ +#define ED_WIN_MB_LEFT_XPOS 7 +#define ED_WIN_MB_LEFT_YPOS 6 +#define ED_WIN_LEVELNR_XPOS 77 +#define ED_WIN_LEVELNR_YPOS 7 +#define ED_WIN_MB_MIDDLE_XPOS 7 +#define ED_WIN_MB_MIDDLE_YPOS 258 +#define ED_WIN_MB_RIGHT_XPOS 77 +#define ED_WIN_MB_RIGHT_YPOS 258 + +/* other constants for the editor */ +#define ED_SCROLL_NO 0 +#define ED_SCROLL_LEFT 1 +#define ED_SCROLL_RIGHT 2 +#define ED_SCROLL_UP 4 +#define ED_SCROLL_DOWN 8 + +/* delay value to avoid too fast scrolling etc. */ #define CHOICE_DELAY_VALUE 100 static int level_xpos,level_ypos; diff --git a/src/editor.h b/src/editor.h index b282fe4b..dae87c12 100644 --- a/src/editor.h +++ b/src/editor.h @@ -16,32 +16,15 @@ #include "main.h" -/* positions in the level editor */ -#define ED_WIN_MB_LEFT_XPOS 7 -#define ED_WIN_MB_LEFT_YPOS 6 -#define ED_WIN_LEVELNR_XPOS 77 -#define ED_WIN_LEVELNR_YPOS 7 -#define ED_WIN_MB_MIDDLE_XPOS 7 -#define ED_WIN_MB_MIDDLE_YPOS 258 -#define ED_WIN_MB_RIGHT_XPOS 77 -#define ED_WIN_MB_RIGHT_YPOS 258 - +/* number of element button columns and rows in the edit window */ #define MAX_ELEM_X 4 #define MAX_ELEM_Y 10 -/* other constants for the editor */ -#define ED_SCROLL_NO 0 -#define ED_SCROLL_LEFT 1 -#define ED_SCROLL_RIGHT 2 -#define ED_SCROLL_UP 4 -#define ED_SCROLL_DOWN 8 - extern int element_shift; extern int editor_element[]; extern int elements_in_list; void DrawLevelEd(void); -void ScrollMiniLevel(int, int, int); void LevelEd(int, int, int); void LevelNameTyping(KeySym); diff --git a/src/events.c b/src/events.c index f6bf5591..2ef8fd6d 100644 --- a/src/events.c +++ b/src/events.c @@ -22,6 +22,11 @@ #include "joystick.h" #include "network.h" +/* values for key_status */ +#define KEY_NOT_PRESSED FALSE +#define KEY_RELEASED FALSE +#define KEY_PRESSED TRUE + void EventLoop(void) { while(1) diff --git a/src/files.c b/src/files.c index cb1199d3..80a5e7cb 100644 --- a/src/files.c +++ b/src/files.c @@ -22,14 +22,53 @@ #include "tape.h" #include "joystick.h" -#define MAX_LINE_LEN 1000 /* file input line length */ -#define CHUNK_ID_LEN 4 /* IFF style chunk id length */ -#define LEVEL_HEADER_SIZE 80 /* size of level file header */ -#define LEVEL_HEADER_UNUSED 18 /* unused level header bytes */ -#define TAPE_HEADER_SIZE 20 /* size of tape file header */ -#define TAPE_HEADER_UNUSED 7 /* unused tape header bytes */ -#define FILE_VERSION_1_0 10 /* old 1.0 file version */ -#define FILE_VERSION_1_2 12 /* actual file version */ +#define MAX_FILENAME_LEN 256 /* maximal filename length */ +#define MAX_LINE_LEN 1000 /* maximal input line length */ +#define CHUNK_ID_LEN 4 /* IFF style chunk id length */ +#define LEVEL_HEADER_SIZE 80 /* size of level file header */ +#define LEVEL_HEADER_UNUSED 18 /* unused level header bytes */ +#define TAPE_HEADER_SIZE 20 /* size of tape file header */ +#define TAPE_HEADER_UNUSED 7 /* unused tape header bytes */ +#define FILE_VERSION_1_0 10 /* old 1.0 file version */ +#define FILE_VERSION_1_2 12 /* actual file version */ + +/* file identifier strings */ +#define LEVEL_COOKIE "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_1.2" +#define SCORE_COOKIE "ROCKSNDIAMONDS_SCORE_FILE_VERSION_1.2" +#define TAPE_COOKIE "ROCKSNDIAMONDS_TAPE_FILE_VERSION_1.2" +#define SETUP_COOKIE "ROCKSNDIAMONDS_SETUP_FILE_VERSION_1.2" +#define LEVELSETUP_COOKIE "ROCKSNDIAMONDS_LEVELSETUP_FILE_VERSION_1.2" +#define LEVELINFO_COOKIE "ROCKSNDIAMONDS_LEVELINFO_FILE_VERSION_1.2" +/* old file identifiers for backward compatibility */ +#define LEVEL_COOKIE_10 "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_1.0" +#define TAPE_COOKIE_10 "ROCKSNDIAMONDS_LEVELREC_FILE_VERSION_1.0" + +/* file names and filename extensions */ +#ifndef MSDOS +#define USERDATA_DIRECTORY ".rocksndiamonds" +#define SETUP_FILENAME "setup.conf" +#define LEVELSETUP_FILENAME "levelsetup.conf" +#define LEVELINFO_FILENAME "levelinfo.conf" +#define TAPEFILE_EXTENSION "tape" +#define SCOREFILE_EXTENSION "score" +#else +#define USERDATA_DIRECTORY "userdata" +#define SETUP_FILENAME "setup.cnf" +#define LEVELSETUP_FILENAME "lvlsetup.cnf" +#define LEVELINFO_FILENAME "lvlinfo.cnf" +#define TAPEFILE_EXTENSION "rec" +#define SCOREFILE_EXTENSION "sco" +#endif + +/* file permissions for newly written files */ +#define MODE_R_ALL (S_IRUSR | S_IRGRP | S_IROTH) +#define MODE_W_ALL (S_IWUSR | S_IWGRP | S_IWOTH) +#define MODE_X_ALL (S_IXUSR | S_IXGRP | S_IXOTH) +#define USERDATA_DIR_MODE (MODE_R_ALL | MODE_X_ALL | S_IWUSR) +#define LEVEL_PERMS (MODE_R_ALL | MODE_W_ALL) +#define SCORE_PERMS LEVEL_PERMS +#define TAPE_PERMS LEVEL_PERMS +#define SETUP_PERMS LEVEL_PERMS static void SaveUserLevelInfo(); /* for 'InitUserLevelDir()' */ static char *getSetupLine(char *, int); /* for 'SaveUserLevelInfo()' */ @@ -166,7 +205,7 @@ static void setLevelInfoToDefaults() strcpy(level.name, "Nameless Level"); - for(i=0; id_name) >= MAX_LEVDIR_FILENAME) - { - Error(ERR_WARN, "filename of level directory '%s' too long -- ignoring", - dir_entry->d_name); - continue; - } - filename = getPath2(directory, LEVELINFO_FILENAME); setup_file_list = loadSetupFileList(filename); diff --git a/src/game.c b/src/game.c index 61a88093..e9f9d041 100644 --- a/src/game.c +++ b/src/game.c @@ -23,6 +23,84 @@ #include "joystick.h" #include "network.h" +/* for DigField() */ +#define DF_NO_PUSH 0 +#define DF_DIG 1 +#define DF_SNAP 2 + +/* for MoveFigure() */ +#define MF_NO_ACTION 0 +#define MF_MOVING 1 +#define MF_ACTION 2 + +/* for ScrollFigure() */ +#define SCROLL_INIT 0 +#define SCROLL_GO_ON 1 + +/* for Explode() */ +#define EX_PHASE_START 0 +#define EX_NORMAL 0 +#define EX_CENTER 1 +#define EX_BORDER 2 + +/* special positions in the game control window (relative to control window) */ +#define XX_LEVEL 37 +#define YY_LEVEL 20 +#define XX_EMERALDS 29 +#define YY_EMERALDS 54 +#define XX_DYNAMITE 29 +#define YY_DYNAMITE 89 +#define XX_KEYS 18 +#define YY_KEYS 123 +#define XX_SCORE 15 +#define YY_SCORE 159 +#define XX_TIME 29 +#define YY_TIME 194 + +/* special positions in the game control window (relative to main window) */ +#define DX_LEVEL (DX + XX_LEVEL) +#define DY_LEVEL (DY + YY_LEVEL) +#define DX_EMERALDS (DX + XX_EMERALDS) +#define DY_EMERALDS (DY + YY_EMERALDS) +#define DX_DYNAMITE (DX + XX_DYNAMITE) +#define DY_DYNAMITE (DY + YY_DYNAMITE) +#define DX_KEYS (DX + XX_KEYS) +#define DY_KEYS (DY + YY_KEYS) +#define DX_SCORE (DX + XX_SCORE) +#define DY_SCORE (DY + YY_SCORE) +#define DX_TIME (DX + XX_TIME) +#define DY_TIME (DY + YY_TIME) + +#define IS_LOOP_SOUND(s) ((s)==SND_KLAPPER || (s)==SND_ROEHR || \ + (s)==SND_NJAM || (s)==SND_MIEP) +#define IS_MUSIC_SOUND(s) ((s)==SND_ALCHEMY || (s)==SND_CHASE || \ + (s)==SND_NETWORK || (s)==SND_CZARDASZ || \ + (s)==SND_TYGER || (s)==SND_VOYAGER || \ + (s)==SND_TWILIGHT) + +/* score for elements */ +#define SC_EDELSTEIN 0 +#define SC_DIAMANT 1 +#define SC_KAEFER 2 +#define SC_FLIEGER 3 +#define SC_MAMPFER 4 +#define SC_ROBOT 5 +#define SC_PACMAN 6 +#define SC_KOKOSNUSS 7 +#define SC_DYNAMIT 8 +#define SC_SCHLUESSEL 9 +#define SC_ZEITBONUS 10 + +/* values for game_emulation */ +#define EMU_NONE 0 +#define EMU_BOULDERDASH 1 +#define EMU_SOKOBAN 2 + +/* to control special behaviour of certain game elements */ +int game_emulation = EMU_NONE; + + + #ifdef DEBUG #if 0 static unsigned int getStateCheckSum(int counter) @@ -73,6 +151,8 @@ static unsigned int getStateCheckSum(int counter) #endif #endif + + void GetPlayerConfig() { if (sound_status == SOUND_OFF) diff --git a/src/game.h b/src/game.h index 965d8f03..4834b796 100644 --- a/src/game.h +++ b/src/game.h @@ -16,28 +16,6 @@ #include "main.h" -#define DF_NO_PUSH 0 -#define DF_DIG 1 -#define DF_SNAP 2 - -#define MF_NO_ACTION 0 -#define MF_MOVING 1 -#define MF_ACTION 2 - -#define SCROLL_INIT 0 -#define SCROLL_GO_ON 1 - -/* explosion position and phase marks */ -#define EX_PHASE_START 0 -#define EX_NORMAL 0 -#define EX_CENTER 1 -#define EX_BORDER 2 - -/* fundamental game speed */ -#define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */ -#define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */ -#define FRAMES_PER_SECOND (1000 / GAME_FRAME_DELAY) - void GetPlayerConfig(void); void InitGame(void); void InitMovDir(int, int); diff --git a/src/main.c b/src/main.c index bb9ef845..47c91008 100644 --- a/src/main.c +++ b/src/main.c @@ -53,7 +53,6 @@ char *joystick_device_name[MAX_PLAYERS] = char *program_name = NULL; int game_status = MAINMENU; -int game_emulation = EMU_NONE; boolean network_playing = FALSE; int button_status = MB_NOT_PRESSED; boolean motion_status = FALSE; diff --git a/src/main.h b/src/main.h index cbf07655..7a748454 100644 --- a/src/main.h +++ b/src/main.h @@ -191,21 +191,19 @@ typedef unsigned char byte; /* boundaries of arrays etc. */ #define MAX_NAMELEN (10+1) - #define MAX_LEVNAMLEN 32 -#define MAX_LEVSCORE_ENTRIES 16 #define MAX_TAPELEN (1000 * 50) /* max. time * framerate */ - -#define MAX_LEVDIR_FILENAME (64+1) -#define MAX_LEVDIR_NAME (16+1) #define MAX_LEVDIR_ENTRIES 100 #define MAX_SCORE_ENTRIES 100 -#define MAX_VISIBLE_ENTRIES 15 - -#define MAX_OPTION_LEN 256 -#define MAX_FILENAME_LEN 256 -#define MAX_NUM_AMOEBA 100 #define MAX_ELEMENTS 512 +#define MAX_NUM_AMOEBA 100 + +#define LEVEL_SCORE_ELEMENTS 16 /* level elements with score */ + +/* fundamental game speed values */ +#define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */ +#define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */ +#define FRAMES_PER_SECOND (1000 / GAME_FRAME_DELAY) struct HiScore { @@ -329,7 +327,7 @@ struct LevelInfo int time; int edelsteine; char name[MAX_LEVNAMLEN]; - int score[MAX_LEVSCORE_ENTRIES]; + int score[LEVEL_SCORE_ELEMENTS]; int mampfer_inhalt[4][3][3]; int tempo_amoebe; int dauer_sieb; @@ -391,7 +389,6 @@ extern char *joystick_device_name[]; extern char *program_name; extern int game_status; -extern int game_emulation; extern boolean network_playing; extern int button_status; extern boolean motion_status; @@ -952,19 +949,6 @@ extern int num_bg_loops; #define GFX_CHAR_COPY (GFX_CHAR_ASCII0+94) #define GFX_CHAR_END (GFX_CHAR_START+79) -/* score for elements */ -#define SC_EDELSTEIN 0 -#define SC_DIAMANT 1 -#define SC_KAEFER 2 -#define SC_FLIEGER 3 -#define SC_MAMPFER 4 -#define SC_ROBOT 5 -#define SC_PACMAN 6 -#define SC_KOKOSNUSS 7 -#define SC_DYNAMIT 8 -#define SC_SCHLUESSEL 9 -#define SC_ZEITBONUS 10 - /* the names of the sounds */ #define SND_ALCHEMY 0 #define SND_AMOEBE 1 @@ -1021,13 +1005,6 @@ extern int num_bg_loops; #define NUM_SOUNDS 52 -#define IS_LOOP_SOUND(s) ((s)==SND_KLAPPER || (s)==SND_ROEHR || \ - (s)==SND_NJAM || (s)==SND_MIEP) -#define IS_MUSIC_SOUND(s) ((s)==SND_ALCHEMY || (s)==SND_CHASE || \ - (s)==SND_NETWORK || (s)==SND_CZARDASZ || \ - (s)==SND_TYGER || (s)==SND_VOYAGER || \ - (s)==SND_TWILIGHT) - /* default input keys */ #define KEY_UNDEFINDED XK_VoidSymbol #define DEFAULT_KEY_LEFT XK_Left @@ -1069,11 +1046,6 @@ extern int num_bg_loops; #define SETUPINPUT 8 #define EXITGAME 9 -/* values for game_emulation */ -#define EMU_NONE 0 -#define EMU_BOULDERDASH 1 -#define EMU_SOKOBAN 2 - #ifndef GAME_DIR #define GAME_DIR "." #endif @@ -1086,60 +1058,12 @@ extern int num_bg_loops; #define TAPES_DIRECTORY "tapes" #define SCORES_DIRECTORY "scores" -#ifndef MSDOS -#define USERDATA_DIRECTORY ".rocksndiamonds" -#define SETUP_FILENAME "setup.conf" -#define LEVELSETUP_FILENAME "levelsetup.conf" -#define LEVELINFO_FILENAME "levelinfo.conf" -#define TAPEFILE_EXTENSION "tape" -#define SCOREFILE_EXTENSION "score" -#else -#define USERDATA_DIRECTORY "userdata" -#define SETUP_FILENAME "setup.cnf" -#define LEVELSETUP_FILENAME "lvlsetup.cnf" -#define LEVELINFO_FILENAME "lvlinfo.cnf" -#define TAPEFILE_EXTENSION "rec" -#define SCOREFILE_EXTENSION "sco" -#endif - -#define MODE_R_ALL (S_IRUSR | S_IRGRP | S_IROTH) -#define MODE_W_ALL (S_IWUSR | S_IWGRP | S_IWOTH) -#define MODE_X_ALL (S_IXUSR | S_IXGRP | S_IXOTH) -#define USERDATA_DIR_MODE (MODE_R_ALL | MODE_X_ALL | S_IWUSR) -#define LEVEL_PERMS (MODE_R_ALL | MODE_W_ALL) -#define SCORE_PERMS LEVEL_PERMS -#define NAMES_PERMS LEVEL_PERMS -#define LEVDIR_PERMS LEVEL_PERMS -#define LEVREC_PERMS LEVEL_PERMS -#define JOYDAT_PERMS LEVEL_PERMS -#define SETUP_PERMS LEVEL_PERMS - -#define LEVEL_COOKIE "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_1.2" -#define SCORE_COOKIE "ROCKSNDIAMONDS_SCORE_FILE_VERSION_1.2" -#define TAPE_COOKIE "ROCKSNDIAMONDS_TAPE_FILE_VERSION_1.2" -#define SETUP_COOKIE "ROCKSNDIAMONDS_SETUP_FILE_VERSION_1.2" -#define LEVELSETUP_COOKIE "ROCKSNDIAMONDS_LEVELSETUP_FILE_VERSION_1.2" -#define LEVELINFO_COOKIE "ROCKSNDIAMONDS_LEVELINFO_FILE_VERSION_1.2" - -/* old cookies for backward compatibility */ -#define LEVEL_COOKIE_10 "ROCKSNDIAMONDS_LEVEL_FILE_VERSION_1.0" -#define TAPE_COOKIE_10 "ROCKSNDIAMONDS_LEVELREC_FILE_VERSION_1.0" - -#define LEVEL_COOKIE_LEN (strlen(LEVEL_COOKIE) + 1) -#define SCORE_COOKIE_LEN (strlen(SCORE_COOKIE) + 1) -#define LEVELREC_COOKIE_LEN (strlen(LEVELREC_COOKIE) + 1) -#define TAPE_COOKIE_LEN (strlen(TAPE_COOKIE) + 1) -#define SETUP_COOKIE_LEN (strlen(SETUP_COOKIE) + 1) -#define LEVELSETUP_COOKIE_LEN (strlen(LEVELSETUP_COOKIE) + 1) -#define LEVELINFO_COOKIE_LEN (strlen(LEVELINFO_COOKIE) + 1) - #define VERSION_STRING "1.2 preview 1" #define GAMETITLE_STRING "Rocks'n'Diamonds" #define WINDOWTITLE_STRING GAMETITLE_STRING " " VERSION_STRING #define COPYRIGHT_STRING "Copyright ^1995-98 by Holger Schemel" -/* Leerer Login- und Alias-Name */ -#define EMPTY_LOGIN "NO_LOGIN" +/* default name for empty highscore entry */ #define EMPTY_ALIAS "NO_NAME" /* values for button_status */ @@ -1158,11 +1082,6 @@ extern int num_bg_loops; #define MB_RIGHT 3 #endif -/* values for key_status */ -#define KEY_NOT_PRESSED FALSE -#define KEY_RELEASED FALSE -#define KEY_PRESSED TRUE - /* values for redraw_mask */ #define REDRAW_ALL (1L<<0) #define REDRAW_FIELD (1L<<1) @@ -1178,51 +1097,24 @@ extern int num_bg_loops; #define REDRAW_MAIN (REDRAW_FIELD | REDRAW_TILES | REDRAW_MICROLEV) #define REDRAWTILES_THRESHOLD SCR_FIELDX*SCR_FIELDY/2 -/* positions in the game control window */ -#define XX_LEVEL 37 -#define YY_LEVEL 20 -#define XX_EMERALDS 29 -#define YY_EMERALDS 54 -#define XX_DYNAMITE 29 -#define YY_DYNAMITE 89 -#define XX_KEYS 18 -#define YY_KEYS 123 -#define XX_SCORE 15 -#define YY_SCORE 159 -#define XX_TIME 29 -#define YY_TIME 194 - -#define DX_LEVEL (DX+XX_LEVEL) -#define DY_LEVEL (DY+YY_LEVEL) -#define DX_EMERALDS (DX+XX_EMERALDS) -#define DY_EMERALDS (DY+YY_EMERALDS) -#define DX_DYNAMITE (DX+XX_DYNAMITE) -#define DY_DYNAMITE (DY+YY_DYNAMITE) -#define DX_KEYS (DX+XX_KEYS) -#define DY_KEYS (DY+YY_KEYS) -#define DX_SCORE (DX+XX_SCORE) -#define DY_SCORE (DY+YY_SCORE) -#define DX_TIME (DX+XX_TIME) -#define DY_TIME (DY+YY_TIME) - -/* Felder in PIX_DOOR */ -/* Bedeutung in PIX_DB_DOOR: (3 PAGEs) - PAGEX1: 1. Zwischenspeicher für DOOR_1 - PAGEX2: 2. Zwischenspeicher für DOOR_1 - PAGEX3: Pufferspeicher für Animationen +/* areas in pixmap PIX_DOOR */ +/* meaning in PIX_DB_DOOR: (3 PAGEs) + PAGEX1: 1. buffer for DOOR_1 + PAGEX2: 2. buffer for DOOR_1 + PAGEX3: buffer for animations */ #define DOOR_GFX_PAGESIZE DXSIZE -#define DOOR_GFX_PAGEX1 (0*DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX2 (1*DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX3 (2*DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX4 (3*DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX5 (4*DOOR_GFX_PAGESIZE) -#define DOOR_GFX_PAGEX6 (5*DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX1 (0 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX2 (1 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX3 (2 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX4 (3 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX5 (4 * DOOR_GFX_PAGESIZE) +#define DOOR_GFX_PAGEX6 (5 * DOOR_GFX_PAGESIZE) #define DOOR_GFX_PAGEY1 0 #define DOOR_GFX_PAGEY2 DYSIZE -/* für DrawGraphicAnimation (tools.c) und AnimateToon (cartoons.c) */ +/* for DrawGraphicAnimation() [tools.c] and AnimateToon() [cartoons.c] */ #define ANIM_NORMAL 0 #define ANIM_OSCILLATE 1 #define ANIM_REVERSE 2 diff --git a/src/misc.c b/src/misc.c index 2c01f364..88f1cd77 100644 --- a/src/misc.c +++ b/src/misc.c @@ -27,6 +27,9 @@ #include "random.h" #include "joystick.h" +/* maximal allowed length of a command line option */ +#define MAX_OPTION_LEN 256 + static unsigned long mainCounter(int mode) { static struct timeval base_time = { 0, 0 }; diff --git a/src/screens.c b/src/screens.c index bcf96b32..a01b6b12 100644 --- a/src/screens.c +++ b/src/screens.c @@ -26,6 +26,21 @@ #include "network.h" #include "init.h" +/* for DrawSetupScreen(), HandleSetupScreen() */ +#define SETUP_SCREEN_POS_START 2 +#define SETUP_SCREEN_POS_END 16 +#define SETUP_SCREEN_POS_EMPTY1 (SETUP_SCREEN_POS_END - 2) +#define SETUP_SCREEN_POS_EMPTY2 (SETUP_SCREEN_POS_END - 2) + +/* for HandleSetupInputScreen() */ +#define SETUPINPUT_SCREEN_POS_START 2 +#define SETUPINPUT_SCREEN_POS_END 15 +#define SETUPINPUT_SCREEN_POS_EMPTY1 (SETUPINPUT_SCREEN_POS_START + 3) +#define SETUPINPUT_SCREEN_POS_EMPTY2 (SETUPINPUT_SCREEN_POS_END - 1) + +/* for HandleChooseLevel() */ +#define MAX_LEVEL_SERIES_ON_SCREEN 15 + #ifdef MSDOS extern unsigned char get_ascii(KeySym); #endif @@ -782,7 +797,7 @@ static void drawChooseLevelList(int first_entry, int num_page_entries) DrawGraphic(0, 1, GFX_PFEIL_O); if (first_entry + num_page_entries < num_leveldirs) - DrawGraphic(0, MAX_VISIBLE_ENTRIES + 1, GFX_PFEIL_U); + DrawGraphic(0, MAX_LEVEL_SERIES_ON_SCREEN + 1, GFX_PFEIL_U); } static void drawChooseLevelInfo(int leveldir_nr) @@ -802,10 +817,10 @@ void HandleChooseLevel(int mx, int my, int dx, int dy, int button) int x = (mx + 32 - SX) / 32, y = (my + 32 - SY) / 32; int num_page_entries; - if (num_leveldirs <= MAX_VISIBLE_ENTRIES) + if (num_leveldirs <= MAX_LEVEL_SERIES_ON_SCREEN) num_page_entries = num_leveldirs; else - num_page_entries = MAX_VISIBLE_ENTRIES - 1; + num_page_entries = MAX_LEVEL_SERIES_ON_SCREEN - 1; if (button == MB_MENU_INITIALIZE) { @@ -920,7 +935,7 @@ void DrawHallOfFame(int highlight_position) DrawText(SX + 80, SY + 8, "Hall Of Fame", FS_BIG, FC_YELLOW); DrawTextFCentered(46, FC_RED, "HighScores of Level %d", level_nr); - for(i=0; i