projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-19980828
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index 69b67685b87b95f7503fdd6a75843f12fc531076..4fecf14437dd6b978217d74840d7f6fcc37734d0 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-61,7
+61,7
@@
void EventLoop(void)
else /* got no event, but don't be lazy... */
{
HandleNoXEvent();
else /* got no event, but don't be lazy... */
{
HandleNoXEvent();
- Delay(1000
0);
/* don't use all CPU time when idle */
+ Delay(1000
);
/* don't use all CPU time when idle */
}
XSync(display,FALSE);
}
XSync(display,FALSE);
@@
-149,7
+149,7
@@
void HandleExposeEvent(XExposeEvent *event)
int x1 = (x-SX)/TILEX, y1 = (y-SY)/TILEY;
int x2 = (x-SX+width)/TILEX, y2 = (y-SY+height)/TILEY;
int x1 = (x-SX)/TILEX, y1 = (y-SY)/TILEY;
int x2 = (x-SX+width)/TILEX, y2 = (y-SY+height)/TILEY;
-
drawto_field = backbuffer
;
+
SetDrawtoField(DRAW_BACKBUFFER)
;
for(xx=0;xx<SCR_FIELDX;xx++)
for(yy=0;yy<SCR_FIELDY;yy++)
for(xx=0;xx<SCR_FIELDX;xx++)
for(yy=0;yy<SCR_FIELDY;yy++)
@@
-157,9
+157,14
@@
void HandleExposeEvent(XExposeEvent *event)
DrawScreenField(xx,yy);
DrawPlayerField();
DrawScreenField(xx,yy);
DrawPlayerField();
-
drawto_field = window
;
+
SetDrawtoField(DRAW_DIRECT)
;
}
}
+ if (soft_scrolling_on && game_status==PLAYING)
+ XCopyArea(display,fieldbuffer,backbuffer,gc,
+ FX,FY, SXSIZE,SYSIZE,
+ SX,SY);
+
XCopyArea(display,drawto,window,gc, x,y, width,height, x,y);
XFlush(display);
XCopyArea(display,drawto,window,gc, x,y, width,height, x,y);
XFlush(display);
@@
-202,6
+207,7
@@
void HandleFocusEvent(XFocusChangeEvent *event)
XAutoRepeatOn(display);
old_joystick_status = joystick_status;
joystick_status = JOYSTICK_OFF;
XAutoRepeatOn(display);
old_joystick_status = joystick_status;
joystick_status = JOYSTICK_OFF;
+ key_joystick_mapping = 0;
}
else if (event->type == FocusIn)
{
}
else if (event->type == FocusIn)
{
@@
-262,10
+268,8
@@
void HandleButton(int mx, int my, int button)
}
}
}
}
-int Gamespeed = 4;
-int Movemethod = 0;
-int Movespeed[2] = { 10, 3 };
-char *Movespeed_text[2] = { "asynchron", "syncron" };
+int GameSpeed = 2;
+int MoveSpeed = 8;
void HandleKey(KeySym key, int key_status)
{
void HandleKey(KeySym key, int key_status)
{
@@
-361,6
+365,8
@@
void HandleKey(KeySym key, int key_status)
case XK_Control_R:
case XK_Alt_R:
case XK_Meta_R:
case XK_Control_R:
case XK_Alt_R:
case XK_Meta_R:
+ case XK_Mode_switch:
+ case XK_Multi_key:
case XK_B: /* (Bombe legen) */
case XK_b:
joy |= JOY_BUTTON_2;
case XK_B: /* (Bombe legen) */
case XK_b:
joy |= JOY_BUTTON_2;
@@
-377,11
+383,11
@@
void HandleKey(KeySym key, int key_status)
key_joystick_mapping &= ~joy;
HandleJoystick();
key_joystick_mapping &= ~joy;
HandleJoystick();
-
- if (game_status != PLAYING)
- key_joystick_mapping = 0;
}
}
+ if (game_status != PLAYING)
+ key_joystick_mapping = 0;
+
if (key_status == KEY_RELEASED)
return;
if (key_status == KEY_RELEASED)
return;
@@
-462,52
+468,53
@@
void HandleKey(KeySym key, int key_status)
case XK_7:
case XK_8:
case XK_9:
case XK_7:
case XK_8:
case XK_9:
- Movespeed[Movemethod] = (Movemethod == 0 ? 4 : 0) + (key - XK_0);
- printf("method == %d, speed == %d (%s)\n",
- Movemethod, Movespeed[Movemethod],
- Movespeed_text[Movemethod]);
+ if (key == XK_0)
+ GameSpeed = 50;
+ else
+ GameSpeed = key - XK_0;
+ printf("GameSpeed == %d\n", GameSpeed);
break;
case XK_a:
break;
case XK_a:
- Movemethod = !Movemethod;
- printf("method == %d, speed == %d (%s)\n",
- Movemethod, Movespeed[Movemethod],
- Movespeed_text[Movemethod]);
+ if (ScrollStepSize == TILEX/8)
+ ScrollStepSize = TILEX/4;
+ else
+ ScrollStepSize = TILEX/8;
+ printf("ScrollStepSize == %d\n", ScrollStepSize);
break;
case XK_f:
break;
case XK_f:
-
Gamespeed = 2
;
- printf("
gamespeed == %d\n", Gamespeed
);
+
ScrollStepSize = TILEX/8
;
+ printf("
ScrollStepSize == %d (1/8)\n", ScrollStepSize
);
break;
case XK_g:
break;
case XK_g:
-
Gamespeed = 3
;
- printf("
gamespeed == %d\n", Gamespeed
);
+
ScrollStepSize = TILEX/4
;
+ printf("
ScrollStepSize == %d (1/4)\n", ScrollStepSize
);
break;
case XK_h:
break;
case XK_h:
-
Gamespeed = 4
;
- printf("
gamespeed == %d\n", Gamespeed
);
+
ScrollStepSize = TILEX/2
;
+ printf("
ScrollStepSize == %d (1/2)\n", ScrollStepSize
);
break;
case XK_l:
break;
case XK_l:
-
Gamespeed = 10
;
- printf("
gamespeed == %d\n", Gamespeed
);
+
ScrollStepSize = TILEX
;
+ printf("
ScrollStepSize == %d (1/1)\n", ScrollStepSize
);
break;
case XK_Q:
case XK_q:
Dynamite = 1000;
break;
break;
case XK_Q:
case XK_q:
Dynamite = 1000;
break;
-#endif
case XK_x:
{
case XK_x:
{
- int i,j,k, num_steps =
16
, step_size = TILEX / num_steps;
+ int i,j,k, num_steps =
8
, step_size = TILEX / num_steps;
static long scroll_delay=0;
long scroll_delay_value = 4*4 / num_steps;
printf("Scroll test\n");
static long scroll_delay=0;
long scroll_delay_value = 4*4 / num_steps;
printf("Scroll test\n");
- for(i=0;i<
10
;i++)
+ for(i=0;i<
3
;i++)
{
for(j=0;j<SCR_FIELDX;j++)
{
{
for(j=0;j<SCR_FIELDX;j++)
{
@@
-520,11
+527,11
@@
void HandleKey(KeySym key, int key_status)
{
if (DelayReached(&scroll_delay, scroll_delay_value))
{
{
if (DelayReached(&scroll_delay, scroll_delay_value))
{
- XCopyArea(display,
back
buffer,window,gc,
+ XCopyArea(display,
field
buffer,window,gc,
SX+xxx,SY,
SXSIZE-xxx,SYSIZE,
SX,SY);
SX+xxx,SY,
SXSIZE-xxx,SYSIZE,
SX,SY);
- XCopyArea(display,
back
buffer,window,gc,
+ XCopyArea(display,
field
buffer,window,gc,
SX,SY,
xxx,SYSIZE,
SX+SXSIZE-xxx,SY);
SX,SY,
xxx,SYSIZE,
SX+SXSIZE-xxx,SY);
@@
-553,6
+560,22
@@
void HandleKey(KeySym key, int key_status)
break;
break;
+ case XK_y:
+ {
+ printf("FX = %d, FY = %d\n", FX,FY);
+
+ XCopyArea(display,fieldbuffer,window,gc,
+ 0,0,
+ MIN(WIN_XSIZE,FXSIZE),MIN(WIN_YSIZE,FYSIZE),
+ 0,0);
+ XFlush(display);
+ XSync(display,FALSE);
+ Delay(1000000);
+ }
+
+ break;
+#endif
+
default:
break;
}
default:
break;
}
@@
-565,7
+588,7
@@
void HandleKey(KeySym key, int key_status)
void HandleNoXEvent()
{
void HandleNoXEvent()
{
- if (button_status && game_status
!=
PLAYING)
+ if (button_status && game_status
!=
PLAYING)
{
HandleButton(-1,-1,button_status);
return;
{
HandleButton(-1,-1,button_status);
return;
@@
-645,13
+668,6
@@
void HandleJoystick()
return;
}
return;
}
-
-
- if (PlayerMovPos)
- ScrollFigure(0);
-
-
-
if (tape.pausing || PlayerGone)
joy = 0;
if (tape.pausing || PlayerGone)
joy = 0;
@@
-705,9
+721,6
@@
void HandleJoystick()
}
}
}
}
}
}
-
- DrawPlayerField();
-
break;
}
default:
break;
}
default: