projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-19980917
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index af4a4c5690f17aa8878fda42b2f556e10348567e..73d681d72efa38f7f274741b390aade98a81c311 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-70,10
+70,13
@@
void EventLoop(void)
has its own synchronization and is CPU friendly, too */
if (game_status != PLAYING)
has its own synchronization and is CPU friendly, too */
if (game_status != PLAYING)
- Delay(1000);
+ {
+ XSync(display, FALSE);
+ Delay(10);
+ }
}
}
- if (game_status
==
EXITGAME)
+ if (game_status
==
EXITGAME)
return;
}
}
return;
}
}
@@
-173,10
+176,17
@@
void HandleExposeEvent(XExposeEvent *event)
SetDrawtoField(DRAW_DIRECT);
}
SetDrawtoField(DRAW_DIRECT);
}
- if (soft_scrolling_on && game_status==PLAYING)
+ if (soft_scrolling_on && game_status == PLAYING)
+ {
+ int fx = FX, fy = FY;
+
+ fx += (PlayerMovDir & (MV_LEFT|MV_RIGHT) ? ScreenMovPos : 0);
+ fy += (PlayerMovDir & (MV_UP|MV_DOWN) ? ScreenMovPos : 0);
+
XCopyArea(display,fieldbuffer,backbuffer,gc,
XCopyArea(display,fieldbuffer,backbuffer,gc,
-
FX,FY
, SXSIZE,SYSIZE,
+
fx,fy
, SXSIZE,SYSIZE,
SX,SY);
SX,SY);
+ }
XCopyArea(display,drawto,window,gc, x,y, width,height, x,y);
XCopyArea(display,drawto,window,gc, x,y, width,height, x,y);
@@
-288,9
+298,6
@@
void HandleButton(int mx, int my, int button)
}
}
}
}
-int GameSpeed = 2;
-int MoveSpeed = 8;
-
void HandleKey(KeySym key, int key_status)
{
int joy = 0;
void HandleKey(KeySym key, int key_status)
{
int joy = 0;
@@
-585,15
+592,15
@@
void HandleKey(KeySym key, int key_status)
}
else
{
}
else
{
- Delay(1
000
);
+ Delay(1);
}
}
/*
}
}
/*
- Delay(160
000
/ num_steps);
+ Delay(160 / num_steps);
*/
/*
*/
/*
- Delay(120
000
/ num_steps);
+ Delay(120 / num_steps);
*/
}
}
*/
}
}
@@
-612,7
+619,7
@@
void HandleKey(KeySym key, int key_status)
0,0);
XFlush(display);
XSync(display,FALSE);
0,0);
XFlush(display);
XSync(display,FALSE);
- Delay(1000
000
);
+ Delay(1000);
}
break;
}
break;
@@
-700,6
+707,7
@@
void HandleJoystick()
break;
case PLAYING:
{
break;
case PLAYING:
{
+ static int player_frame_reset_delay = 0;
BOOL moved = FALSE, snapped = FALSE, bombed = FALSE;
if (GameOver && newbutton)
BOOL moved = FALSE, snapped = FALSE, bombed = FALSE;
if (GameOver && newbutton)
@@
-715,6
+723,8
@@
void HandleJoystick()
if (joy)
{
if (joy)
{
+ player_frame_reset_delay = 0;
+
if (button1)
snapped = SnapField(dx,dy);
else
if (button1)
snapped = SnapField(dx,dy);
else
@@
-737,7
+747,8
@@
void HandleJoystick()
{
DigField(0,0,0,0,DF_NO_PUSH);
SnapField(0,0);
{
DigField(0,0,0,0,DF_NO_PUSH);
SnapField(0,0);
- PlayerFrame = 0;
+ if (++player_frame_reset_delay > MoveSpeed)
+ PlayerFrame = 0;
}
if (tape.playing && !tape.pausing && !joy && tape.counter<tape.length)
}
if (tape.playing && !tape.pausing && !joy && tape.counter<tape.length)