* q99492@pbhrzx.uni-paderborn.de *
*----------------------------------------------------------*
* screens.c *
-* *
-* Letzte Aenderung: 15.06.1995 *
***********************************************************/
#include "screens.h"
#include "tools.h"
#include "editor.h"
#include "misc.h"
+#include "files.h"
+#include "buttons.h"
void DrawMainMenu()
{
{
static long level_delay = 0;
int step = (button==1 ? 1 : button==2 ? 5 : 10);
+ int new_level_nr, old_level_nr = level_nr;
- if (!DelayReached(&level_delay,20))
+ new_level_nr = level_nr + (x==11 ? -step : +step);
+ if (new_level_nr<0)
+ new_level_nr = 0;
+ if (new_level_nr>LEVELDIR_SIZE(leveldir[leveldir_nr])-1)
+ new_level_nr = LEVELDIR_SIZE(leveldir[leveldir_nr])-1;
+
+ if (old_level_nr==new_level_nr || !DelayReached(&level_delay,20))
goto out;
- level_nr += (x==11 ? -step : +step);
- if (level_nr<0)
- level_nr = 0;
- if (level_nr>LEVELDIR_SIZE(leveldir[leveldir_nr])-1)
- level_nr = LEVELDIR_SIZE(leveldir[leveldir_nr])-1;
+ level_nr = new_level_nr;
if (level_nr>player.handicap && level_nr<leveldir[leveldir_nr].num_ready)
{
static int helpscreen_delay[MAX_HELPSCREEN_ELS];
static int helpscreen_action[] =
{
+ GFX_SPIELFIGUR,1,100, HA_NEXT,
GFX_ERDREICH,1,100, HA_NEXT,
GFX_LEERRAUM,1,100, HA_NEXT,
GFX_MORAST_LEER,1,100, HA_NEXT,
GFX_BETON,1,100, HA_NEXT,
GFX_MAUERWERK,1,100, HA_NEXT,
+ GFX_MAUER_R1,3,4, GFX_MAUERWERK,1,20, GFX_LEERRAUM,1,10,
+ GFX_MAUER_L1,3,4, GFX_MAUERWERK,1,20, GFX_LEERRAUM,1,10, HA_NEXT,
+ GFX_UNSICHTBAR,1,100, HA_NEXT,
GFX_FELSBODEN,1,100, HA_NEXT,
+ GFX_CHAR_A,30,3, GFX_CHAR_AUSRUF,32,3, HA_NEXT,
GFX_EDELSTEIN,2,5, HA_NEXT,
GFX_DIAMANT,2,5, HA_NEXT,
+ GFX_EDELSTEIN2,2,5, HA_NEXT,
+ GFX_EDELSTEIN3,2,5, HA_NEXT,
GFX_FELSBROCKEN,4,5, HA_NEXT,
GFX_BOMBE,1,50, GFX_EXPLOSION,8,1, GFX_LEERRAUM,1,10, HA_NEXT,
GFX_KOKOSNUSS,1,50, GFX_CRACKINGNUT,3,1, GFX_EDELSTEIN,1,10, HA_NEXT,
- GFX_ERZ_1,1,50, GFX_EXPLOSION,8,1, GFX_EDELSTEIN,1,10, HA_NEXT,
- GFX_ERZ_2,1,50, GFX_EXPLOSION,8,1, GFX_DIAMANT,1,10, HA_NEXT,
+ GFX_ERZ_EDEL,1,50, GFX_EXPLOSION,8,1, GFX_EDELSTEIN,1,10, HA_NEXT,
+ GFX_ERZ_DIAM,1,50, GFX_EXPLOSION,8,1, GFX_DIAMANT,1,10, HA_NEXT,
+ GFX_ERZ_EDEL2,1,50, GFX_EXPLOSION,8,1, GFX_EDELSTEIN2,1,10, HA_NEXT,
+ GFX_ERZ_EDEL3,1,50, GFX_EXPLOSION,8,1, GFX_EDELSTEIN3,1,10, HA_NEXT,
GFX_GEBLUBBER,4,4, HA_NEXT,
GFX_SCHLUESSEL1,4,33, HA_NEXT,
GFX_PFORTE1,4,33, HA_NEXT,
GFX_PFORTE1X,4,33, HA_NEXT,
GFX_DYNAMIT_AUS,1,100, HA_NEXT,
GFX_DYNAMIT,7,6, GFX_EXPLOSION,8,1, GFX_LEERRAUM,1,10, HA_NEXT,
+ GFX_DYNABOMB,1,33, GFX_EXPLOSION,8,1, GFX_LEERRAUM,1,10, HA_NEXT,
+ GFX_DYNABOMB_NR,1,100, HA_NEXT,
+ GFX_DYNABOMB_SZ,1,100, HA_NEXT,
GFX_FLIEGER+4,1,3, GFX_FLIEGER+0,1,3, GFX_FLIEGER+4,1,3,
GFX_FLIEGER+5,1,3, GFX_FLIEGER+1,1,3, GFX_FLIEGER+5,1,3,
GFX_FLIEGER+6,1,3, GFX_FLIEGER+2,1,3, GFX_FLIEGER+6,1,3,
GFX_PACMAN+3,1,3, GFX_PACMAN+7,1,2, GFX_PACMAN+3,1,3, HA_NEXT,
GFX_MAMPFER+0,4,0, GFX_MAMPFER+3,1,0, GFX_MAMPFER+2,1,0,
GFX_MAMPFER+1,1,0, HA_NEXT,
+ GFX_MAMPFER2+0,4,0, GFX_MAMPFER2+3,1,0, GFX_MAMPFER2+2,1,0,
+ GFX_MAMPFER2+1,1,0, HA_NEXT,
GFX_ZOMBIE+0,4,0, GFX_ZOMBIE+3,1,0, GFX_ZOMBIE+2,1,0,
GFX_ZOMBIE+1,1,0, HA_NEXT,
GFX_ABLENK,4,1, HA_NEXT,
- GFX_AMOEBE_LEBT,4,40, HA_NEXT,
+ GFX_BIRNE_AUS,1,33, GFX_BIRNE_EIN,1,33, HA_NEXT,
+ GFX_ZEIT_VOLL,1,33, GFX_ZEIT_LEER,1,33, HA_NEXT,
+ GFX_TROPFEN,1,33, GFX_AMOEBING,4,1, GFX_AMOEBE_LEBT,1,10, HA_NEXT,
GFX_AMOEBE_TOT+2,2,50, GFX_AMOEBE_TOT,2,50, HA_NEXT,
+ GFX_AMOEBE_LEBT,4,40, HA_NEXT,
+ GFX_AMOEBE_LEBT,1,10, GFX_AMOEBING,4,2, HA_NEXT,
+ GFX_AMOEBE_LEBT,1,33, GFX_AMOEBE_TOT,1,33, GFX_EXPLOSION,8,1,
+ GFX_DIAMANT,1,10, HA_NEXT,
+ GFX_LIFE,1,100, HA_NEXT,
+ GFX_LIFE_ASYNC,1,100, HA_NEXT,
GFX_SIEB_LEER,4,2, HA_NEXT,
+ GFX_SIEB2_LEER,4,2, HA_NEXT,
+ GFX_AUSGANG_ZU,1,100, GFX_AUSGANG_ACT,4,2,
+ GFX_AUSGANG_AUF+0,4,1, GFX_AUSGANG_AUF+3,1,1,
+ GFX_AUSGANG_AUF+2,1,1, GFX_AUSGANG_AUF+1,1,1, HA_NEXT,
+ GFX_AUSGANG_AUF+0,4,1, GFX_AUSGANG_AUF+3,1,1,
+ GFX_AUSGANG_AUF+2,1,1, GFX_AUSGANG_AUF+1,1,1, HA_NEXT,
HA_END
};
static char *helpscreen_eltext[][2] =
{
- "Normal sand:", "You can dig through it",
- "Empty field:", "You can walk through it",
- "Quicksand: You cannot pass it,", "but rocks can fall though it",
- "Massive Wall:", "Nothing can go through it",
- "Normal Wall: You can't go through", "it, but you can bomb it away",
- "Old Wall: Like normal wall, but", "some things can fall down from it",
- "Emerald: You must collect enough of", "them to finish a level",
- "Diamond: Counts as 3 emeralds;", "Can be destroyed by rocks",
- "Rock: Smashes several things;", "Can be moved by the player",
- "Bomb: You can move it, but be", "careful when dropping it",
- "Nut: Throw a rock on it to open it;", "Each nut contains an emerald",
- "Wall with an Emerald inside:", "Bomb the wall away to get it",
- "Wall with a Diamond inside:", "Bomb the wall away to get it",
- "Acid: Destroys everything that", "falls or walks into it",
- "Key: Opens the door that has the", "same color (red/yellow/green/blue)",
- "Door: Can be opened by the key", "with the same color",
- "Door: You have to find out the", "right color of the key for it",
- "Dynamite: Collect it and use it to", "destroy walls or kill enemies",
- "Dynamite: This one explodes after", "a few seconds",
- "Spaceship: Moves at the left side", "of walls; don't touch it!",
- "Bug: Moves at the right side of", "walls; don't touch it!",
- "Pacman: Eats the amoeba and you,", "if you're not careful",
- "Cruncher: Eats diamonds and you,", "if you're not careful",
- "Robot: Tries to kill the player", "",
- "Magic Wheel: Touch it to get rid of", "the robots for some seconds",
- "Living Amoeba: Grows through empty", "fields, sand and quicksand",
- "Dead Amoeba: Does not grow, but", "can still kill bugs and spaceships",
- "Magic Wall: Changes rocks, emeralds", "and diamonds when they pass it",
+ "THE HERO:", "(Is _this_ guy good old Rockford?)",
+ "Normal sand:", "You can dig through it",
+ "Empty field:", "You can walk through it",
+ "Quicksand: You cannot pass it,", "but rocks can fall though it",
+ "Massive Wall:", "Nothing can go through it",
+ "Normal Wall: You can't go through", "it, but you can bomb it away",
+ "Growing Wall: Grows to the left or", "right if there is an empty field",
+ "Invisible Wall: Behaves like normal","wall, but is invisible",
+ "Old Wall: Like normal wall, but", "some things can fall down from it",
+ "Letter Wall: Looks like a letter,", "behaves like a normal wall",
+ "Emerald: You must collect enough of","them to finish a level",
+ "Diamond: Counts as 3 emeralds, but", "can be destroyed by rocks",
+ "Diamond (BD style): Counts like one","emerald and behaves a bit different",
+ "Red emerald: Seems to behave like", "the BD style diamond",
+ "Rock: Smashes several things;", "Can be moved by the player",
+ "Bomb: You can move it, but be", "careful when dropping it",
+ "Nut: Throw a rock on it to open it;","Each nut contains an emerald",
+ "Wall with an emerald inside:", "Bomb the wall away to get it",
+ "Wall with a diamond inside:", "Bomb the wall away to get it",
+ "Wall with BD style diamond inside:", "Bomb the wall away to get it",
+ "Wall with red emerald inside:", "Bomb the wall away to get it",
+ "Acid: Things that fall in are gone", "forever (including our hero)",
+ "Key: Opens the door that has the", "same color (red/yellow/green/blue)",
+ "Door: Can be opened by the key", "with the same color",
+ "Door: You have to find out the", "right color of the key for it",
+ "Dynamite: Collect it and use it to", "destroy walls or kill enemies",
+ "Dynamite: This one explodes after", "a few seconds",
+ "Dyna Bomb: Explodes in 4 directions","with variable explosion size",
+ "Dyna Bomb: Increases the number of", "dyna bombs available at a time",
+ "Dyna Bomb: Increases the size of", "explosion of dyna bombs",
+ "Spaceship: Moves at the left side", "of walls; don't touch it!",
+ "Bug: Moves at the right side of", "walls; don't touch it!",
+ "Pacman: Eats the amoeba and you,", "if you're not careful",
+ "Cruncher: Eats diamonds and you,", "if you're not careful",
+ "Cruncher (BD style):", "Eats almost everything",
+ "Robot: Tries to kill the player", "",
+ "Magic Wheel: Touch it to get rid of","the robots for some seconds",
+ "Light Bulb: It seems to have no", "special function, but looks nice",
+ "Extra Time Orb: Adds some seconds", "to the time available for the level",
+ "Amoeba Drop: Grows to an amoeba on", "the ground - don't touch it",
+ "Dead Amoeba: Does not grow, but", "can still kill bugs and spaceships",
+ "Normal Amoeba: Grows through empty", "fields, sand and quicksand",
+ "Dropping Amoeba: This one makes", "drops that grow to a new amoeba",
+ "Living Amoeba (BD style): Contains", "other element, when surrounded",
+ "Game Of Life: Behaves like the well","known 'Game Of Life' (2333 style)",
+ "Biomaze: A bit like the 'Game Of", "Life', but builds crazy mazes",
+ "Magic Wall: Changes rocks, emeralds","and diamonds when they pass it",
+ "Magic Wall (BD style):", "Changes rocks and BD style diamonds",
+ "Exit door: Opens if you have enough","emeralds to finish the level",
+ "Open exit door: Enter here to leave","the level and exit the actual game",
};
static int num_helpscreen_els = sizeof(helpscreen_eltext)/(2*sizeof(char *));
PlaySoundLoop(background_loop[num]);
}
-void DrawHelpScreenRegistrationText()
+void DrawHelpScreenCreditsText()
{
int ystart = 150, ystep = 30;
char text[FULL_SXSIZE/FONT2_XSIZE+10];
DrawText(SX+25+16, SY+46, "Copyright ^1995 by Holger Schemel",
FS_SMALL,FC_RED);
- sprintf(text,"Registration information:");
+ sprintf(text,"Program information:");
DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+100,
text,FS_SMALL,FC_GREEN);
- sprintf(text,"Unregistered version");
+ sprintf(text,"This game is Freeware!");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+0*ystep,
+ text,FS_SMALL,FC_YELLOW);
+ sprintf(text,"If you like it, send e-mail to:");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+1*ystep,
+ text,FS_SMALL,FC_YELLOW);
+ sprintf(text,"aeglos@valinor.owl.de");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+2*ystep,
+ text,FS_SMALL,FC_RED);
+ sprintf(text,"or SnailMail to:");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+3*ystep,
+ text,FS_SMALL,FC_YELLOW);
+ sprintf(text,"Holger Schemel");
DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep,
+ text,FS_SMALL,FC_RED);
+ sprintf(text,"Sennehof 28");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep+20,
+ text,FS_SMALL,FC_RED);
+ sprintf(text,"33659 Bielefeld");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep+40,
+ text,FS_SMALL,FC_RED);
+ sprintf(text,"Germany");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+4*ystep+60,
+ text,FS_SMALL,FC_RED);
+
+ sprintf(text,"If you have created new levels,");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+7*ystep,
+ text,FS_SMALL,FC_YELLOW);
+ sprintf(text,"send them to me to include them!");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+8*ystep,
+ text,FS_SMALL,FC_YELLOW);
+ sprintf(text,":-)");
+ DrawText(SX+(SXSIZE-strlen(text)*FONT2_XSIZE)/2,SY+ystart+9*ystep,
text,FS_SMALL,FC_YELLOW);
sprintf(text,"Press any key or button for main menu");
else if (helpscreen_state==num_helpscreen_els_pages+num_bg_loops-1)
{
helpscreen_state++;
- DrawHelpScreenRegistrationText();
+ DrawHelpScreenCreditsText();
}
else
{
{
int i;
+ CloseDoor(DOOR_CLOSE_2);
+
ClearWindow();
DrawText(SX,SY,"Level Directories",FS_BIG,FC_GREEN);
for(i=0;i<num_leveldirs;i++)
DrawText(SX+32, SY+5*32,"Toons:",FS_BIG,FC_GREEN);
DrawText(SX+32, SY+6*32,"Buffered gfx:",FS_BIG,FC_GREEN);
DrawText(SX+32, SY+7*32,"Fading:",FS_BIG,FC_GREEN);
- DrawText(SX+32, SY+8*32,"Auto-Record:",FS_BIG,FC_GREEN);
- DrawText(SX+32, SY+9*32,"Joystick:",FS_BIG,FC_GREEN);
- DrawText(SX+32, SY+10*32,"Cal. Joystick",FS_BIG,FC_GREEN);
- DrawText(SX+32, SY+12*32,"Exit",FS_BIG,FC_GREEN);
- DrawText(SX+32, SY+13*32,"Save and exit",FS_BIG,FC_GREEN);
+ DrawText(SX+32, SY+8*32,"Quick Doors:",FS_BIG,FC_GREEN);
+ DrawText(SX+32, SY+9*32,"Auto-Record:",FS_BIG,FC_GREEN);
+ DrawText(SX+32, SY+10*32,"Joystick:",FS_BIG,FC_GREEN);
+ DrawText(SX+32, SY+11*32,"Cal. Joystick",FS_BIG,FC_GREEN);
+
+ DrawText(SX+32, SY+13*32,"Exit",FS_BIG,FC_GREEN);
+ DrawText(SX+32, SY+14*32,"Save and exit",FS_BIG,FC_GREEN);
if (SETUP_SOUND_ON(player.setup))
DrawText(SX+14*32, SY+2*32,"on",FS_BIG,FC_YELLOW);
else
DrawText(SX+14*32, SY+7*32,"off",FS_BIG,FC_BLUE);
- if (SETUP_RECORD_EACH_GAME_ON(player.setup))
+ if (SETUP_QUICK_DOORS_ON(player.setup))
DrawText(SX+14*32, SY+8*32,"on",FS_BIG,FC_YELLOW);
else
DrawText(SX+14*32, SY+8*32,"off",FS_BIG,FC_BLUE);
+ if (SETUP_RECORD_EACH_GAME_ON(player.setup))
+ DrawText(SX+14*32, SY+9*32,"on",FS_BIG,FC_YELLOW);
+ else
+ DrawText(SX+14*32, SY+9*32,"off",FS_BIG,FC_BLUE);
+
if (SETUP_2ND_JOYSTICK_ON(player.setup))
- DrawText(SX+14*32, SY+9*32,"2nd",FS_BIG,FC_YELLOW);
+ DrawText(SX+14*32, SY+10*32,"2nd",FS_BIG,FC_YELLOW);
else
- DrawText(SX+14*32, SY+9*32,"1st",FS_BIG,FC_YELLOW);
+ DrawText(SX+14*32, SY+10*32,"1st",FS_BIG,FC_YELLOW);
- for(i=2;i<14;i++)
- if (i!=11)
+ for(i=2;i<15;i++)
+ if (i!=12)
DrawGraphic(0,i,GFX_KUGEL_BLAU);
FadeToFront();
else
x = y = 0;
- if (y==12)
- y = (dy>0 ? 13 : 11);
+ if (y==13)
+ y = (dy>0 ? 14 : 12);
if (y<3)
y = 3;
- else if (y>14)
- y = 14;
+ else if (y>15)
+ y = 15;
}
if (!mx && !my && !dx && !dy)
y = choice;
}
- if (x==1 && y>=3 && y<=14 && y!=12)
+ if (x==1 && y>=3 && y<=15 && y!=13)
{
if (button)
{
player.setup ^= SETUP_FADING;
}
else if (y==9)
+ {
+ if (SETUP_QUICK_DOORS_ON(player.setup))
+ DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
+ else
+ DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
+ player.setup ^= SETUP_QUICK_DOORS;
+ }
+ else if (y==10)
{
if (SETUP_RECORD_EACH_GAME_ON(player.setup))
DrawText(SX+14*32, SY+yy*32,"off",FS_BIG,FC_BLUE);
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
player.setup ^= SETUP_RECORD_EACH_GAME;
}
- else if (y==10)
+ else if (y==11)
{
if (SETUP_2ND_JOYSTICK_ON(player.setup))
DrawText(SX+14*32, SY+yy*32,"1st",FS_BIG,FC_YELLOW);
DrawText(SX+14*32, SY+yy*32,"2nd",FS_BIG,FC_YELLOW);
player.setup ^= SETUP_2ND_JOYSTICK;
}
- else if (y==11)
+ else if (y==12)
{
CalibrateJoystick();
redraw = TRUE;
}
- else if (y==13 || y==14)
+ else if (y==14 || y==15)
{
- if (y==14)
+ if (y==15)
{
SavePlayerInfo(PLAYER_SETUP);
SaveJoystickData();
DoAnimation();
}
+void CalibrateJoystick()
+{
+#ifdef __FreeBSD__
+ struct joystick joy_ctrl;
+#else
+ struct joystick_control
+ {
+ int buttons;
+ int x;
+ int y;
+ } joy_ctrl;
+#endif
+
+ int new_joystick_xleft, new_joystick_xright, new_joystick_xmiddle;
+ int new_joystick_yupper, new_joystick_ylower, new_joystick_ymiddle;
+
+ if (joystick_status==JOYSTICK_OFF)
+ goto error_out;
+
+ ClearWindow();
+ DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
+ DrawText(SX+16, SY+8*32, " THE UPPER LEFT ",FS_BIG,FC_YELLOW);
+ DrawText(SX+16, SY+9*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
+ BackToFront();
+
+#ifdef __FreeBSD__
+ joy_ctrl.b1 = joy_ctrl.b2 = 0;
+#else
+ joy_ctrl.buttons = 0;
+#endif
+ while(Joystick() & JOY_BUTTON);
+#ifdef __FreeBSD__
+ while(!(joy_ctrl.b1||joy_ctrl.b2))
+#else
+ while(!joy_ctrl.buttons)
+#endif
+ {
+ if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
+ {
+ joystick_status=JOYSTICK_OFF;
+ goto error_out;
+ }
+ Delay(10000);
+ }
+
+ new_joystick_xleft = joy_ctrl.x;
+ new_joystick_yupper = joy_ctrl.y;
+
+ ClearWindow();
+ DrawText(SX+16, SY+7*32, "MOVE JOYSTICK TO",FS_BIG,FC_YELLOW);
+ DrawText(SX+32, SY+8*32, "THE LOWER RIGHT",FS_BIG,FC_YELLOW);
+ DrawText(SX+16, SY+9*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
+ BackToFront();
+
+#ifdef __FreeBSD__
+ joy_ctrl.b1 = joy_ctrl.b2 = 0;
+#else
+ joy_ctrl.buttons = 0;
+#endif
+ while(Joystick() & JOY_BUTTON);
+#ifdef __FreeBSD__
+ while(!(joy_ctrl.b1||joy_ctrl.b2))
+#else
+ while(!joy_ctrl.buttons)
+#endif
+ {
+ if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
+ {
+ joystick_status=JOYSTICK_OFF;
+ goto error_out;
+ }
+ Delay(10000);
+ }
+
+ new_joystick_xright = joy_ctrl.x;
+ new_joystick_ylower = joy_ctrl.y;
+
+ ClearWindow();
+ DrawText(SX+32, SY+16+7*32, "CENTER JOYSTICK",FS_BIG,FC_YELLOW);
+ DrawText(SX+16, SY+16+8*32, "AND PRESS BUTTON",FS_BIG,FC_YELLOW);
+ BackToFront();
+
+#ifdef __FreeBSD__
+ joy_ctrl.b1 = joy_ctrl.b2 = 0;
+#else
+ joy_ctrl.buttons = 0;
+#endif
+ while(Joystick() & JOY_BUTTON);
+#ifdef __FreeBSD__
+ while(!(joy_ctrl.b1||joy_ctrl.b2))
+#else
+ while(!joy_ctrl.buttons)
+#endif
+ {
+ if (read(joystick_device, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
+ {
+ joystick_status=JOYSTICK_OFF;
+ goto error_out;
+ }
+ Delay(10000);
+ }
+
+ new_joystick_xmiddle = joy_ctrl.x;
+ new_joystick_ymiddle = joy_ctrl.y;
+
+ joystick[joystick_nr].xleft = new_joystick_xleft;
+ joystick[joystick_nr].yupper = new_joystick_yupper;
+ joystick[joystick_nr].xright = new_joystick_xright;
+ joystick[joystick_nr].ylower = new_joystick_ylower;
+ joystick[joystick_nr].xmiddle = new_joystick_xmiddle;
+ joystick[joystick_nr].ymiddle = new_joystick_ymiddle;
+
+ CheckJoystickData();
+
+ DrawSetupScreen();
+ while(Joystick() & JOY_BUTTON);
+ return;
+
+ error_out:
+
+ ClearWindow();
+ DrawText(SX+16, SY+16, "NO JOYSTICK",FS_BIG,FC_YELLOW);
+ DrawText(SX+16, SY+48, " AVAILABLE ",FS_BIG,FC_YELLOW);
+ Delay(3000000);
+ DrawSetupScreen();
+}
+
void HandleVideoButtons(int mx, int my, int button)
{
if (game_status!=MAINMENU && game_status!=PLAYING)
break;
}
}
-
-int CheckVideoButtons(int mx, int my, int button)
-{
- int return_code = 0;
- static int choice = -1;
- static BOOL pressed = FALSE;
- static int video_button[5] =
- {
- VIDEO_PRESS_EJECT_ON,
- VIDEO_PRESS_STOP_ON,
- VIDEO_PRESS_PAUSE_ON,
- VIDEO_PRESS_REC_ON,
- VIDEO_PRESS_PLAY_ON
- };
-
- if (button)
- {
- if (!motion_status) /* Maustaste neu gedrückt */
- {
- if (ON_VIDEO_BUTTON(mx,my))
- {
- choice = VIDEO_BUTTON(mx);
- pressed = TRUE;
- DrawVideoDisplay(video_button[choice],0);
- }
- }
- else /* Mausbewegung bei gedrückter Maustaste */
- {
- if ((!ON_VIDEO_BUTTON(mx,my) || VIDEO_BUTTON(mx)!=choice) &&
- choice>=0 && pressed)
- {
- pressed = FALSE;
- DrawVideoDisplay(video_button[choice]<<1,0);
- }
- else if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && !pressed)
- {
- pressed = TRUE;
- DrawVideoDisplay(video_button[choice],0);
- }
- }
- }
- else /* Maustaste wieder losgelassen */
- {
- if (ON_VIDEO_BUTTON(mx,my) && VIDEO_BUTTON(mx)==choice && pressed)
- {
- DrawVideoDisplay(video_button[choice]<<1,0);
- return_code = choice+1;
- choice = -1;
- pressed = FALSE;
- }
- else
- {
- choice = -1;
- pressed = FALSE;
- }
- }
-
- BackToFront();
- return(return_code);
-}
-
-int CheckSoundButtons(int mx, int my, int button)
-{
- int return_code = 0;
- static int choice = -1;
- static BOOL pressed = FALSE;
- int sound_state[3];
-
- sound_state[0] = BUTTON_SOUND_MUSIC | (BUTTON_ON * sound_music_on);
- sound_state[1] = BUTTON_SOUND_LOOPS | (BUTTON_ON * sound_loops_on);
- sound_state[2] = BUTTON_SOUND_SOUND | (BUTTON_ON * sound_on);
-
- if (button)
- {
- if (!motion_status) /* Maustaste neu gedrückt */
- {
- if (ON_SOUND_BUTTON(mx,my))
- {
- choice = SOUND_BUTTON(mx);
- pressed = TRUE;
- DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
- }
- }
- else /* Mausbewegung bei gedrückter Maustaste */
- {
- if ((!ON_SOUND_BUTTON(mx,my) || SOUND_BUTTON(mx)!=choice) &&
- choice>=0 && pressed)
- {
- pressed = FALSE;
- DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
- }
- else if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && !pressed)
- {
- pressed = TRUE;
- DrawSoundDisplay(sound_state[choice] | BUTTON_PRESSED);
- }
- }
- }
- else /* Maustaste wieder losgelassen */
- {
- if (ON_SOUND_BUTTON(mx,my) && SOUND_BUTTON(mx)==choice && pressed)
- {
- DrawSoundDisplay(sound_state[choice] | BUTTON_RELEASED);
- return_code = 1<<choice;
- choice = -1;
- pressed = FALSE;
- }
- else
- {
- choice = -1;
- pressed = FALSE;
- }
- }
-
- BackToFront();
- return(return_code);
-}
-
-int CheckGameButtons(int mx, int my, int button)
-{
- int return_code = 0;
- static int choice = -1;
- static BOOL pressed = FALSE;
- int game_state[3] =
- {
- BUTTON_GAME_STOP,
- BUTTON_GAME_PAUSE,
- BUTTON_GAME_PLAY
- };
-
- if (button)
- {
- if (!motion_status) /* Maustaste neu gedrückt */
- {
- if (ON_GAME_BUTTON(mx,my))
- {
- choice = GAME_BUTTON(mx);
- pressed = TRUE;
- DrawGameButton(game_state[choice] | BUTTON_PRESSED);
- }
- }
- else /* Mausbewegung bei gedrückter Maustaste */
- {
- if ((!ON_GAME_BUTTON(mx,my) || GAME_BUTTON(mx)!=choice) &&
- choice>=0 && pressed)
- {
- pressed = FALSE;
- DrawGameButton(game_state[choice] | BUTTON_RELEASED);
- }
- else if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && !pressed)
- {
- pressed = TRUE;
- DrawGameButton(game_state[choice] | BUTTON_PRESSED);
- }
- }
- }
- else /* Maustaste wieder losgelassen */
- {
- if (ON_GAME_BUTTON(mx,my) && GAME_BUTTON(mx)==choice && pressed)
- {
- DrawGameButton(game_state[choice] | BUTTON_RELEASED);
- return_code = 1<<choice;
- choice = -1;
- pressed = FALSE;
- }
- else
- {
- choice = -1;
- pressed = FALSE;
- }
- }
-
- BackToFront();
- return(return_code);
-}
-
-int CheckChooseButtons(int mx, int my, int button)
-{
- int return_code = 0;
- static int choice = -1;
- static BOOL pressed = FALSE;
- static int choose_button[5] =
- {
- BUTTON_OK,
- BUTTON_NO
- };
-
- if (button)
- {
- if (!motion_status) /* Maustaste neu gedrückt */
- {
- if (ON_CHOOSE_BUTTON(mx,my))
- {
- choice = CHOOSE_BUTTON(mx);
- pressed = TRUE;
- DrawChooseButton(choose_button[choice] | BUTTON_PRESSED);
- }
- }
- else /* Mausbewegung bei gedrückter Maustaste */
- {
- if ((!ON_CHOOSE_BUTTON(mx,my) || CHOOSE_BUTTON(mx)!=choice) &&
- choice>=0 && pressed)
- {
- pressed = FALSE;
- DrawChooseButton(choose_button[choice] | BUTTON_RELEASED);
- }
- else if (ON_CHOOSE_BUTTON(mx,my) &&CHOOSE_BUTTON(mx)==choice && !pressed)
- {
- pressed = TRUE;
- DrawChooseButton(choose_button[choice] | BUTTON_PRESSED);
- }
- }
- }
- else /* Maustaste wieder losgelassen */
- {
- if (ON_CHOOSE_BUTTON(mx,my) && CHOOSE_BUTTON(mx)==choice && pressed)
- {
- DrawChooseButton(choose_button[choice] | BUTTON_RELEASED);
- return_code = choice+1;
- choice = -1;
- pressed = FALSE;
- }
- else
- {
- choice = -1;
- pressed = FALSE;
- }
- }
-
- BackToFront();
- return(return_code);
-}
-
-int CheckConfirmButton(int mx, int my, int button)
-{
- int return_code = 0;
- static int choice = -1;
- static BOOL pressed = FALSE;
-
- if (button)
- {
- if (!motion_status) /* Maustaste neu gedrückt */
- {
- if (ON_CONFIRM_BUTTON(mx,my))
- {
- choice = 0;
- pressed = TRUE;
- DrawConfirmButton(BUTTON_PRESSED);
- }
- }
- else /* Mausbewegung bei gedrückter Maustaste */
- {
- if (!ON_CONFIRM_BUTTON(mx,my) && choice>=0 && pressed)
- {
- pressed = FALSE;
- DrawConfirmButton(BUTTON_RELEASED);
- }
- else if (ON_CONFIRM_BUTTON(mx,my) && !pressed)
- {
- pressed = TRUE;
- DrawConfirmButton(BUTTON_PRESSED);
- }
- }
- }
- else /* Maustaste wieder losgelassen */
- {
- if (ON_CONFIRM_BUTTON(mx,my) && pressed)
- {
- DrawConfirmButton(BUTTON_RELEASED);
- return_code = BUTTON_CONFIRM;
- choice = -1;
- pressed = FALSE;
- }
- else
- {
- choice = -1;
- pressed = FALSE;
- }
- }
-
- BackToFront();
- return(return_code);
-}
-
-void DrawCompleteVideoDisplay()
-{
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- DOOR_GFX_PAGEX3,DOOR_GFX_PAGEY2, VXSIZE,VYSIZE, VX,VY);
- XCopyArea(display,pix[PIX_DOOR],drawto,gc,
- DOOR_GFX_PAGEX4+VIDEO_CONTROL_XPOS,
- DOOR_GFX_PAGEY2+VIDEO_CONTROL_YPOS,
- VIDEO_CONTROL_XSIZE,VIDEO_CONTROL_YSIZE,
- VX+VIDEO_CONTROL_XPOS,VY+VIDEO_CONTROL_YPOS);
-
- DrawVideoDisplay(VIDEO_ALL_OFF,0);
- if (tape.date && tape.length)
- {
- DrawVideoDisplay(VIDEO_STATE_DATE_ON,tape.date);
- DrawVideoDisplay(VIDEO_STATE_TIME_ON,0);
- }
-
- XCopyArea(display,drawto,pix[PIX_DB_DOOR],gc,
- VX,VY, VXSIZE,VYSIZE, DOOR_GFX_PAGEX1,DOOR_GFX_PAGEY2);
-}