misc changes

This commit is contained in:
Steven Fuller 2002-09-07 00:26:23 +00:00 committed by Patryk Obara
parent e681d155d9
commit 553fa56442
9 changed files with 86 additions and 100 deletions

View file

@ -9,15 +9,12 @@ CFLAGS = -g -Wall -pipe -O2
#CFLAGS = -DNDEBUG -Wall -pipe -O6 -ffast-math -fomit-frame-pointer -march=pentiumpro -mcpu=pentiumpro #CFLAGS = -DNDEBUG -Wall -pipe -O6 -ffast-math -fomit-frame-pointer -march=pentiumpro -mcpu=pentiumpro
CFLAGS += -Dengine=1 -I. -Iinclude -Iwin95 -Iavp -Iavp/win95 -Iavp/support -Iavp/win95/frontend -Iavp/win95/gadgets CFLAGS += -Dengine=1 -I. -Iinclude -Iwin95 -Iavp -Iavp/win95 -Iavp/support -Iavp/win95/frontend -Iavp/win95/gadgets
CFLAGS += $(shell sdl-config --cflags)
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
CFLAGS += $(shell sdl-config --cflags)
LDLIBS = $(shell sdl-config --libs) -lGL -lopenal LDLIBS = $(shell sdl-config --libs) -lGL -lopenal
# Debian SDL+NVIDIA workaround (change /usr/lib to the real location of the files) # required for gcc-3
#LDLIBS = -L/usr/X11R6/lib -lX11 -lXext /usr/lib/libGL.so.1 $(shell sdl-config --libs) -lopenal -lm
# required for gcc-3.0
#LDLIBS += -lstdc++ #LDLIBS += -lstdc++
AFLAGS = -g -w+macro-params -w+orphan-labels -w+number-overflow AFLAGS = -g -w+macro-params -w+orphan-labels -w+number-overflow
@ -61,7 +58,7 @@ OBJ = $(ROOTOBJ) $(AVPOBJ) $(SHAPESOBJ) $(SUPPORTOBJ) $(AVPWIN95OBJ) $(FRONTENDO
all: AvP all: AvP
AvP: depend $(OBJ) AvP: $(OBJ) # depend $(OBJ)
$(CC) -o AvP $(OBJ) $(LDLIBS) $(CC) -o AvP $(OBJ) $(LDLIBS)
compile: $(OBJ) compile: $(OBJ)
@ -69,9 +66,6 @@ compile: $(OBJ)
.asm.o: .asm.o:
$(NASM) $(AFLAGS) -f elf -o $@ $< $(NASM) $(AFLAGS) -f elf -o $@ $<
tester:
echo $(OBJ)
clean: clean:
-rm -rf depend depend.bak $(OBJ) AvP -rm -rf depend depend.bak $(OBJ) AvP
@ -81,14 +75,14 @@ distclean: clean
# I wish I knew how to do dependencies correctly... # I wish I knew how to do dependencies correctly...
#depend: Makefile $(SRC) #depend: Makefile $(SRC)
# $(CC) $(CFLAGS) -MM $(SRC) > depend # $(CC) $(CFLAGS) -MM $(SRC) > depend.out
#
# insert makefile dependencies here # insert makefile dependencies here
# -include depend # -include depend
#
depend: Makefile # $(SRC) #depend: Makefile # $(SRC)
touch depend # touch depend.out
makedepend -fdepend -- $(CFLAGS) -- $(SRC) # makedepend -fdepend.out -- $(CFLAGS) -- $(SRC)
#
-include depend #-include depend.out
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.

View file

@ -19,7 +19,6 @@
#include "showcmds.h" #include "showcmds.h"
#include "avp_userprofile.h" #include "avp_userprofile.h"
#include "cdplayer.h" #include "cdplayer.h"
#include "openal.h"
/* Patrick 5/6/97 ------------------------------------------------------------- /* Patrick 5/6/97 -------------------------------------------------------------
Internal globals Internal globals

View file

@ -209,7 +209,7 @@ extern ACTIVESOUNDSAMPLE ActiveSounds[];
extern SOUNDSAMPLEDATA BlankGameSound; extern SOUNDSAMPLEDATA BlankGameSound;
extern ACTIVESOUNDSAMPLE BlankActiveSound; extern ACTIVESOUNDSAMPLE BlankActiveSound;
void UpdateSoundFrequencies(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View file

@ -75,7 +75,12 @@ typedef struct RECT
typedef RECT RECT_AVP; typedef RECT RECT_AVP;
#if !defined(__INTEL_COMPILER)
typedef int64_t __int64; typedef int64_t __int64;
#else
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#endif
typedef time_t FILETIME; typedef time_t FILETIME;

View file

@ -41,16 +41,16 @@ void ADD_LL(LONGLONGCH *a, LONGLONGCH *b, LONGLONGCH *c)
mov [ebx+4],edx mov [ebx+4],edx
} }
*/ */
int dummy1, dummy2;
__asm__("movl 0(%%esi), %%eax \n\t" __asm__("movl 0(%%esi), %0 \n\t"
"movl 4(%%esi), %%edx \n\t" "movl 4(%%esi), %1 \n\t"
"addl 0(%%edi), %%eax \n\t" "addl 0(%%edi), %0 \n\t"
"adcl 4(%%edi), %%edx \n\t" "adcl 4(%%edi), %1 \n\t"
"movl %%eax, 0(%%ebx) \n\t" "movl %0, 0(%%ebx) \n\t"
"movl %%edx, 4(%%ebx) \n\t" "movl %1, 4(%%ebx) \n\t"
: : "=&r" (dummy1), "=&r" (dummy2)
: "S" (a), "D" (b), "b" (c) : "S" (a), "D" (b), "b" (c)
: "%eax", "%edx", "memory", "cc" : "memory", "cc"
); );
/* /*
@ -74,18 +74,19 @@ void ADD_LL_PP(LONGLONGCH *c, LONGLONGCH *a)
mov edi,c mov edi,c
mov esi,a mov esi,a
mov eax,[esi] mov eax,[esi]
mov edx,[esi+4] mov edx,[esi+4]
add [edi],eax add [edi],eax
adc [edi+4],edx adc [edi+4],edx
} }
*/ */
__asm__("movl 0(%%esi), %%eax \n\t" int dummy1, dummy2;
"movl 4(%%esi), %%edx \n\t" __asm__("movl 0(%%esi), %0 \n\t"
"addl %%eax, 0(%%edi) \n\t" "movl 4(%%esi), %1 \n\t"
"adcl %%edx, 4(%%edi) \n\t" "addl %0, 0(%%edi) \n\t"
: "adcl %1, 4(%%edi) \n\t"
: "=&r" (dummy1), "=&r" (dummy2)
: "D" (c), "S" (a) : "D" (c), "S" (a)
: "%eax", "%edx", "memory", "cc" : "memory", "cc"
); );
} }
@ -107,15 +108,16 @@ void SUB_LL(LONGLONGCH *a, LONGLONGCH *b, LONGLONGCH *c)
mov [ebx+4],edx mov [ebx+4],edx
} }
*/ */
__asm__("movl 0(%%esi), %%eax \n\t" int dummy1, dummy2;
"movl 4(%%esi), %%edx \n\t" __asm__("movl 0(%%esi), %0 \n\t"
"subl 0(%%edi), %%eax \n\t" "movl 4(%%esi), %1 \n\t"
"sbbl 4(%%edi), %%edx \n\t" "subl 0(%%edi), %0 \n\t"
"movl %%eax, 0(%%ebx) \n\t" "sbbl 4(%%edi), %1 \n\t"
"movl %%edx, 4(%%ebx) \n\t" "movl %0, 0(%%ebx) \n\t"
: "movl %1, 4(%%ebx) \n\t"
: "=&r" (dummy1), "=&r" (dummy2)
: "S" (a), "D" (b), "b" (c) : "S" (a), "D" (b), "b" (c)
: "%eax", "%edx", "memory", "cc" : "memory", "cc"
); );
} }
@ -134,13 +136,14 @@ void SUB_LL_MM(LONGLONGCH *c, LONGLONGCH *a)
sbb [edi+4],edx sbb [edi+4],edx
} }
*/ */
__asm__("movl 0(%%esi), %%eax \n\t" int dummy1, dummy2;
"movl 4(%%esi), %%edx \n\t" __asm__("movl 0(%%esi), %0 \n\t"
"subl %%eax, 0(%%edi) \n\t" "movl 4(%%esi), %1 \n\t"
"sbbl %%edx, 4(%%edi) \n\t" "subl %0, 0(%%edi) \n\t"
: "sbbl %1, 4(%%edi) \n\t"
: "=&r" (dummy1), "=&r" (dummy2)
: "D" (c), "S" (a) : "D" (c), "S" (a)
: "%eax", "%edx", "memory", "cc" : "memory", "cc"
); );
} }
@ -164,12 +167,13 @@ void MUL_I_WIDE(int a, int b, LONGLONGCH *c)
mov [ebx+4],edx mov [ebx+4],edx
} }
*/ */
__asm__("imull %%edx \n\t" unsigned int d1;
__asm__("imull %3 \n\t"
"movl %%eax, 0(%%ebx) \n\t" "movl %%eax, 0(%%ebx) \n\t"
"movl %%edx, 4(%%ebx) \n\t" "movl %%edx, 4(%%ebx) \n\t"
: : "=a" (d1)
: "a" (a), "b" (c), "d" (b) : "0" (a), "b" (c), "m" (b)
: "memory", "cc" : "%edx", "memory", "cc"
); );
} }
@ -315,15 +319,17 @@ void ASR_LL(LONGLONGCH *a, int shift)
asrdn: asrdn:
} }
*/ */
__asm__("andl %%eax, %%eax \n\t" unsigned int d1;
__asm__ volatile
("andl %0, %0 \n\t"
"jle 0 \n" /* asrdn */ "jle 0 \n" /* asrdn */
"1: \n\t" /* asrlp */ "1: \n\t" /* asrlp */
"sarl $1, 4(%%esi) \n\t" "sarl $1, 4(%%esi) \n\t"
"rcrl $1, 0(%%esi) \n\t" "rcrl $1, 0(%%esi) \n\t"
"decl %%eax \n\t" "decl %0 \n\t"
"jne 1 \n" "jne 1 \n"
"0: \n\t" "0: \n\t"
: : "=&r" (d1)
: "S" (a), "a" (shift) : "S" (a), "a" (shift)
: "memory", "cc" : "memory", "cc"
); );
@ -353,7 +359,6 @@ __asm__("movl 0(%%esi), %%eax \n\t"
: "S" (b), "D" (a) : "S" (b), "D" (a)
: "%eax", "%edx", "memory", "cc" : "%eax", "%edx", "memory", "cc"
); );
} }
/* /*
@ -394,11 +399,11 @@ int MUL_FIXED(int a, int b)
mov retval,eax mov retval,eax
} }
*/ */
__asm__("imull %%edx \n\t" __asm__("imull %2 \n\t"
"shrdl $16, %%edx, %%eax \n\t" "shrdl $16, %%edx, %%eax \n\t"
: "=a" (retval) : "=a" (retval)
: "a" (a), "d" (b) : "0" (a), "m" (b)
: "cc" : "%edx", "cc"
); );
return retval; return retval;
} }
@ -413,6 +418,8 @@ int DIV_FIXED(int a, int b)
{ {
int retval; int retval;
if (b == 0) printf("DEBUG THIS: a = %d, b = %d\n", a, b);
if (b == 0) return 0; /* TODO: debug this! (start with alien on ferarco) */ if (b == 0) return 0; /* TODO: debug this! (start with alien on ferarco) */
/* /*
_asm _asm
@ -430,9 +437,9 @@ __asm__("cdq \n\t"
"roll $16, %%eax \n\t" "roll $16, %%eax \n\t"
"mov %%ax, %%dx \n\t" "mov %%ax, %%dx \n\t"
"xor %%ax, %%ax \n\t" "xor %%ax, %%ax \n\t"
"idivl %%ebx \n\t" "idivl %2 \n\t"
: "=a" (retval) : "=a" (retval)
: "a" (a), "b" (b) : "0" (a), "m" (b)
: "%edx", "cc" : "%edx", "cc"
); );
return retval; return retval;
@ -476,9 +483,9 @@ int NarrowDivide(LONGLONGCH *a, int b)
*/ */
__asm__("movl 0(%%esi), %%eax \n\t" __asm__("movl 0(%%esi), %%eax \n\t"
"movl 4(%%esi), %%edx \n\t" "movl 4(%%esi), %%edx \n\t"
"idivl %%ebx \n\t" "idivl %2 \n\t"
: "=a" (retval) : "=a" (retval)
: "S" (a), "b" (b) : "S" (a), "m" (b)
: "%edx", "cc" : "%edx", "cc"
); );
return retval; return retval;
@ -504,10 +511,10 @@ int WideMulNarrowDiv(int a, int b, int c)
mov retval,eax mov retval,eax
} }
*/ */
__asm__("imull %%ebx \n\t" __asm__("imull %2 \n\t"
"idivl %%ecx \n\t" "idivl %3 \n\t"
: "=a" (retval) : "=a" (retval)
: "a" (a), "b" (b), "c" (c) : "0" (a), "m" (b), "m" (c)
: "%edx", "cc" : "%edx", "cc"
); );
return retval; return retval;
@ -567,13 +574,10 @@ typedef struct matrixch {
*/ */
extern int sqrt_temp1; extern volatile int sqrt_temp;
extern int sqrt_temp2;
int SqRoot32(int A) int SqRoot32(int A)
{ {
#if 1
sqrt_temp1 = A;
/* /*
_asm _asm
{ {
@ -585,28 +589,19 @@ int SqRoot32(int A)
} }
*/ */
__asm__("finit \n\t" __asm__ volatile
"fildl sqrt_temp1 \n\t" ("finit \n\t"
"fildl %0 \n\t"
"fsqrt \n\t" "fsqrt \n\t"
"fistpl sqrt_temp2 \n\t" "fistpl sqrt_temp \n\t"
"fwait \n\t" "fwait \n\t"
: :
: : "m" (A)
: "memory", "cc" : "memory", "cc"
); );
return sqrt_temp2; return sqrt_temp;
#else
{ /* TODO: clean this please */
double x = A;
double retvald = sqrt(x);
int retval = retvald;
return retval;
} }
#endif
}
/* /*
@ -615,13 +610,14 @@ __asm__("finit \n\t"
*/ */
extern float fti_fptmp; extern volatile float fti_fptmp;
extern int fti_itmp; extern volatile int fti_itmp;
void FloatToInt() void FloatToInt()
{ {
#if 1 #if 1
__asm__("fld fti_fptmp \n\t" __asm__ volatile
("flds fti_fptmp \n\t"
"fistpl fti_itmp \n\t" "fistpl fti_itmp \n\t"
: :
: :

View file

@ -21,7 +21,6 @@
#include "dynamics.h" #include "dynamics.h"
#include "dynblock.h" #include "dynblock.h"
#include "stratdef.h" #include "stratdef.h"
#include "openal.h"
ACTIVESOUNDSAMPLE ActiveSounds[SOUND_MAXACTIVE]; ACTIVESOUNDSAMPLE ActiveSounds[SOUND_MAXACTIVE];
ACTIVESOUNDSAMPLE BlankActiveSound = {SID_NOSOUND,ASP_Minimum,0,0,NULL,0,0,0,0,0, { {0,0,0},{0,0,0},0,0 }, 0, 0, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, NULL, NULL, NULL}; ACTIVESOUNDSAMPLE BlankActiveSound = {SID_NOSOUND,ASP_Minimum,0,0,NULL,0,0,0,0,0, { {0,0,0},{0,0,0},0,0 }, 0, 0, { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.0 }, NULL, NULL, NULL};

View file

@ -1,6 +0,0 @@
#ifndef OPENAL_AVP_H
#define OPENAL_AVP_H
void UpdateSoundFrequencies();
#endif

View file

@ -129,7 +129,7 @@ Chunk_With_BMPs::Chunk_With_BMPs (Chunk_With_Children * parent, const char * con
bdata += 4; bdata += 4;
for (int i=0; i<num; i++) for (int j=0; j<num; j++)
{ {
int f,i,d1,d2,d3; int f,i,d1,d2,d3;

View file

@ -18,8 +18,7 @@
#endif #endif
/* globals from inline.h */ /* globals from inline.h */
int sqrt_temp1; int sqrt_temp;
int sqrt_temp2;
float fti_fptmp; float fti_fptmp;
int fti_itmp; int fti_itmp;