bin = demo
inc = -I/usr/local/include -Isrc -Isrc/sdl -Ilibs/imago/src -Ilibs/mikmod/include
+warn = -pedantic -Wall -Wno-unused-variable -Wno-unused-function
-CFLAGS = -pedantic -Wall -g $(inc) `sdl-config --cflags`
+CFLAGS = $(warn) -g $(inc) `sdl-config --cflags`
LDFLAGS = -Llibs/imago -Llibs/mikmod -limago -lmikmod `sdl-config --libs` -lm
$(bin): $(obj) imago mikmod
endif
inc = -Isrc -Isrc/dos -Ilibs/imago/src -Ilibs/mikmod/include
-opt = -O3 -ffast-math
+opt = -O3 -ffast-math -fno-strict-aliasing
dbg = -g
+warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable
CC = $(TOOLPREFIX)gcc
AR = $(TOOLPREFIX)ar
-CFLAGS = -pedantic -Wall -march=pentium $(dbg) $(opt) $(inc)
+CFLAGS = $(warn) -march=pentium $(dbg) $(opt) $(inc)
LDFLAGS = libs/imago/imago.dja libs/mikmod/dos/libmikmod.a
$(bin): $(obj) imago mikmod
obj = $(src:.c=.o)
alib = libimago.a
-CFLAGS = -pedantic -Wall -Wno-main -g -Izlib -Ilibpng -Ijpeglib
+CFLAGS = -Wno-main -g -Izlib -Ilibpng -Ijpeglib
$(alib): $(obj)
$(AR) rcs $@ $(obj)
CC = $(TOOLPREFIX)gcc
AR = $(TOOLPREFIX)ar
-CFLAGS = -pedantic -Wall -Wno-main -march=pentium -g -O3 -ffast-math -Izlib -Ilibpng -Ijpeglib
+CFLAGS = -Wno-main -march=pentium -g -O3 -ffast-math -Izlib -Ilibpng -Ijpeglib
$(alib): $(obj)
$(AR) rcs $@ $(obj)
def = -DHAVE_CONFIG_H -DMIKMOD_BUILD
inc = -I. -Iinclude
-CFLAGS = -pedantic -Wall -g $(def) $(inc) `pkg-config --cflags sdl`
+warn = -pedantic -Wall -Wno-unused-variable -Wno-unused-function
+CFLAGS = $(warn) -g $(def) $(inc) `pkg-config --cflags sdl`
$(alib): $(obj)
$(AR) rcs $@ $(obj)
switch(key) {
case 27:
demo_quit();
- break;
+ return;
case 127:
debug_break();
- break;
+ return;
case '`':
console_active = !console_active;
} else {
putchar('\n');
}
- break;
+ return;
case '\b':
- if(console_active && wr != rd) {
- printf("\b \b");
- fflush(stdout);
- wr = (wr + CBUF_SIZE - 1) & CBUF_MASK;
+ if(console_active) {
+ if(wr != rd) {
+ printf("\b \b");
+ fflush(stdout);
+ wr = (wr + CBUF_SIZE - 1) & CBUF_MASK;
+ }
+ return;
}
break;
}
}
console_active = 0;
+ return;
}
break;
change_screen(9);
}
- if(console_active && key < 256 && isprint(key)) {
- putchar(key);
- fflush(stdout);
-
- cbuf[wr] = key;
- wr = (wr + 1) & CBUF_MASK;
- if(wr == rd) { /* overflow */
- rd = (rd + 1) & CBUF_MASK;
+ if(console_active) {
+ if(key < 256 && isprint(key)) {
+ putchar(key);
+ fflush(stdout);
+
+ cbuf[wr] = key;
+ wr = (wr + 1) & CBUF_MASK;
+ if(wr == rd) { /* overflow */
+ rd = (rd + 1) & CBUF_MASK;
+ }
}
+ return;
}
break;
}
+
+ scr_keypress(key);
}
}
int 0x31
}
}
+#else
+int stop_gcc_crying_about_empty_translation_units = 0;
#endif /* __WATCOM__ */
init,
destroy,
start, 0,
- draw
+ draw,
+ 0
};
static float cam_theta, cam_phi = 25;
if(cur) cur->draw();
}
+void scr_keypress(int key)
+{
+ if(cur && cur->keypress) {
+ cur->keypress(key);
+ }
+}
+
struct screen *scr_lookup(const char *name)
{
int i;
void (*stop)(long trans_time);
void (*draw)(void);
+
+ void (*keypress)(int key);
};
int scr_init(void);
void scr_update(void);
void scr_draw(void);
+void scr_keypress(int key);
struct screen *scr_lookup(const char *name);
struct screen *scr_screen(int idx);
#define CAMERA_DISTANCE 1.1f
-#define PI 3.14159f
-
/* TODO: Load palette from file */
static unsigned short palette[256];
tl = *src1;
tr = (*src1 + *(src1 + 1)) >> 1;
bl = (*src1 + *src2) >> 1;
- br = tr + ((*src2 + *(src2 + 1)) >> 1) >> 1;
+ br = (tr + ((*src2 + *(src2 + 1)) >> 1)) >> 1;
/* Pack 2 pixels in each 32 bit word */
*dst1 = (palette[tr] << 16) | palette[tl];
by.y = 1.0f;
by.z = 0.0f;
- bz.x = cos(yRot + PI/2.0f);
+ bz.x = cos(yRot + M_PI/2.0f);
bz.y = 0.0f;
- bz.z = sin(yRot + PI/2.0f);
+ bz.z = sin(yRot + M_PI/2.0f);
for (i = 0; i < VERTEX_COUNT; i++) {
MyVertex v1, v2;