File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 3
3
#include < time.h>
4
4
#include < stdio.h>
5
5
#include < string.h>
6
+ #include < stdlib.h>
6
7
#include " data.h"
7
8
8
9
#define for if (false ) {} else for
16
17
#define MAX_ITEM_CARRY 6
17
18
#define TILESIZE 32
18
19
20
+ #define SLEEPTIME 50
21
+
19
22
#define UP 0
20
23
#define DOWN 1
21
24
#define LEFT 2
98
101
#define FAIRY1 512
99
102
#define FAIRY2 1024
100
103
104
+ DWORD LastSystemTime = 0 ;
105
+ DWORD CurrentDelay = 0 ;
106
+
101
107
typedef struct ITEM
102
108
{
103
109
char name[20 ];
@@ -2307,6 +2313,8 @@ int main()
2307
2313
{
2308
2314
drawAll ();
2309
2315
2316
+ LastSystemTime = GetTickCount ();
2317
+
2310
2318
if (key[KEY_LEFT])
2311
2319
{
2312
2320
if (player.x <=0 && room[player.rm -1 ].exits [3 ]!=0 )
@@ -2400,6 +2408,9 @@ int main()
2400
2408
}
2401
2409
2402
2410
if (gameover) done=true ;
2411
+
2412
+ CurrentDelay = GetTickCount () - LastSystemTime;
2413
+ if (CurrentDelay < SLEEPTIME) Sleep (SLEEPTIME - CurrentDelay);
2403
2414
}
2404
2415
2405
2416
if (gameover)
You can’t perform that action at this time.
0 commit comments