main, tobmp, and sdl compile on Windows now. Added if check for windows to use old random functions. Need to debug some Windows bugs (probably stemming from bad memory access).
parent
df41a1d911
commit
8f5ee89e81
5
Makefile
5
Makefile
|
@ -6,10 +6,13 @@ VPATH = src
|
|||
CFLAGS = -Wall -Isrc/ -g -c
|
||||
LFLAGS = -Wall
|
||||
|
||||
SDL_INCLUDE = -I/usr/include
|
||||
SDL_OBJS = sdl_main.o ktkMap.o ktkStructure.o ktkProgram.o ktk_parse.o
|
||||
|
||||
SYS := $(shell uname)
|
||||
ifeq ($(OS),Windows_NT)
|
||||
CFLAGS += $(SDL_INCLUDE)
|
||||
SDL_LFLAGS += -lmingw32 -lSDLmain
|
||||
SDL_LFLAGS += -lSDL
|
||||
else ifeq ($(SYS),Darwin)
|
||||
SDL_OBJS += SDLMain.o
|
||||
|
@ -24,7 +27,7 @@ $(BINARY): $(patsubst %,$(OBJ_DIR)/%,$(OBJS))
|
|||
$(CC) $(LFLAGS) $^ -o $@
|
||||
|
||||
sdl: $(patsubst %,$(OBJ_DIR)/%,$(SDL_OBJS))
|
||||
$(CC) $(LFLAGS) $(SDL_LFLAGS) $^ -o $@
|
||||
$(CC) -o $@ $^ $(LFLAGS) $(SDL_LFLAGS)
|
||||
|
||||
tools: tools/tobmp
|
||||
$(MAKE) -C tools
|
||||
|
|
|
@ -19,6 +19,8 @@ At the moment, not much is the haps.
|
|||
X - link structures
|
||||
Q - quit
|
||||
|
||||
NOTE: for building on win32, you will need to copy SDL.dll (1.2) to the same directory as the Makefile before compiling.
|
||||
|
||||
Current structures:
|
||||
|
||||
castle.txt
|
||||
|
|
|
@ -8,7 +8,11 @@ unsigned long ktk_RANDOM_SEED = 1;
|
|||
|
||||
unsigned long ktk_randomizeSeed() {
|
||||
ktk_RANDOM_SEED = (unsigned long)time(0);
|
||||
#if _WIN32 | _WIN64
|
||||
srand(ktk_RANDOM_SEED);
|
||||
#else
|
||||
srandom(ktk_RANDOM_SEED);
|
||||
#endif
|
||||
return ktk_RANDOM_SEED;
|
||||
}
|
||||
|
||||
|
@ -26,7 +30,11 @@ int ktk_getRandom(int min, int max) {
|
|||
}
|
||||
int buckets = RAND_MAX / range;
|
||||
int limit = buckets * range;
|
||||
#if _WIN32 | _WIN64
|
||||
for (num = rand(); num >= limit; num = rand());
|
||||
#else
|
||||
for (num = random(); num >= limit; num = random());
|
||||
#endif
|
||||
return min + (num / buckets);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue