/***********************************************************
* Rocks'n'Diamonds -- McDuffin Strikes Back! *
*----------------------------------------------------------*
-* (c) 1995-2000 Artsoft Entertainment *
+* (c) 1995-2001 Artsoft Entertainment *
* Holger Schemel *
* Detmolder Strasse 189 *
* 33604 Bielefeld *
#include "tools.h"
#include "game.h"
#include "editor.h"
+#include "files.h"
#include "tape.h"
-#include "joystick.h"
#include "network.h"
/* values for key_status */
void HandleExposeEvent(ExposeEvent *event)
{
#ifndef TARGET_SDL
- int x = event->x, y = event->y;
- int width = event->width, height = event->height;
-
- if (setup.direct_draw && game_status==PLAYING)
- {
- int xx,yy;
- int x1 = (x-SX)/TILEX, y1 = (y-SY)/TILEY;
- int x2 = (x-SX+width)/TILEX, y2 = (y-SY+height)/TILEY;
-
- SetDrawtoField(DRAW_BACKBUFFER);
-
- for(xx=0; xx<SCR_FIELDX; xx++)
- for(yy=0; yy<SCR_FIELDY; yy++)
- if (xx>=x1 && xx<=x2 && yy>=y1 && yy<=y2)
- DrawScreenField(xx,yy);
- DrawAllPlayers();
-
- SetDrawtoField(DRAW_DIRECT);
- }
-
- if (setup.soft_scrolling && game_status == PLAYING)
- {
- int fx = FX, fy = FY;
-
- fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
- fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0);
-
- BlitBitmap(fieldbuffer, backbuffer, fx,fy, SXSIZE,SYSIZE, SX,SY);
- }
-
- BlitBitmap(drawto, window, x,y, width,height, x,y);
-
+ RedrawPlayfield(FALSE, event->x, event->y, event->width, event->height);
FlushDisplay();
#endif
}
int i;
KeyboardAutoRepeatOn();
- old_joystick_status = joystick_status;
- joystick_status = JOYSTICK_OFF;
+ old_joystick_status = joystick.status;
+ joystick.status = JOYSTICK_NOT_AVAILABLE;
/* simulate key release events for still pressed keys */
key_joystick_mapping = 0;
KeyboardAutoRepeatOff();
}
if (old_joystick_status != -1)
- joystick_status = old_joystick_status;
+ joystick.status = old_joystick_status;
}
}
HandleSetupScreen(mx,my, 0,0, button);
break;
- case SETUPINPUT:
- HandleSetupInputScreen(mx,my, 0,0, button);
- break;
-
case PLAYING:
#ifdef DEBUG
if (button == MB_RELEASED)
}
/* allow quick escape to the main menu with the Escape key */
- if (key == KSYM_Escape && game_status != MAINMENU)
+ if (key == KSYM_Escape &&
+ game_status != MAINMENU &&
+ game_status != LEVELED &&
+ game_status != CHOOSELEVEL &&
+ game_status != SETUP)
{
- CloseDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY);
game_status = MAINMENU;
DrawMainMenu();
return;
case MAINMENU:
case CHOOSELEVEL:
case SETUP:
- case SETUPINPUT:
switch(key)
{
case KSYM_Return:
HandleChooseLevel(0,0, 0,0, MB_MENU_CHOICE);
else if (game_status == SETUP)
HandleSetupScreen(0,0, 0,0, MB_MENU_CHOICE);
- else if (game_status == SETUPINPUT)
- HandleSetupInputScreen(0,0, 0,0, MB_MENU_CHOICE);
+ break;
+
+ case KSYM_Escape:
+ if (game_status == CHOOSELEVEL)
+ HandleChooseLevel(0,0, 0,0, MB_MENU_LEAVE);
+ else if (game_status == SETUP)
+ HandleSetupScreen(0,0, 0,0, MB_MENU_LEAVE);
break;
case KSYM_Page_Up:
HandleChooseLevel(0,0, 0,SCR_FIELDY, MB_MENU_MARK);
break;
+#ifdef DEBUG
+ case KSYM_t:
+ DumpTape(&tape);
+ break;
+#endif
+
default:
break;
}
break;
case LEVELED:
- if (!anyTextGadgetActiveOrJustFinished)
+ if (!anyTextGadgetActiveOrJustFinished || key == KSYM_Escape)
HandleLevelEditorKeyInput(key);
break;
case MAINMENU:
case CHOOSELEVEL:
case SETUP:
- case SETUPINPUT:
{
static unsigned long joystickmove_delay = 0;
HandleChooseLevel(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
else if (game_status==SETUP)
HandleSetupScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
- else if (game_status==SETUPINPUT)
- HandleSetupInputScreen(0,0,dx,dy,
- newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
break;
}