projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-19981114-1
[rocksndiamonds.git]
/
src
/
tools.c
diff --git
a/src/tools.c
b/src/tools.c
index 0b33994c2c28f42dc1b9813628b1c345b8aefc88..a2b46c8604fd3b8ac0fed0743e0a96dde455701e 100644
(file)
--- a/
src/tools.c
+++ b/
src/tools.c
@@
-33,7
+33,7
@@
extern boolean wait_for_vsync;
void SetDrawtoField(int mode)
{
void SetDrawtoField(int mode)
{
- if (mode == DRAW_BUFFERED && setup.soft_scrolling
_on
)
+ if (mode == DRAW_BUFFERED && setup.soft_scrolling)
{
FX = TILEX;
FY = TILEY;
{
FX = TILEX;
FY = TILEY;
@@
-64,17
+64,23
@@
void SetDrawtoField(int mode)
void BackToFront()
{
int x,y;
void BackToFront()
{
int x,y;
- Drawable buffer = (drawto_field
!= window ? drawto_field : backbuffer
);
+ Drawable buffer = (drawto_field
== window ? backbuffer : drawto_field
);
- if (setup.direct_draw
_on
&& game_status == PLAYING)
+ if (setup.direct_draw && game_status == PLAYING)
redraw_mask &= ~REDRAW_MAIN;
if (redraw_mask & REDRAW_TILES && redraw_tiles > REDRAWTILES_THRESHOLD)
redraw_mask |= REDRAW_FIELD;
redraw_mask &= ~REDRAW_MAIN;
if (redraw_mask & REDRAW_TILES && redraw_tiles > REDRAWTILES_THRESHOLD)
redraw_mask |= REDRAW_FIELD;
- if (redraw_mask & REDRAW_FIELD
|| ScreenGfxPos
)
+ if (redraw_mask & REDRAW_FIELD)
redraw_mask &= ~REDRAW_TILES;
redraw_mask &= ~REDRAW_TILES;
+ /*
+ if (redraw_mask & REDRAW_FIELD ||
+ (ScreenGfxPos && setup.soft_scrolling && game_status == PLAYING))
+ redraw_mask &= ~REDRAW_TILES;
+ */
+
if (!redraw_mask)
return;
if (!redraw_mask)
return;
@@
-107,7
+113,7
@@
void BackToFront()
{
int fx = FX, fy = FY;
{
int fx = FX, fy = FY;
- if (setup.soft_scrolling
_on
)
+ if (setup.soft_scrolling)
{
fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0);
{
fx += (ScreenMovDir & (MV_LEFT|MV_RIGHT) ? ScreenGfxPos : 0);
fy += (ScreenMovDir & (MV_UP|MV_DOWN) ? ScreenGfxPos : 0);
@@
-189,7
+195,7
@@
void FadeToFront()
/*
long fading_delay = 300;
/*
long fading_delay = 300;
- if (setup.fading
_on
&& (redraw_mask & REDRAW_FIELD))
+ if (setup.fading && (redraw_mask & REDRAW_FIELD))
{
*/
{
*/
@@
-257,7
+263,7
@@
void ClearWindow()
XFillRectangle(display,backbuffer,gc,
REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
XFillRectangle(display,backbuffer,gc,
REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
- if (setup.soft_scrolling
_on
&& game_status==PLAYING)
+ if (setup.soft_scrolling && game_status==PLAYING)
{
XFillRectangle(display,fieldbuffer,gc,
0,0, FXSIZE,FYSIZE);
{
XFillRectangle(display,fieldbuffer,gc,
0,0, FXSIZE,FYSIZE);
@@
-266,7
+272,7
@@
void ClearWindow()
else
SetDrawtoField(DRAW_BACKBUFFER);
else
SetDrawtoField(DRAW_BACKBUFFER);
- if (setup.direct_draw
_on
&& game_status==PLAYING)
+ if (setup.direct_draw && game_status==PLAYING)
{
XFillRectangle(display,window,gc,
REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
{
XFillRectangle(display,window,gc,
REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
@@
-357,11
+363,6
@@
void DrawPlayer(struct PlayerInfo *player)
int element = Feld[jx][jy];
int graphic, phase;
int element = Feld[jx][jy];
int graphic, phase;
- /*
- if (!player->active || player->gone || !IN_SCR_FIELD(sx,sy))
- return;
- */
-
if (!player->active || player->gone ||
!IN_SCR_FIELD(SCREENX(last_jx),SCREENY(last_jy)))
return;
if (!player->active || player->gone ||
!IN_SCR_FIELD(SCREENX(last_jx),SCREENY(last_jy)))
return;
@@
-410,7
+411,7
@@
void DrawPlayer(struct PlayerInfo *player)
if (!IN_SCR_FIELD(sx,sy))
return;
if (!IN_SCR_FIELD(sx,sy))
return;
- if (setup.direct_draw
_on
)
+ if (setup.direct_draw)
SetDrawtoField(DRAW_BUFFERED);
/* draw things behind the player, if needed */
SetDrawtoField(DRAW_BUFFERED);
/* draw things behind the player, if needed */
@@
-442,7
+443,7
@@
void DrawPlayer(struct PlayerInfo *player)
syy = player->GfxPos;
}
syy = player->GfxPos;
}
- if (!setup.soft_scrolling
_on
&& ScreenMovPos)
+ if (!setup.soft_scrolling && ScreenMovPos)
sxx = syy = 0;
DrawGraphicShiftedThruMask(sx,sy, sxx,syy, graphic, NO_CUTTING);
sxx = syy = 0;
DrawGraphicShiftedThruMask(sx,sy, sxx,syy, graphic, NO_CUTTING);
@@
-503,7
+504,7
@@
void DrawPlayer(struct PlayerInfo *player)
GFX_EXPLOSION + ((phase-1)/delay-1));
}
GFX_EXPLOSION + ((phase-1)/delay-1));
}
- if (setup.direct_draw
_on
)
+ if (setup.direct_draw)
{
int dest_x = SX + SCREENX(MIN(jx,last_jx))*TILEX;
int dest_y = SY + SCREENY(MIN(jy,last_jy))*TILEY;
{
int dest_x = SX + SCREENX(MIN(jx,last_jx))*TILEX;
int dest_y = SY + SCREENY(MIN(jy,last_jy))*TILEY;
@@
-1234,7
+1235,7
@@
void DrawLevel()
for(y=BY1; y<=BY2; y++)
DrawScreenField(x,y);
for(y=BY1; y<=BY2; y++)
DrawScreenField(x,y);
- if (setup.soft_scrolling
_on
)
+ if (setup.soft_scrolling)
XCopyArea(display,fieldbuffer,backbuffer,gc,
FX,FY, SXSIZE,SYSIZE,
SX,SY);
XCopyArea(display,fieldbuffer,backbuffer,gc,
FX,FY, SXSIZE,SYSIZE,
SX,SY);
@@
-1388,14
+1389,9
@@
boolean Request(char *text, unsigned int req_state)
XEvent event;
XNextEvent(display, &event);
XEvent event;
XNextEvent(display, &event);
+
switch(event.type)
{
switch(event.type)
{
- case Expose:
- HandleExposeEvent((XExposeEvent *) &event);
- break;
- case UnmapNotify:
- SleepWhileUnmapped();
- break;
case ButtonPress:
case ButtonRelease:
case MotionNotify:
case ButtonPress:
case ButtonRelease:
case MotionNotify:
@@
-1437,6
+1433,7
@@
boolean Request(char *text, unsigned int req_state)
case BUTTON_CONFIRM:
result = TRUE | FALSE;
break;
case BUTTON_CONFIRM:
result = TRUE | FALSE;
break;
+
case BUTTON_PLAYER_1:
result = 1;
break;
case BUTTON_PLAYER_1:
result = 1;
break;
@@
-1449,11
+1446,13
@@
boolean Request(char *text, unsigned int req_state)
case BUTTON_PLAYER_4:
result = 4;
break;
case BUTTON_PLAYER_4:
result = 4;
break;
+
default:
break;
}
break;
}
default:
break;
}
break;
}
+
case KeyPress:
switch(XLookupKeysym((XKeyEvent *)&event,
((XKeyEvent *)&event)->state))
case KeyPress:
switch(XLookupKeysym((XKeyEvent *)&event,
((XKeyEvent *)&event)->state))
@@
-1461,30
+1460,30
@@
boolean Request(char *text, unsigned int req_state)
case XK_Return:
result = 1;
break;
case XK_Return:
result = 1;
break;
+
case XK_Escape:
result = 0;
break;
case XK_Escape:
result = 0;
break;
+
+ default:
+ break;
}
if (req_state & REQ_PLAYER)
result = 0;
break;
}
if (req_state & REQ_PLAYER)
result = 0;
break;
+
case KeyRelease:
key_joystick_mapping = 0;
break;
case KeyRelease:
key_joystick_mapping = 0;
break;
- case FocusIn:
- case FocusOut:
- HandleFocusEvent((XFocusChangeEvent *) &event);
- break;
- case ClientMessage:
- HandleClientMessageEvent((XClientMessageEvent *) &event);
- break;
+
default:
default:
+ HandleOtherEvents(&event);
break;
}
}
break;
}
}
- else if (JoystickButton() == JOY_BUTTON_NEW_PRESSED)
+ else if (
Any
JoystickButton() == JOY_BUTTON_NEW_PRESSED)
{
{
- int joy
=
Joystick();
+ int joy
= Any
Joystick();
if (joy & JOY_BUTTON_1)
result = 1;
if (joy & JOY_BUTTON_1)
result = 1;
@@
-1678,6
+1677,9
@@
unsigned int MoveDoor(unsigned int door_state)
}
}
}
}
+ if (setup.quick_doors)
+ StopSound(SND_OEFFNEN);
+
if (door_state & DOOR_ACTION_1)
door1 = door_state & DOOR_ACTION_1;
if (door_state & DOOR_ACTION_2)
if (door_state & DOOR_ACTION_1)
door1 = door_state & DOOR_ACTION_1;
if (door_state & DOOR_ACTION_2)