TOOLPREFIX = i586-pc-msdosdjgpp-
endif
-inc = -Isrc -Isrc/scr -Isrc/dos -Ilibs -Ilibs/imago/src -Ilibs/anim/src -Ilibs/mikmod/include
+inc = -Isrc -Isrc/scr -Isrc/dos -Ilibs -Ilibs/imago/src -Ilibs/anim/src
opt = -O3 -ffast-math -fno-strict-aliasing
dbg = -g
#prof = -pg
warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable
+def = -DNO_MUSIC
CC = $(TOOLPREFIX)gcc
AR = $(TOOLPREFIX)ar
-CFLAGS = $(warn) -march=pentium $(dbg) $(opt) $(prof) $(inc)
-LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja libs/mikmod/dos/libmikmod.a
+CFLAGS = $(warn) -march=pentium $(dbg) $(opt) $(prof) $(inc) $(def)
+LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja
ifneq ($(hostsys), dos)
.PHONY: all
all: data $(bin)
endif
-$(bin): $(obj) imago anim mikmod
+$(bin): $(obj) imago anim
$(CC) -o $@ -Wl,-Map=ld.map $(prof) $(obj) $(LDFLAGS)
%.cof: %.asm
anim:
$(MAKE) -C libs/anim -f Makefile.dj
-.PHONY: mikmod
-mikmod:
- $(MAKE) -C libs/mikmod/dos -f Makefile.dj
-
.PHONY: cleanlibs
cleanlibs:
$(MAKE) -C libs/imago -f Makefile.dj clean
$(MAKE) -C libs/anim -f Makefile.dj clean
- $(MAKE) -C libs/mikmod/dos -f Makefile.dj clean
.PHONY: clean
.PHONY: cleandep
float root;
if(trace > 0.0f) {
- // |w| > 1/2
- root = sqrt(trace + 1.0f); // 2w
+ /* |w| > 1/2 */
+ root = sqrt(trace + 1.0f); /* 2w */
res->w = 0.5f * root;
- root = 0.5f / root; // 1 / 4w
+ root = 0.5f / root; /* 1 / 4w */
res->x = (m[6] - m[9]) * root;
res->y = (m[8] - m[2]) * root;
res->z = (m[1] - m[4]) * root;
} else {
- // |w| <= 1/2
+ /* |w| <= 1/2 */
i = 0;
if(m[5] > m[0]) {
i = 1;
return tex;
}
+#if (defined(__DOS__) || defined(__MSDOS__)) && defined(__unix__)
+#undef __unix__
+#endif
+
#if defined(__unix__) || defined(__APPLE__)
#ifndef __USE_GNU
#define __USE_GNU
#ifndef INT_TYPES_H_
#define INT_TYPES_H_
-#if defined(__DOS__) || defined(WIN32)
+#if defined(__DOS__) || defined(__MSDOS__) || defined(WIN32)
typedef char int8_t;
typedef short int16_t;
typedef long int32_t;
};
static void imm_flush(void);
-static void xform4_vec3(const float *mat, float *vec);
-static void xform3_vec3(const float *mat, float *vec);
+static __inline void xform4_vec3(const float *mat, float *vec);
+static __inline void xform3_vec3(const float *mat, float *vec);
static void shade(struct g3d_vertex *v);
static struct g3d_state *st;
st->imm_curv.v = v;
}
-static void xform4_vec3(const float *mat, float *vec)
+static __inline void xform4_vec3(const float *mat, float *vec)
{
float x = mat[0] * vec[0] + mat[4] * vec[1] + mat[8] * vec[2] + mat[12];
float y = mat[1] * vec[0] + mat[5] * vec[1] + mat[9] * vec[2] + mat[13];
float z = mat[2] * vec[0] + mat[6] * vec[1] + mat[10] * vec[2] + mat[14];
- float w = mat[3] * vec[0] + mat[7] * vec[1] + mat[11] * vec[2] + mat[15];
-
- vec[0] = x;
- vec[1] = y;
+ vec[3] = mat[3] * vec[0] + mat[7] * vec[1] + mat[11] * vec[2] + mat[15];
vec[2] = z;
- vec[3] = w;
+ vec[1] = y;
+ vec[0] = x;
}
-static void xform3_vec3(const float *mat, float *vec)
+static __inline void xform3_vec3(const float *mat, float *vec)
{
float x = mat[0] * vec[0] + mat[4] * vec[1] + mat[8] * vec[2];
float y = mat[1] * vec[0] + mat[5] * vec[1] + mat[9] * vec[2];
- float z = mat[2] * vec[0] + mat[6] * vec[1] + mat[10] * vec[2];
-
- vec[0] = x;
+ vec[2] = mat[2] * vec[0] + mat[6] * vec[1] + mat[10] * vec[2];
vec[1] = y;
- vec[2] = z;
+ vec[0] = x;
}
#define NORMALIZE(v) \
}
}
- //printf("choose_poly(..., %d) -> %d splits\n", num_polys, best_splits);
+ /*printf("choose_poly(..., %d) -> %d splits\n", num_polys, best_splits);*/
return best;
}
enum {
FLIP_NOW,
- FLIP_VBLANK,
+ FLIP_VBLANK
};
/* page flip and return pointer to the start of the display area (front buffer) */
void *page_flip(int vsync);
#ifndef INT_TYPES_H_
#define INT_TYPES_H_
-#if defined(__WATCOMC__) && __WATCOMC__ < 0x1200
+/*#if defined(__WATCOMC__) && __WATCOMC__ < 0x1200*/
+#if defined(__DOS__) || defined(__MSDOS__)
typedef char int8_t;
typedef short int16_t;
typedef long int32_t;
#include <i86.h>
#endif
#ifdef __DJGPP__
-#include <stdint.h>
#include <dpmi.h>
#include <go32.h>
#include <pc.h>
#include "keyb.h"
#include "scancode.h"
+#include "inttypes.h"
#define KB_INTR 0x9
#define KB_PORT 0x60
#endif
#ifdef __DJGPP__
-#include <stdint.h>
#include <dpmi.h>
#include <go32.h>
#include <pc.h>
#endif
#include "sball.h"
+#include "inttypes.h"
struct motion {
int x, y, z;
#endif
#ifdef __DJGPP__
-#include <stdint.h>
#include <dpmi.h>
#include <go32.h>
#include <pc.h>
#endif
#include "pit8254.h"
+#include "inttypes.h"
#define PIT_TIMER_INTR 8
#define DOS_TIMER_INTR 0x1c
VBE_ATTR_STEREO = 0x0800,
VBE_ATTR_STEREO_2FB = 0x1000,
/* VBE/AF */
- VBE_ATTR_MUSTLOCK = 0x0200, /* ! */
+ VBE_ATTR_MUSTLOCK = 0x0200 /* ! */
};
/* VBE memory model type (vbe_mode_info.mem_model) */
uint32_t res, tmp;
if(winding < 0) {
- // clockwise
+ /* clockwise */
edge = y0 > y1 ? left : right;
} else {
- // counter-clockwise
+ /* counter-clockwise */
edge = y0 > y1 ? right : left;
}
res = SCANEDGE(pv + i, pv + next, edge);
-// Bump effect (not moving yet of course, I have many ideas on this to commit before it's ready)
+/* Bump effect (not moving yet of course, I have many ideas on this to commit before it's ready) */
#include <stdio.h>
#include <stdlib.h>
const int particleLightSize = PARTICLE_LIGHT_WIDTH * PARTICLE_LIGHT_HEIGHT;
const int fb_size = fb_width * fb_height;
- // Just some parameters to temporary test the colors of 3 lights
- // if every light uses it's own channel bits, it's better
+ /* Just some parameters to temporary test the colors of 3 lights
+ * if every light uses it's own channel bits, it's better
+ */
const float rgbMul[9] = { 1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f};
memset(bumpOffset, 0, sizeof(*bumpOffset) * fb_size);
memset(particlePoint, 0, sizeof(*particlePoint) * NUM_PARTICLES);
- // Create random junk
+ /* Create random junk */
for (i = 0; i < fb_size; i++)
heightmap[i] = rand() & 255;
- // Blur to smooth
+ /* Blur to smooth */
for (j = 0; j < numBlurs; j++)
for (i = 0; i < fb_size; i++)
heightmap[i] = (heightmap[abs((i - 1) % fb_size)] + heightmap[abs((i + 1) % fb_size)] + heightmap[abs((i - fb_width) % fb_size)] + heightmap[abs((i + fb_width) % fb_size)]) >> 2;
- // Inclination precalculation
+ /* Inclination precalculation */
i = 0;
for (y = 0; y < fb_height; y++)
{
}
}
- // Generate three lights
+ /* Generate three lights */
i = 0;
for (y = 0; y < BIG_LIGHT_HEIGHT; y++)
{
{
memset(lightmap, 0, fb_width * fb_height * sizeof(*lightmap));
- //eraseLights();
+ /*eraseLights();*/
animateLights();
renderLights();
#define NSPAWNPOS 64
#define SPAWN_RATE 16.0f
-//#define GRAV (-6.0f)
+/*#define GRAV (-6.0f)*/
#define GRAV 0.0f
#define HAIR_LENGTH 20
-// Just a test with a run of the mill plasma
+/* Just a test with a run of the mill plasma */
#include <stdlib.h>
#include <math.h>
static int init(void);
static void destroy(void);
static void start(long trans_time);
-static void stop(long trans_time);
static void draw(void);
static unsigned int lastFrameTime = 0;
ret.y = rand() % 200 - 100; if (ret.y == 0) ret.y = 1;
ret.z = rand() % 200 - 100; if (ret.z == 0) ret.z = 1;
- // Normalize
+ /* Normalize */
l = sqrt(ret.x * ret.x + ret.y * ret.y + ret.z * ret.z);
ret.x /= l;
ret.y /= l;
#include "tinyfps.h"
#include "demo.h"
-// TinyFPS, just a minimal fraps like font to show FPS during the demo and not just after.
-// I'll be using it in my effects for my performance test purposes, just adding it here.
-// Maybe it would be nice if initFpsFonts would be called in demo.c once but I avoided touching that code.
+/* TinyFPS, just a minimal fraps like font to show FPS during the demo and not just after.
+ * I'll be using it in my effects for my performance test purposes, just adding it here.
+ * Maybe it would be nice if initFpsFonts would be called in demo.c once but I avoided touching that code.
+ */
/*
1110 0010 1110 1110 1010 1110 1110 1110 1110 1110
startingFpsTime = time_msec;
nFrames = 0;
}
- //drawDecimal(fps, 4, 4, 2, vram);
- // Moving this on the lower left side of screen for now, since the lack of double buffering generates flickering for this atm
+ /*drawDecimal(fps, 4, 4, 2, vram);*/
+ /* Moving this on the lower left side of screen for now, since the lack of double buffering generates flickering for this atm */
drawDecimal(fps, 4, fb_height - 12, 2, vram);
}
DYNARR_CLEAR(pst->token);
- // skip whitespace
+ /* skip whitespace */
while((c = fgetc(pst->fp)) != -1) {
- if(c == '#') { // skip to end of line
+ if(c == '#') { /* skip to end of line */
while((c = fgetc(pst->fp)) != -1 && c != '\n');
if(c == -1) return -1;
}
DYNARR_STRPUSH(pst->token, c);
if(isdigit(c) || c == '-' || c == '+') {
- // token is a number
+ /* token is a number */
int found_dot = 0;
while((c = fgetc(pst->fp)) != -1 &&
(isdigit(c) || (c == '.' && !found_dot))) {
return TOK_NUM;
}
if(isalpha(c)) {
- // token is an identifier
+ /* token is an identifier */
while((c = fgetc(pst->fp)) != -1 && (isalnum(c) || c == '_')) {
DYNARR_STRPUSH(pst->token, c);
}
return TOK_ID;
}
if(c == '"') {
- // token is a string constant
- // remove the opening quote
+ /* token is a string constant */
+ /* remove the opening quote */
DYNARR_STRPOP(pst->token);
while((c = fgetc(pst->fp)) != -1 && c != '"') {
DYNARR_STRPUSH(pst->token, c);
--- /dev/null
+#!/bin/sh
+
+# NOTES:
+# source: svn co https://svn.code.sf.net/p/etherdfs/code
+#
+# on DOS: etherdfs <server MAC addr> C-Z
+# on GNU/Linux: sudo ethersrv-linux eth0 /etherdfs
+#
+# /etherdfs is a mount point for a FAT16 image, fstab entry:
+# /home/nuclear/code/dos/etherdfs.img /etherdfs msdos loop,fmask=0113,dmask=0002,gid=6 0 0
+
+destdir=/etherdfs/dosdemo
+rev=false
+have_dest_arg=false
+
+for arg in "$@"; do
+ case "$arg" in
+ -r)
+ rev=true
+ ;;
+
+ -*)
+ echo "invalid option: $arg"
+ exit 1
+ ;;
+
+ *)
+ if $have_dest_arg; then
+ echo "unexpected argument: $arg"
+ exit 1
+ fi
+ destdir=$arg
+ have_dest_arg=true
+ ;;
+ esac
+done
+
+if $rev; then
+ cwd=`pwd`
+ cd $destdir
+ destdir=$cwd
+else
+ mkdir -p $destdir/data
+ cp demo.exe $destdir
+ rm -f $destdir/data/*
+ cp data/* $destdir/data/
+fi
+
+findsrc()
+{
+ find . -name '*.c' -o -name '*.h' -o -name '*.asm' -o -name '*.inc' \
+ -o -name '*.inl' -o -name Makefile.dj | sed 's/\.\///'
+}
+for i in `findsrc`; do
+ dir=`dirname $i`
+ mkdir -p $destdir/$dir
+ cp $i $destdir/$i
+done