projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20001125-3-src
[rocksndiamonds.git]
/
src
/
screens.c
diff --git
a/src/screens.c
b/src/screens.c
index 8fb300aa2030eb40fddb2a1ed8978119b0331e4d..cb715f420688cae2f69bccc3dd841872c606e127 100644
(file)
--- a/
src/screens.c
+++ b/
src/screens.c
@@
-55,16
+55,12
@@
static void HandleScreenGadgets(struct GadgetInfo *);
static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS];
-#ifdef MSDOS
-extern unsigned char get_ascii(KeySym);
-#endif
-
void DrawHeadline()
{
int x = SX + (SXSIZE - strlen(PROGRAM_TITLE_STRING) * FONT1_XSIZE) / 2;
DrawText(x, SY + 8, PROGRAM_TITLE_STRING, FS_BIG, FC_YELLOW);
void DrawHeadline()
{
int x = SX + (SXSIZE - strlen(PROGRAM_TITLE_STRING) * FONT1_XSIZE) / 2;
DrawText(x, SY + 8, PROGRAM_TITLE_STRING, FS_BIG, FC_YELLOW);
- DrawTextFCentered(46, FC_RED,
COPYRIGHT
_STRING);
+ DrawTextFCentered(46, FC_RED,
WINDOW_SUBTITLE
_STRING);
}
void DrawMainMenu()
}
void DrawMainMenu()
@@
-88,6
+84,12
@@
void DrawMainMenu()
/* needed if last screen was the editor screen */
UndrawSpecialEditorDoor();
/* needed if last screen was the editor screen */
UndrawSpecialEditorDoor();
+ /* needed if last screen was the setup screen and fullscreen state changed */
+ ChangeVideoModeIfNeeded();
+#ifdef TARGET_SDL
+ SetDrawtoField(DRAW_BACKBUFFER);
+#endif
+
/* map gadgets for main menu screen */
MapTapeButtons();
/* map gadgets for main menu screen */
MapTapeButtons();
@@
-331,7
+333,7
@@
void HandleMainMenu(int mx, int my, int dx, int dy, int button)
if (setup.autorecord)
TapeStartRecording();
if (setup.autorecord)
TapeStartRecording();
-#if
ndef MSDOS
+#if
!defined(MSDOS) && !defined(WIN32)
if (options.network)
SendToServer_StartPlaying();
else
if (options.network)
SendToServer_StartPlaying();
else
@@
-690,7
+692,7
@@
void DrawHelpScreenCreditsText()
DrawTextFCentered(100, FC_GREEN,
"Credits:");
DrawTextFCentered(ystart + 0 * ystep, FC_YELLOW,
DrawTextFCentered(100, FC_GREEN,
"Credits:");
DrawTextFCentered(ystart + 0 * ystep, FC_YELLOW,
- "DOS
/Windows
port of the game:");
+ "DOS port of the game:");
DrawTextFCentered(ystart + 1 * ystep, FC_RED,
"Guido Schulz");
DrawTextFCentered(ystart + 2 * ystep, FC_YELLOW,
DrawTextFCentered(ystart + 1 * ystep, FC_RED,
"Guido Schulz");
DrawTextFCentered(ystart + 2 * ystep, FC_YELLOW,
@@
-720,13
+722,13
@@
void DrawHelpScreenContactText()
DrawTextFCentered(ystart + 1 * ystep, FC_YELLOW,
"If you like it, send e-mail to:");
DrawTextFCentered(ystart + 2 * ystep, FC_RED,
DrawTextFCentered(ystart + 1 * ystep, FC_YELLOW,
"If you like it, send e-mail to:");
DrawTextFCentered(ystart + 2 * ystep, FC_RED,
- "
aeglos@valinor.owl.de
");
+ "
info@artsoft.org
");
DrawTextFCentered(ystart + 3 * ystep, FC_YELLOW,
"or SnailMail to:");
DrawTextFCentered(ystart + 4 * ystep + 0, FC_RED,
"Holger Schemel");
DrawTextFCentered(ystart + 4 * ystep + 20, FC_RED,
DrawTextFCentered(ystart + 3 * ystep, FC_YELLOW,
"or SnailMail to:");
DrawTextFCentered(ystart + 4 * ystep + 0, FC_RED,
"Holger Schemel");
DrawTextFCentered(ystart + 4 * ystep + 20, FC_RED,
- "
Oststrasse 11a
");
+ "
Detmolder Strasse 189
");
DrawTextFCentered(ystart + 4 * ystep + 40, FC_RED,
"33604 Bielefeld");
DrawTextFCentered(ystart + 4 * ystep + 60, FC_RED,
DrawTextFCentered(ystart + 4 * ystep + 40, FC_RED,
"33604 Bielefeld");
DrawTextFCentered(ystart + 4 * ystep + 60, FC_RED,
@@
-814,7
+816,7
@@
void HandleHelpScreen(int button)
BackToFront();
}
BackToFront();
}
-void HandleTypeName(int newxpos, Key
Sym
key)
+void HandleTypeName(int newxpos, Key key)
{
static int xpos = 0, ypos = 2;
{
static int xpos = 0, ypos = 2;
@@
-826,15
+828,15
@@
void HandleTypeName(int newxpos, KeySym key)
return;
}
return;
}
- if (((key >=
XK_A && key <= XK_Z) || (key >= XK_a && key <= XK
_z)) &&
+ if (((key >=
KEY_A && key <= KEY_Z) || (key >= KEY_a && key <= KEY
_z)) &&
xpos < MAX_PLAYER_NAME_LEN)
{
char ascii;
xpos < MAX_PLAYER_NAME_LEN)
{
char ascii;
- if (key >=
XK_A && key <= XK
_Z)
- ascii = 'A' + (char)(key -
XK
_A);
+ if (key >=
KEY_A && key <= KEY
_Z)
+ ascii = 'A' + (char)(key -
KEY
_A);
else
else
- ascii = 'a' + (char)(key -
XK
_a);
+ ascii = 'a' + (char)(key -
KEY
_a);
setup.player_name[xpos] = ascii;
setup.player_name[xpos + 1] = 0;
setup.player_name[xpos] = ascii;
setup.player_name[xpos + 1] = 0;
@@
-845,14
+847,14
@@
void HandleTypeName(int newxpos, KeySym key)
setup.player_name, FS_BIG, FC_YELLOW);
DrawGraphic(xpos + 6, ypos, GFX_KUGEL_ROT);
}
setup.player_name, FS_BIG, FC_YELLOW);
DrawGraphic(xpos + 6, ypos, GFX_KUGEL_ROT);
}
- else if ((key ==
XK_Delete || key == XK
_BackSpace) && xpos > 0)
+ else if ((key ==
KEY_Delete || key == KEY
_BackSpace) && xpos > 0)
{
xpos--;
setup.player_name[xpos] = 0;
DrawGraphic(xpos + 6, ypos, GFX_KUGEL_ROT);
DrawGraphic(xpos + 7, ypos, GFX_LEERRAUM);
}
{
xpos--;
setup.player_name[xpos] = 0;
DrawGraphic(xpos + 6, ypos, GFX_KUGEL_ROT);
DrawGraphic(xpos + 7, ypos, GFX_LEERRAUM);
}
- else if (key ==
XK
_Return && xpos > 0)
+ else if (key ==
KEY
_Return && xpos > 0)
{
DrawText(SX + 6*32, SY + ypos*32, setup.player_name, FS_BIG, FC_RED);
DrawGraphic(xpos + 6, ypos, GFX_LEERRAUM);
{
DrawText(SX + 6*32, SY + ypos*32, setup.player_name, FS_BIG, FC_RED);
DrawGraphic(xpos + 6, ypos, GFX_LEERRAUM);
@@
-1040,7
+1042,7
@@
void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
else
x = y = 0; /* no action */
else
x = y = 0; /* no action */
- if (ABS(dy) == SCR_FIELDY) /* handle
XK_Page_Up, XK
_Page_Down */
+ if (ABS(dy) == SCR_FIELDY) /* handle
KEY_Page_Up, KEY
_Page_Down */
{
dy = SIGN(dy);
step = num_page_entries - 1;
{
dy = SIGN(dy);
step = num_page_entries - 1;
@@
-1228,7
+1230,7
@@
void HandleHallOfFame(int mx, int my, int dx, int dy, int button)
return;
}
return;
}
- if (ABS(dy) == SCR_FIELDY) /* handle
XK_Page_Up, XK
_Page_Down */
+ if (ABS(dy) == SCR_FIELDY) /* handle
KEY_Page_Up, KEY
_Page_Down */
step = MAX_LEVEL_SERIES_ON_SCREEN - 1;
if (dy < 0)
step = MAX_LEVEL_SERIES_ON_SCREEN - 1;
if (dy < 0)
@@
-1287,7
+1289,10
@@
void DrawSetupScreen()
#endif
{ &setup.scroll_delay, "Scroll Delay:" },
{ &setup.soft_scrolling, "Soft Scroll.:" },
#endif
{ &setup.scroll_delay, "Scroll Delay:" },
{ &setup.soft_scrolling, "Soft Scroll.:" },
+#if 0
{ &setup.fading, "Fading:" },
{ &setup.fading, "Fading:" },
+#endif
+ { &setup.fullscreen, "Fullscreen:" },
{ &setup.quick_doors, "Quick Doors:" },
{ &setup.autorecord, "Auto-Record:" },
{ &setup.team_mode, "Team-Mode:" },
{ &setup.quick_doors, "Quick Doors:" },
{ &setup.autorecord, "Auto-Record:" },
{ &setup.team_mode, "Team-Mode:" },
@@
-1484,6
+1489,7
@@
void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
setup.soft_scrolling = !setup.soft_scrolling;
}
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
setup.soft_scrolling = !setup.soft_scrolling;
}
+#if 0
else if (y==8)
{
if (setup.fading)
else if (y==8)
{
if (setup.fading)
@@
-1492,6
+1498,15
@@
void HandleSetupScreen(int mx, int my, int dx, int dy, int button)
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
setup.fading = !setup.fading;
}
DrawText(SX+14*32, SY+yy*32,"on ",FS_BIG,FC_YELLOW);
setup.fading = !setup.fading;
}
+#endif
+ else if (y==8 && fullscreen_available)
+ {
+ if (setup.fullscreen)
+ 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);
+ setup.fullscreen = !setup.fullscreen;
+ }
else if (y==9)
{
if (setup.quick_doors)
else if (y==9)
{
if (setup.quick_doors)
@@
-1618,7
+1633,7
@@
static void drawPlayerSetupInputInfo(int player_nr)
static struct SetupKeyboardInfo custom_key;
static struct
{
static struct SetupKeyboardInfo custom_key;
static struct
{
- Key
Sym *keysym
;
+ Key
*key
;
char *text;
} custom[] =
{
char *text;
} custom[] =
{
@@
-1678,7
+1693,7
@@
static void drawPlayerSetupInputInfo(int player_nr)
DrawText(SX + 3*32, SY + ypos*32,
(setup.input[player_nr].use_joystick ?
custom[i].text :
DrawText(SX + 3*32, SY + ypos*32,
(setup.input[player_nr].use_joystick ?
custom[i].text :
- getKeyNameFromKey
Sym(*custom[i].keysym
)),
+ getKeyNameFromKey
(*custom[i].key
)),
FS_BIG, FC_YELLOW);
}
}
FS_BIG, FC_YELLOW);
}
}
@@
-1858,7
+1873,7
@@
void CustomizeKeyboard(int player_nr)
static struct SetupKeyboardInfo custom_key;
static struct
{
static struct SetupKeyboardInfo custom_key;
static struct
{
- Key
Sym *keysym
;
+ Key
*key
;
char *text;
} customize_step[] =
{
char *text;
} customize_step[] =
{
@@
-1885,7
+1900,7
@@
void CustomizeKeyboard(int player_nr)
DrawText(SX, SY + (2+2*step_nr+1)*32,
"Key:", FS_BIG, FC_RED);
DrawText(SX + 4*32, SY + (2+2*step_nr+1)*32,
DrawText(SX, SY + (2+2*step_nr+1)*32,
"Key:", FS_BIG, FC_RED);
DrawText(SX + 4*32, SY + (2+2*step_nr+1)*32,
- getKeyNameFromKey
Sym(*customize_step[step_nr].keysym
),
+ getKeyNameFromKey
(*customize_step[step_nr].key
),
FS_BIG, FC_BLUE);
while(!finished)
FS_BIG, FC_BLUE);
while(!finished)
@@
-1900,32
+1915,35
@@
void CustomizeKeyboard(int player_nr)
{
case EVENT_KEYPRESS:
{
{
case EVENT_KEYPRESS:
{
- KeySym key = XLookupKeysym((KeyEvent *)&event,
- ((KeyEvent *)&event)->state);
+ Key key = GetEventKey((KeyEvent *)&event, TRUE);
- if (key ==
XK_Escape || (key == XK
_Return && step_nr == 6))
+ if (key ==
KEY_Escape || (key == KEY
_Return && step_nr == 6))
{
finished = TRUE;
break;
}
{
finished = TRUE;
break;
}
+ /* all keys configured -- wait for "Escape" or "Return" key */
+ if (step_nr == 6)
+ break;
+
/* press 'Enter' to keep the existing key binding */
/* press 'Enter' to keep the existing key binding */
- if (key ==
XK_Return || step_nr == 6
)
- key = *customize_step[step_nr].key
sym
;
+ if (key ==
KEY_Return
)
+ key = *customize_step[step_nr].key;
/* check if key already used */
for (i=0; i<step_nr; i++)
/* check if key already used */
for (i=0; i<step_nr; i++)
- if (*customize_step[i].key
sym
== key)
+ if (*customize_step[i].key == key)
break;
if (i < step_nr)
break;
/* got new key binding */
break;
if (i < step_nr)
break;
/* got new key binding */
- *customize_step[step_nr].key
sym
= key;
+ *customize_step[step_nr].key = key;
DrawText(SX + 4*32, SY + (2+2*step_nr+1)*32,
" ", FS_BIG, FC_YELLOW);
DrawText(SX + 4*32, SY + (2+2*step_nr+1)*32,
DrawText(SX + 4*32, SY + (2+2*step_nr+1)*32,
" ", FS_BIG, FC_YELLOW);
DrawText(SX + 4*32, SY + (2+2*step_nr+1)*32,
- getKeyNameFromKey
Sym
(key), FS_BIG, FC_YELLOW);
+ getKeyNameFromKey(key), FS_BIG, FC_YELLOW);
step_nr++;
/* un-highlight last query */
step_nr++;
/* un-highlight last query */
@@
-1948,7
+1966,7
@@
void CustomizeKeyboard(int player_nr)
DrawText(SX, SY+(2+2*step_nr+1)*32,
"Key:", FS_BIG, FC_RED);
DrawText(SX + 4*32, SY+(2+2*step_nr+1)*32,
DrawText(SX, SY+(2+2*step_nr+1)*32,
"Key:", FS_BIG, FC_RED);
DrawText(SX + 4*32, SY+(2+2*step_nr+1)*32,
- getKeyNameFromKey
Sym(*customize_step[step_nr].keysym
),
+ getKeyNameFromKey
(*customize_step[step_nr].key
),
FS_BIG, FC_BLUE);
}
break;
FS_BIG, FC_BLUE);
}
break;
@@
-2065,15
+2083,14
@@
void CalibrateJoystick(int player_nr)
switch(event.type)
{
case EVENT_KEYPRESS:
switch(event.type)
{
case EVENT_KEYPRESS:
- switch(XLookupKeysym((KeyEvent *)&event,
- ((KeyEvent *)&event)->state))
+ switch(GetEventKey((KeyEvent *)&event, TRUE))
{
{
- case
XK
_Return:
+ case
KEY
_Return:
if (check_remaining == 0)
result = 1;
break;
if (check_remaining == 0)
result = 1;
break;
- case
XK
_Escape:
+ case
KEY
_Escape:
result = 0;
break;
result = 0;
break;
@@
-2093,11
+2110,17
@@
void CalibrateJoystick(int player_nr)
}
#ifndef MSDOS
}
#ifndef MSDOS
+
+#ifdef USE_SDL_JOYSTICK
+ joy_ctrl.x = Get_SDL_Joystick_Axis(joystick_fd, 0);
+ joy_ctrl.y = Get_SDL_Joystick_Axis(joystick_fd, 1);
+#else
if (read(joystick_fd, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
{
joystick_status = JOYSTICK_OFF;
goto error_out;
}
if (read(joystick_fd, &joy_ctrl, sizeof(joy_ctrl)) != sizeof(joy_ctrl))
{
joystick_status = JOYSTICK_OFF;
goto error_out;
}
+#endif
new_joystick_xleft = MIN(new_joystick_xleft, joy_ctrl.x);
new_joystick_xright = MAX(new_joystick_xright, joy_ctrl.x);
new_joystick_xleft = MIN(new_joystick_xleft, joy_ctrl.x);
new_joystick_xright = MAX(new_joystick_xright, joy_ctrl.x);
@@
-2205,7
+2228,20
@@
void CalibrateJoystick(int player_nr)
StopAnimation();
DrawSetupInputScreen();
StopAnimation();
DrawSetupInputScreen();
- while(Joystick(player_nr) & JOY_BUTTON);
+
+ /* wait until the last pressed button was released */
+ while(Joystick(player_nr) & JOY_BUTTON)
+ {
+ if (PendingEvent()) /* got event */
+ {
+ Event event;
+
+ NextEvent(&event);
+ HandleOtherEvents(&event);
+
+ Delay(10);
+ }
+ }
return;
error_out:
return;
error_out: