Remove trailing whitespace from anything we don't need to rebase from an upstream.

git-svn-id: https://svn.eduke32.com/eduke32@5768 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-06-05 04:46:28 +00:00
parent 31606866f1
commit 0434a87e3a
70 changed files with 552 additions and 552 deletions

View file

@ -531,7 +531,7 @@ CWARNS = -W -Wall \
#-Wstrict-prototypes \ #-Wstrict-prototypes \
#-Waggregate-return \ #-Waggregate-return \
#-Wcast-align \ #-Wcast-align \
#-Waddress #-Waddress
ifneq (0,$(CLANG)) ifneq (0,$(CLANG))
CWARNS+= -Wno-unused-value -Wno-parentheses -Wno-unknown-warning-option CWARNS+= -Wno-unused-value -Wno-parentheses -Wno-unknown-warning-option

View file

@ -87,15 +87,15 @@ NOASM=1
CC=cl CC=cl
AS=ml AS=ml
LINK=link /nologo /opt:ref LINK=link /nologo /opt:ref
MT=mt MT=mt
CFLAGS= /MT /J /nologo $(flags_cl) \ CFLAGS= /MT /J /nologo $(flags_cl) \
/I$(DUKE3D_INC) /I$(ENGINE_INC)\msvc /I$(ENGINE_INC) /I$(MACT_ROOT) /I$(AUDIOLIB_ROOT)\include /I$(ENET_ROOT)\include \ /I$(DUKE3D_INC) /I$(ENGINE_INC)\msvc /I$(ENGINE_INC) /I$(MACT_ROOT) /I$(AUDIOLIB_ROOT)\include /I$(ENET_ROOT)\include \
/W2 $(ENGINEOPTS) \ /W2 $(ENGINEOPTS) \
/I$(PLATFORM)\include /I$(AUDIOINC)\include /DRENDERTYPE$(RENDERTYPE)=1 /DMIXERTYPE$(MIXERTYPE)=1 /DSDL_FRAMEWORK /DSDL_TARGET=2 /I$(PLATFORM)\include /I$(AUDIOINC)\include /DRENDERTYPE$(RENDERTYPE)=1 /DMIXERTYPE$(MIXERTYPE)=1 /DSDL_FRAMEWORK /DSDL_TARGET=2
ENET_CFLAGS=/I$(ENET_INC) /I$(ENET_SRC) ENET_CFLAGS=/I$(ENET_INC) /I$(ENET_SRC)
AUDIOLIB_CFLAGS=/I$(AUDIOLIB_INC) /I$(AUDIOLIB_SRC) AUDIOLIB_CFLAGS=/I$(AUDIOLIB_INC) /I$(AUDIOLIB_SRC)
LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib shlwapi.lib oleaut32.lib ole32.lib imm32.lib version.lib \ LIBS=user32.lib gdi32.lib shell32.lib winmm.lib ws2_32.lib comctl32.lib shlwapi.lib oleaut32.lib ole32.lib imm32.lib version.lib \
libogg.a libvorbis.a libvorbisfile.a libvpx.a libpng_mini.a libz_mini.a \ libogg.a libvorbis.a libvorbisfile.a libvpx.a libpng_mini.a libz_mini.a \
@ -189,7 +189,7 @@ MACT_OBJS=$(DUKE3D_OBJ)\file_lib.$o \
$(DUKE3D_OBJ)\mouse.$o \ $(DUKE3D_OBJ)\mouse.$o \
$(DUKE3D_OBJ)\joystick.$o \ $(DUKE3D_OBJ)\joystick.$o \
$(DUKE3D_OBJ)\scriplib.$o $(DUKE3D_OBJ)\scriplib.$o
DUKE3D_OBJS=$(DUKE3D_OBJ)\game.$o \ DUKE3D_OBJS=$(DUKE3D_OBJ)\game.$o \
$(DUKE3D_OBJ)\actors.$o \ $(DUKE3D_OBJ)\actors.$o \
$(DUKE3D_OBJ)\anim.$o \ $(DUKE3D_OBJ)\anim.$o \
@ -349,11 +349,11 @@ all: eduke32$(EXESUFFIX) mapster32$(EXESUFFIX)
eduke32$(EXESUFFIX): $(DUKE3D_OBJS) $(ENGINE_OBJS) $(AUDIOLIB_OBJS) $(ENET_OBJS) eduke32$(EXESUFFIX): $(DUKE3D_OBJS) $(ENGINE_OBJS) $(AUDIOLIB_OBJS) $(ENET_OBJS)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS) $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $(DUKE3D_RSRC)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest $(MT) -manifest $(DUKE3D_RSRC)\manifest.game.xml -hashupdate -outputresource:$@ -out:$@.manifest
mapster32$(EXESUFFIX): $(DUKE3D_EDITOR_OBJS) $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(AUDIOLIB_OBJS) mapster32$(EXESUFFIX): $(DUKE3D_EDITOR_OBJS) $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(AUDIOLIB_OBJS)
$(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS) $(LINK) /OUT:$@ /SUBSYSTEM:WINDOWS $(WINMACHINE) /LIBPATH:$(PLATFORM)\lib$(WINLIB) /LIBPATH:$(AUDIOPLATFORM)\lib$(WINLIB) $(flags_link) /MAP $** $(LIBS)
$(MT) -manifest $(DUKE3D_RSRC)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest $(MT) -manifest $(DUKE3D_RSRC)\manifest.build.xml -hashupdate -outputresource:$@ -out:$@.manifest
!include Makefile.deps !include Makefile.deps
!include $(ENGINE_ROOT)\Makefile.deps !include $(ENGINE_ROOT)\Makefile.deps
@ -361,6 +361,6 @@ mapster32$(EXESUFFIX): $(DUKE3D_EDITOR_OBJS) $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS
clean: clean:
-del /Q eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) $(DUKE3D_OBJS) $(DUKE3D_EDITOR_OBJS) *.pdb *.map *.manifest -del /Q eduke32$(EXESUFFIX) mapster32$(EXESUFFIX) $(DUKE3D_OBJS) $(DUKE3D_EDITOR_OBJS) *.pdb *.map *.manifest
veryclean: clean veryclean: clean
-del /Q $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(ENET_OBJS) $(AUDIOLIB_OBJS) -del /Q $(ENGINE_OBJS) $(ENGINE_EDITOR_OBJS) $(ENET_OBJS) $(AUDIOLIB_OBJS)

View file

@ -912,11 +912,11 @@ SPRITE VARIABLES:
Example: if the linked lists look like the following: Example: if the linked lists look like the following:
???????????????? ????????????????
Sector lists: Status lists: Sector lists: Status lists:
????????????????J ????????????????J
Sector0: 4, 5, 8 Status0: 2, 0, 8 Sector0: 4, 5, 8 Status0: 2, 0, 8
Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9 Sector1: 16, 2, 0, 7 Status1: 4, 5, 16, 7, 3, 9
Sector2: 3, 9 Sector2: 3, 9
???????????????? ????????????????
Notice that each number listed above is shown exactly once on both the Notice that each number listed above is shown exactly once on both the
left and right side. This is because any sprite that exists must left and right side. This is because any sprite that exists must

View file

@ -57,7 +57,7 @@ enum {
CACHE1D_FIND_NOCURDIR = 8, CACHE1D_FIND_NOCURDIR = 8,
CACHE1D_OPT_NOSTACK = 0x100, CACHE1D_OPT_NOSTACK = 0x100,
// the lower the number, the higher the priority // the lower the number, the higher the priority
CACHE1D_SOURCE_DRIVE = 0, CACHE1D_SOURCE_DRIVE = 0,
CACHE1D_SOURCE_CURDIR = 1, CACHE1D_SOURCE_CURDIR = 1,

View file

@ -71,7 +71,7 @@ typedef struct
cvar_t c; cvar_t c;
// default value for cvar, assigned when var is registered // default value for cvar, assigned when var is registered
union union
{ {
int32_t i; int32_t i;
uint32_t uint; uint32_t uint;
@ -171,7 +171,7 @@ extern osdmain_t *osd;
extern BFILE *osdlog; extern BFILE *osdlog;
extern const char* osdlogfn; extern const char* osdlogfn;
enum osdflags_t enum osdflags_t
{ {
// OSD_INITIALIZED = 0x00000001, // OSD_INITIALIZED = 0x00000001,
OSD_DRAW = 0x00000002, OSD_DRAW = 0x00000002,

View file

@ -579,9 +579,9 @@ static inline void relvec2f(GLfloat *v1, GLfloat *v2, GLfloat *out)
} }
/* ========================================================== */ /* ========================================================== */
/* inverse of matrix /* inverse of matrix
* *
* Compute inverse of matrix a, returning determinant m and * Compute inverse of matrix a, returning determinant m and
* inverse b * inverse b
*/ */
@ -594,9 +594,9 @@ static inline void relvec2f(GLfloat *v1, GLfloat *v2, GLfloat *out)
} }
/* ========================================================== */ /* ========================================================== */
/* inverse of matrix /* inverse of matrix
* *
* Compute inverse of matrix a, returning determinant m and * Compute inverse of matrix a, returning determinant m and
* inverse b * inverse b
*/ */

View file

@ -1,6 +1,6 @@
// //
// Microsoft C inline assembler // Microsoft C inline assembler
// //
//{{{ //{{{
@ -39,7 +39,7 @@ static __inline int32_t dmulscale##x (int32_t a, int32_t d, int32_t S, int32_t D
} \ } \
EDUKE32_GENERATE_PRAGMAS EDUKE32_GENERATE_PRAGMAS
#undef EDUKE32_SCALER_PRAGMA #undef EDUKE32_SCALER_PRAGMA
static __inline int32_t mulscale32(int32_t a, int32_t d) static __inline int32_t mulscale32(int32_t a, int32_t d)

View file

@ -378,7 +378,7 @@ int32_t mvlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, i
do do
{ {
if (buf[vplc>>logy] != 255) if (buf[vplc>>logy] != 255)
*pp = pal[buf[vplc>>logy]]; *pp = pal[buf[vplc>>logy]];
pp += ourbpl; pp += ourbpl;

View file

@ -252,7 +252,7 @@ machxbits3: rol eax, 6 ;xbits
mov dword ptr [hmach1b+2], ebx mov dword ptr [hmach1b+2], ebx
mov dword ptr [hmach1c+2], ebx mov dword ptr [hmach1c+2], ebx
mov dword ptr [hmach1d+2], ebx mov dword ptr [hmach1d+2], ebx
CDECLENDSET 2 CDECLENDSET 2
ret ret
@ -967,7 +967,7 @@ machvsh8: shl edx, 88h ;16-sh
mov dword ptr _vplce[4], ebp mov dword ptr _vplce[4], ebp
pop ebp pop ebp
CDECLEND 6 CDECLEND 6
ret ret
@ -1325,7 +1325,7 @@ ALIGN 16
mvcase15: mvcase15:
mov dword ptr [edi], ebx mov dword ptr [edi], ebx
jmp beginmvlineasm4 jmp beginmvlineasm4
ALIGN 16 ALIGN 16
PUBLIC _setupspritevline PUBLIC _setupspritevline
_setupspritevline: _setupspritevline:
@ -2778,4 +2778,4 @@ pentiumpro:
PUBLIC _dep_end PUBLIC _dep_end
_dep_end: _dep_end:
code ends code ends
END END

View file

@ -32,7 +32,7 @@
;CPU 586 ;CPU 586
SECTION .text SECTION .text
%ifdef UNDERSCORES %ifdef UNDERSCORES
%define asm1 _asm1 %define asm1 _asm1
%define asm2 _asm2 %define asm2 _asm2
@ -645,7 +645,7 @@ CDECLBEGINSET 1
CDECLENDSET 1 CDECLENDSET 1
ret ret
ALIGN 16 ALIGN 16
prosetupvlineasm: prosetupvlineasm:
CDECLBEGINSET 1 CDECLBEGINSET 1
@ -677,7 +677,7 @@ CDECLBEGINSET 1
CDECLENDSET 1 CDECLENDSET 1
ret ret
ALIGN 16 ALIGN 16
setupmvlineasm: setupmvlineasm:
;; NOTE: We actually receive two args (second one: saturate vplc?), but the ;; NOTE: We actually receive two args (second one: saturate vplc?), but the
@ -700,7 +700,7 @@ CDECLBEGINSET 1
CDECLENDSET 1 CDECLENDSET 1
ret ret
ALIGN 16 ALIGN 16
prevlineasm1: prevlineasm1:
CDECLBEGINSET 6 CDECLBEGINSET 6
@ -1474,7 +1474,7 @@ ALIGN 16
mvcase15: mvcase15:
mov dword [edi], ebx mov dword [edi], ebx
jmp beginmvlineasm4 jmp beginmvlineasm4
ALIGN 16 ALIGN 16
setupspritevline: setupspritevline:
@ -1658,7 +1658,7 @@ CDECLBEGINSET 2
CDECLENDSET 2 CDECLENDSET 2
ret ret
ALIGN 16 ALIGN 16
mhline: mhline:
CDECLBEGINSET 6 CDECLBEGINSET 6
@ -1689,7 +1689,7 @@ CDECLBEGINSET 6
mov dword [mmach8d+2], eax mov dword [mmach8d+2], eax
jmp short mhlineskipmodify_nosetup jmp short mhlineskipmodify_nosetup
ALIGN 16 ALIGN 16
mhlineskipmodify: mhlineskipmodify:
CDECLBEGINSET 6 CDECLBEGINSET 6
@ -1772,7 +1772,7 @@ mendhline:
CDECLENDSET 6 CDECLENDSET 6
ret ret
ALIGN 16 ALIGN 16
tsethlineshift: tsethlineshift:
CDECLBEGINSET 2 CDECLBEGINSET 2
@ -1786,7 +1786,7 @@ CDECLBEGINSET 2
CDECLENDSET 2 CDECLENDSET 2
ret ret
ALIGN 16 ALIGN 16
thline: thline:
CDECLBEGINSET 6 CDECLBEGINSET 6
@ -2139,7 +2139,7 @@ CDECLBEGINSET 3
CDECLENDSET 3 CDECLENDSET 3
ret ret
ALIGN 16 ALIGN 16
slopevlin: slopevlin:
CDECLBEGINSET 6 CDECLBEGINSET 6
@ -2369,7 +2369,7 @@ endrhline:
CDECLENDSET 6 CDECLENDSET 6
ret ret
ALIGN 16 ALIGN 16
setuprmhlineasm4: setuprmhlineasm4:
CDECLBEGINSET 6 CDECLBEGINSET 6
@ -2381,7 +2381,7 @@ CDECLBEGINSET 6
CDECLENDSET 6 CDECLENDSET 6
ret ret
ALIGN 16 ALIGN 16
rmhlineasm4: rmhlineasm4:
CDECLBEGINSET 6 CDECLBEGINSET 6
@ -2538,7 +2538,7 @@ CDECLBEGINSET 2
CDECLENDSET 2 CDECLENDSET 2
ret ret
ALIGN 16 ALIGN 16
drawslab: drawslab:
CDECLBEGINSET 6 CDECLBEGINSET 6

View file

@ -69,8 +69,8 @@ char scantoasc[128] =
int32_t defaultres[][2] = int32_t defaultres[][2] =
{ {
{1920, 1440}, {1920, 1200}, {1920, 1080}, {1680, 1050}, {1600, 1200}, {1600, 900}, {1366, 768}, {1280, 1024}, {1920, 1440}, {1920, 1200}, {1920, 1080}, {1680, 1050}, {1600, 1200}, {1600, 900}, {1366, 768}, {1280, 1024},
{1280, 960}, {1152, 864}, {1024, 768}, {1024, 600}, {800, 600}, {640, 480}, {640, 400}, {1280, 960}, {1152, 864}, {1024, 768}, {1024, 600}, {800, 600}, {640, 480}, {640, 400},
{512, 384}, {480, 360}, {400, 300}, {320, 240}, {320, 200}, {0, 0} {512, 384}, {480, 360}, {400, 300}, {320, 240}, {320, 200}, {0, 0}
}; };

View file

@ -2942,7 +2942,7 @@ static int32_t bakframe_fillandfade(char **origframeptr, int32_t sectnum, const
// 0 if wall limit would be reached. // 0 if wall limit would be reached.
// 1 if inserted point on a plain white or 2 points on a plain red wall. // 1 if inserted point on a plain white or 2 points on a plain red wall.
// N >= 2 if inserted N points on TROR-constrained wall. // N >= 2 if inserted N points on TROR-constrained wall.
// N|(EXPECTED<<16) if inserted N points but EXPECTED walls were expected. // N|(EXPECTED<<16) if inserted N points but EXPECTED walls were expected.
static int32_t M32_InsertPoint(int32_t thewall, int32_t dax, int32_t day, int32_t onewnumwalls, int32_t *mapwallnum) static int32_t M32_InsertPoint(int32_t thewall, int32_t dax, int32_t day, int32_t onewnumwalls, int32_t *mapwallnum)
{ {
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
@ -9957,7 +9957,7 @@ static int32_t menuselect(void)
} }
else getfilenames(selectedboardfilename, "*.map");; else getfilenames(selectedboardfilename, "*.map");;
ch = 0; ch = 0;
begindrawing(); begindrawing();

View file

@ -9823,8 +9823,8 @@ killsprite:
for (int32_t k=i+1; k<j; k++) for (int32_t k=i+1; k<j; k++)
for (int32_t l=i; l<k; l++) for (int32_t l=i; l<k; l++)
if (tspriteptr[k]->x == tspriteptr[l]->x && if (tspriteptr[k]->x == tspriteptr[l]->x &&
tspriteptr[k]->y == tspriteptr[l]->y && tspriteptr[k]->y == tspriteptr[l]->y &&
(tspriteptr[k]->cstat & 48) == (tspriteptr[l]->cstat & 48) && (tspriteptr[k]->cstat & 48) == (tspriteptr[l]->cstat & 48) &&
tspriteptr[k]->owner < tspriteptr[l]->owner) tspriteptr[k]->owner < tspriteptr[l]->owner)
{ {
@ -12859,7 +12859,7 @@ restart_grand:
goto add_nextsector; goto add_nextsector;
} }
} }
#endif #endif
return 0; return 0;
} }
@ -14205,7 +14205,7 @@ int32_t clipmove(vec3_t *pos, int16_t *sectnum,
//Side blocker //Side blocker
if ((x2-x1)*((pos->x)-x1) + (y2-y1)*((pos->y)-y1) < 0) if ((x2-x1)*((pos->x)-x1) + (y2-y1)*((pos->y)-y1) < 0)
addclipline(x1-day,y1+dax,x1+dax,y1+day,(int16_t)j+49152); addclipline(x1-day,y1+dax,x1+dax,y1+day,(int16_t)j+49152);
else if ((x1-x2)*((pos->x)-x2) + (y1-y2)*((pos->y)-y2) < 0) else if ((x1-x2)*((pos->x)-x2) + (y1-y2)*((pos->y)-y2) < 0)
addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152); addclipline(x2+day,y2-dax,x2-dax,y2-day,(int16_t)j+49152);
} }
@ -15009,13 +15009,13 @@ restart_grand:
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (mcf!=YAX_FLOOR && cb < 0) if (mcf!=YAX_FLOOR && cb < 0)
#endif #endif
*ceilz = daz, *ceilhit = k+16384; *ceilz = daz, *ceilhit = k+16384;
if (daz2 < *florz) if (daz2 < *florz)
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
if (mcf!=YAX_CEILING && fb < 0) if (mcf!=YAX_CEILING && fb < 0)
#endif #endif
*florz = daz2, *florhit = k+16384; *florz = daz2, *florhit = k+16384;
} }
} }
} }
@ -15981,7 +15981,7 @@ void squarerotatetile(int16_t tilenume)
if (siz != tilesiz[tilenume].y) if (siz != tilesiz[tilenume].y)
return; return;
for (i=siz-1; i>=3; i-=4) for (i=siz-1; i>=3; i-=4)
{ {
ptr2 = ptr1 = (char *) (waloff[tilenume]+i*(siz+1)); ptr2 = ptr1 = (char *) (waloff[tilenume]+i*(siz+1));
@ -17255,7 +17255,7 @@ static void drawscreen_drawwall(int32_t i, int32_t posxe, int32_t posye, int32_t
if (totalclock & 16) if (totalclock & 16)
pointsize++; pointsize++;
} }
if (show2dwall[i>>3]&pow2char[i&7]) if (show2dwall[i>>3]&pow2char[i&7])
col = editorcolors[14] - (M32_THROB>>1); col = editorcolors[14] - (M32_THROB>>1);

View file

@ -42,7 +42,7 @@ hicreplctyp *hicfindsubst(int32_t picnum, int32_t palnum)
} }
// //
// this is separate because it's not worth passing an extra parameter which is "0" in 99.9999% of cases // this is separate because it's not worth passing an extra parameter which is "0" in 99.9999% of cases
// to the regular hicfindsubst() function // to the regular hicfindsubst() function
// //
hicreplctyp *hicfindskybox(int32_t picnum, int32_t palnum) hicreplctyp *hicfindskybox(int32_t picnum, int32_t palnum)

View file

@ -5,7 +5,7 @@
* the above copyright notice appear in all copies and that both that * the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting * copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this * documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or * software for any purpose. It is provided "as is" without express or
* implied warranty. * implied warranty.
*/ */
@ -138,7 +138,7 @@ typedef struct { GLfloat s, t, r, q; } STRQ;
typedef struct { GLfloat r, g, b, a; } RGBA; typedef struct { GLfloat r, g, b, a; } RGBA;
/* Used to record all calls to glVertex3f, glNormal3f, etc. /* Used to record all calls to glVertex3f, glNormal3f, etc.
while inside glBegin / glEnd so that we can convert that while inside glBegin / glEnd so that we can convert that
to a single call to glDrawArrays. to a single call to glDrawArrays.
*/ */
@ -573,7 +573,7 @@ jwzgles_glGenLists (int n)
{ {
list *L; list *L;
int id = 0; int id = 0;
make_room ("glGenLists", make_room ("glGenLists",
(void **) &state->lists.lists, (void **) &state->lists.lists,
sizeof (*state->lists.lists), sizeof (*state->lists.lists),
&state->lists.count, &state->lists.size); &state->lists.count, &state->lists.size);
@ -608,7 +608,7 @@ jwzgles_glNewList (int id, int mode)
if (L->count != 0) jwzgles_glDeleteLists (L->id, 1); /* Overwriting */ if (L->count != 0) jwzgles_glDeleteLists (L->id, 1); /* Overwriting */
Assert (L->count == 0, "glNewList corrupted"); Assert (L->count == 0, "glNewList corrupted");
state->compiling_list = id; state->compiling_list = id;
state->list_enabled = state->enabled; state->list_enabled = state->enabled;
@ -642,7 +642,7 @@ jwzgles_glEndList (void)
static void static void
list_push (const char * const name, list_push (const char * const name,
list_fn_cb fn, fn_proto proto, void_int *av) list_fn_cb fn, fn_proto proto, void_int *av)
{ {
list *L; list *L;
@ -655,7 +655,7 @@ list_push (const char * const name,
L = &state->lists.lists[state->compiling_list-1]; L = &state->lists.lists[state->compiling_list-1];
Assert (L, "glNewList: no list"); Assert (L, "glNewList: no list");
make_room ("glNewLists", make_room ("glNewLists",
(void **) &L->fns, sizeof (*L->fns), (void **) &L->fns, sizeof (*L->fns),
&L->count, &L->size); &L->count, &L->size);
memset (&L->fns[L->count], 0, sizeof (*L->fns)); memset (&L->fns[L->count], 0, sizeof (*L->fns));
@ -706,7 +706,7 @@ list_push (const char * const name,
case PROTO_ARRAYS: case PROTO_ARRAYS:
if (fn == (list_fn_cb) &jwzgles_glDrawArrays || if (fn == (list_fn_cb) &jwzgles_glDrawArrays ||
fn == (list_fn_cb) &jwzgles_glTexParameteri) fn == (list_fn_cb) &jwzgles_glTexParameteri)
LOG4 (" push %-12s %s %d %d", name, mode_desc (av[0].i), LOG4 (" push %-12s %s %d %d", name, mode_desc (av[0].i),
av[1].i, av[2].i); av[1].i, av[2].i);
else else
LOG4 (" push %-12s %d %d %d", name, av[0].i, av[1].i, av[2].i); LOG4 (" push %-12s %d %d %d", name, av[0].i, av[1].i, av[2].i);
@ -719,7 +719,7 @@ list_push (const char * const name,
mode_desc(av[0].i), mode_desc(av[1].i), av[2].f); mode_desc(av[0].i), mode_desc(av[1].i), av[2].f);
break; break;
case PROTO_IIII: case PROTO_IIII:
LOG5 (" push %-12s %d %d %d %d", name, LOG5 (" push %-12s %d %d %d %d", name,
av[0].i, av[1].i, av[2].i, av[3].i); av[0].i, av[1].i, av[2].i, av[3].i);
break; break;
case PROTO_FFFF: case PROTO_FFFF:
@ -796,7 +796,7 @@ jwzgles_glBegin (int mode)
*/ */
if (!state->replaying_list) if (!state->replaying_list)
LOG2 ("%sglBegin %s", LOG2 ("%sglBegin %s",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
mode_desc (mode)); mode_desc (mode));
@ -819,7 +819,7 @@ jwzgles_glDeleteLists (int id0, int range)
void_int vv[2]; void_int vv[2];
vv[0].i = id0; vv[0].i = id0;
vv[1].i = range; vv[1].i = range;
list_push ("glDeleteLists", (list_fn_cb) &jwzgles_glDeleteLists, list_push ("glDeleteLists", (list_fn_cb) &jwzgles_glDeleteLists,
PROTO_II, vv); PROTO_II, vv);
} }
else else
@ -854,7 +854,7 @@ jwzgles_glDeleteLists (int id0, int range)
free (lf->arrays); free (lf->arrays);
} }
} }
if (L->fns) if (L->fns)
free (L->fns); free (L->fns);
if (L->buffer) if (L->buffer)
glDeleteBuffers (1, &L->buffer); glDeleteBuffers (1, &L->buffer);
@ -883,7 +883,7 @@ jwzgles_glNormal3fv (const GLfloat *v)
vv[0].f = v[0]; vv[0].f = v[0];
vv[1].f = v[1]; vv[1].f = v[1];
vv[2].f = v[2]; vv[2].f = v[2];
list_push ("glNormal3f", (list_fn_cb) &jwzgles_glNormal3f, list_push ("glNormal3f", (list_fn_cb) &jwzgles_glNormal3f,
PROTO_FFF, vv); PROTO_FFF, vv);
} }
else else
@ -939,7 +939,7 @@ jwzgles_glTexCoord4fv (const GLfloat *v)
else else
{ {
if (!state->replaying_list) if (!state->replaying_list)
LOG6 ("%s%sglTexCoord4f %7.3f %7.3f %7.3f %7.3f", LOG6 ("%s%sglTexCoord4f %7.3f %7.3f %7.3f %7.3f",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
(state->compiling_verts ? " rec " : ""), (state->compiling_verts ? " rec " : ""),
v[0], v[1], v[2], v[3]); v[0], v[1], v[2], v[3]);
@ -1034,13 +1034,13 @@ jwzgles_glColor4fv (const GLfloat *v)
vv[1].f = v[1]; vv[1].f = v[1];
vv[2].f = v[2]; vv[2].f = v[2];
vv[3].f = v[3]; vv[3].f = v[3];
list_push ("glColor4f", (list_fn_cb) &jwzgles_glColor4f, list_push ("glColor4f", (list_fn_cb) &jwzgles_glColor4f,
PROTO_FFFF, vv); PROTO_FFFF, vv);
} }
else else
{ {
if (!state->replaying_list) if (!state->replaying_list)
LOG6 ("%s%sglColor4f %7.3f %7.3f %7.3f %7.3f", LOG6 ("%s%sglColor4f %7.3f %7.3f %7.3f %7.3f",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
(state->compiling_verts ? " rec " : ""), (state->compiling_verts ? " rec " : ""),
v[0], v[1], v[2], v[3]); v[0], v[1], v[2], v[3]);
@ -1122,7 +1122,7 @@ jwzgles_glColor4i (GLint r, GLint g, GLint b, GLint a)
{ {
/* -0x8000000 - 0x7FFFFFFF => 0.0 - 1.0 */ /* -0x8000000 - 0x7FFFFFFF => 0.0 - 1.0 */
jwzgles_glColor4f (0.5 + (GLfloat) r / 0xFFFFFFFF, jwzgles_glColor4f (0.5 + (GLfloat) r / 0xFFFFFFFF,
0.5 + (GLfloat) g / 0xFFFFFFFF, 0.5 + (GLfloat) g / 0xFFFFFFFF,
0.5 + (GLfloat) b / 0xFFFFFFFF, 0.5 + (GLfloat) b / 0xFFFFFFFF,
0.5 + (GLfloat) a / 0xFFFFFFFF); 0.5 + (GLfloat) a / 0xFFFFFFFF);
} }
@ -1154,7 +1154,7 @@ jwzgles_glColor4ui (GLuint r, GLuint g, GLuint b, GLuint a)
{ {
/* 0 - 0xFFFFFFFF => 0.0 - 1.0 */ /* 0 - 0xFFFFFFFF => 0.0 - 1.0 */
jwzgles_glColor4f ((GLfloat) r / 0xFFFFFFFF, jwzgles_glColor4f ((GLfloat) r / 0xFFFFFFFF,
(GLfloat) g / 0xFFFFFFFF, (GLfloat) g / 0xFFFFFFFF,
(GLfloat) b / 0xFFFFFFFF, (GLfloat) b / 0xFFFFFFFF,
(GLfloat) a / 0xFFFFFFFF); (GLfloat) a / 0xFFFFFFFF);
} }
@ -1312,10 +1312,10 @@ jwzgles_glMaterialfv (GLenum face, GLenum pname, const GLfloat *color)
if (state->compiling_verts) if (state->compiling_verts)
{ {
if ((face == GL_FRONT || if ((face == GL_FRONT ||
face == GL_FRONT_AND_BACK) && face == GL_FRONT_AND_BACK) &&
(pname == GL_AMBIENT || (pname == GL_AMBIENT ||
pname == GL_DIFFUSE || pname == GL_DIFFUSE ||
pname == GL_AMBIENT_AND_DIFFUSE)) pname == GL_AMBIENT_AND_DIFFUSE))
{ {
jwzgles_glColor4f (color[0], color[1], color[2], color[3]); jwzgles_glColor4f (color[0], color[1], color[2], color[3]);
@ -1334,7 +1334,7 @@ jwzgles_glMaterialfv (GLenum face, GLenum pname, const GLfloat *color)
vv[3].f = color[1]; vv[3].f = color[1];
vv[4].f = color[2]; vv[4].f = color[2];
vv[5].f = color[3]; vv[5].f = color[3];
list_push ("glMaterialfv", (list_fn_cb) &jwzgles_glMaterialfv, list_push ("glMaterialfv", (list_fn_cb) &jwzgles_glMaterialfv,
PROTO_IIFV, vv); PROTO_IIFV, vv);
} }
else else
@ -1415,7 +1415,7 @@ jwzgles_glColorMaterial (GLenum face, GLenum mode)
void_int vv[2]; void_int vv[2];
vv[0].i = face; vv[0].i = face;
vv[1].i = mode; vv[1].i = mode;
list_push ("glColorMaterial", (list_fn_cb) &jwzgles_glColorMaterial, list_push ("glColorMaterial", (list_fn_cb) &jwzgles_glColorMaterial,
PROTO_II, vv); PROTO_II, vv);
} }
else else
@ -1628,7 +1628,7 @@ jwzgles_glPolygonMode (GLenum face, GLenum mode)
void_int vv[2]; void_int vv[2];
vv[0].i = face; vv[0].i = face;
vv[1].i = mode; vv[1].i = mode;
list_push ("glPolygonMode", (list_fn_cb) &jwzgles_glPolygonMode, list_push ("glPolygonMode", (list_fn_cb) &jwzgles_glPolygonMode,
PROTO_II, vv); PROTO_II, vv);
} }
else else
@ -1647,7 +1647,7 @@ jwzgles_glDrawBuffer (GLenum buf)
{ {
void_int vv[1]; void_int vv[1];
vv[0].i = buf; vv[0].i = buf;
list_push ("glDrawBuffer", (list_fn_cb) &jwzgles_glDrawBuffer, list_push ("glDrawBuffer", (list_fn_cb) &jwzgles_glDrawBuffer,
PROTO_I, vv); PROTO_I, vv);
} }
else else
@ -1715,7 +1715,7 @@ cq2t (unsigned char **arrayP, int stride, int count)
*arrayP = oarray2; *arrayP = oarray2;
return count2; return count2;
} }
/* Convert all coordinates in a GL_QUADS vert_set to GL_TRIANGLES. /* Convert all coordinates in a GL_QUADS vert_set to GL_TRIANGLES.
*/ */
@ -1965,7 +1965,7 @@ optimize_arrays (void)
} }
glBindBuffer (GL_ARRAY_BUFFER, buf_name); glBindBuffer (GL_ARRAY_BUFFER, buf_name);
glBufferData (GL_ARRAY_BUFFER, glBufferData (GL_ARRAY_BUFFER,
combo_count * sizeof (*combo), combo_count * sizeof (*combo),
combo, combo,
GL_STATIC_DRAW); GL_STATIC_DRAW);
@ -2052,7 +2052,7 @@ jwzgles_glCallList (int id)
case PROTO_II: case PROTO_II:
if (fn == (list_fn_cb) &jwzgles_glBindTexture || if (fn == (list_fn_cb) &jwzgles_glBindTexture ||
fn == (list_fn_cb) &jwzgles_glBindBuffer) fn == (list_fn_cb) &jwzgles_glBindBuffer)
LOG3 (" call %-12s %s %d", F->name, LOG3 (" call %-12s %s %d", F->name,
mode_desc (av[0].i), av[1].i); mode_desc (av[0].i), av[1].i);
else else
LOG3 (" call %-12s %d %d", F->name, av[0].i, av[1].i); LOG3 (" call %-12s %d %d", F->name, av[0].i, av[1].i);
@ -2065,7 +2065,7 @@ jwzgles_glCallList (int id)
break; break;
case PROTO_IF: case PROTO_IF:
LOG3 (" call %-12s %s %7.3f", F->name, LOG3 (" call %-12s %s %7.3f", F->name,
mode_desc (av[0].f), av[1].f); mode_desc (av[0].f), av[1].f);
((void (*) (GLint, GLfloat)) fn) (av[0].i, av[1].f); ((void (*) (GLint, GLfloat)) fn) (av[0].i, av[1].f);
break; break;
@ -2073,10 +2073,10 @@ jwzgles_glCallList (int id)
case PROTO_III: III: case PROTO_III: III:
if (fn == (list_fn_cb) &jwzgles_glDrawArrays || if (fn == (list_fn_cb) &jwzgles_glDrawArrays ||
fn == (list_fn_cb) &jwzgles_glTexParameteri) fn == (list_fn_cb) &jwzgles_glTexParameteri)
LOG4 (" call %-12s %s %d %d", F->name, LOG4 (" call %-12s %s %d %d", F->name,
mode_desc (av[0].i), av[1].i, av[2].i); mode_desc (av[0].i), av[1].i, av[2].i);
else else
LOG4 (" call %-12s %d %d %d", F->name, LOG4 (" call %-12s %d %d %d", F->name,
av[0].i, av[1].i, av[2].i); av[0].i, av[1].i, av[2].i);
((void (*) (int, int, int)) fn) (av[0].i, av[1].i, av[2].i); ((void (*) (int, int, int)) fn) (av[0].i, av[1].i, av[2].i);
break; break;
@ -2097,7 +2097,7 @@ jwzgles_glCallList (int id)
case PROTO_IIII: case PROTO_IIII:
LOG5 (" call %-12s %d %d %d %d", F->name, LOG5 (" call %-12s %d %d %d %d", F->name,
av[0].i, av[1].i, av[2].i, av[3].i); av[0].i, av[1].i, av[2].i, av[3].i);
((void (*) (int, int, int, int)) fn) ((void (*) (int, int, int, int)) fn)
(av[0].i, av[1].i, av[2].i, av[3].i); (av[0].i, av[1].i, av[2].i, av[3].i);
break; break;
@ -2130,9 +2130,9 @@ jwzgles_glCallList (int id)
v[2] = av[4].f; v[2] = av[4].f;
v[3] = av[5].f; v[3] = av[5].f;
LOG7 (" call %-12s %s %-8s %3.1f %3.1f %3.1f %3.1f", F->name, LOG7 (" call %-12s %s %-8s %3.1f %3.1f %3.1f %3.1f", F->name,
mode_desc (av[0].i), mode_desc (av[1].i), mode_desc (av[0].i), mode_desc (av[1].i),
av[2].f, av[3].f, av[4].f, av[5].f); av[2].f, av[3].f, av[4].f, av[5].f);
((void (*) (int, int, const GLfloat *)) fn) ((void (*) (int, int, const GLfloat *)) fn)
(av[0].i, av[1].i, v); (av[0].i, av[1].i, v);
} }
break; break;
@ -2144,7 +2144,7 @@ jwzgles_glCallList (int id)
v[1] = av[2].i; v[1] = av[2].i;
v[2] = av[3].i; v[2] = av[3].i;
v[3] = av[4].i; v[3] = av[4].i;
LOG6 (" call %-12s %s %3d %3d %3d %3d", F->name, LOG6 (" call %-12s %s %3d %3d %3d %3d", F->name,
mode_desc (av[0].i), mode_desc (av[0].i),
av[1].i, av[2].i, av[3].i, av[4].i); av[1].i, av[2].i, av[3].i, av[4].i);
((void (*) (int, const int *)) fn) (av[0].i, v); ((void (*) (int, const int *)) fn) (av[0].i, v);
@ -2159,9 +2159,9 @@ jwzgles_glCallList (int id)
v[2] = av[4].i; v[2] = av[4].i;
v[3] = av[5].i; v[3] = av[5].i;
LOG7 (" call %-12s %s %-8s %3d %3d %3d %3d", F->name, LOG7 (" call %-12s %s %-8s %3d %3d %3d %3d", F->name,
mode_desc (av[0].i), mode_desc (av[1].i), mode_desc (av[0].i), mode_desc (av[1].i),
av[2].i, av[3].i, av[4].i, av[5].i); av[2].i, av[3].i, av[4].i, av[5].i);
((void (*) (int, int, const int *)) fn) ((void (*) (int, int, const int *)) fn)
(av[0].i, av[1].i, v); (av[0].i, av[1].i, v);
} }
break; break;
@ -2280,19 +2280,19 @@ dump_array_data (draw_array *A, int count,
if (A->binding) if (A->binding)
{ {
fprintf (stderr, fprintf (stderr,
"jwzgles: %s %s %d %s %2d, %4d = %5d bind %d @ %d\n", "jwzgles: %s %s %d %s %2d, %4d = %5d bind %d @ %d\n",
action, name, action, name,
A->size, mode_desc(A->type), A->stride, A->size, mode_desc(A->type), A->stride,
count, bytes, A->binding, (int) A->data); count, bytes, A->binding, (int) A->data);
} }
else else
{ {
Assert (bytes == A->bytes, "array data corrupted"); Assert (bytes == A->bytes, "array data corrupted");
fprintf (stderr, "jwzgles: %s %s %d %s %2d, %4d = %5d @ %lX", fprintf (stderr, "jwzgles: %s %s %d %s %2d, %4d = %5d @ %lX",
action, name, action, name,
A->size, mode_desc(A->type), A->stride, A->size, mode_desc(A->type), A->stride,
count, bytes, (unsigned long) A->data); count, bytes, (unsigned long) A->data);
if (old) if (old)
fprintf (stderr, " / %lX", (unsigned long) old); fprintf (stderr, " / %lX", (unsigned long) old);
@ -2318,7 +2318,7 @@ dump_array_data (draw_array *A, int count,
for (i = 0; i < count * A->size; i++) for (i = 0; i < count * A->size; i++)
{ {
if (i % 4 == 0) if (i % 4 == 0)
fprintf (stderr, "\njwzgles: %4d: ", fprintf (stderr, "\njwzgles: %4d: ",
i + (int) A->data / sizeof(GLfloat)); i + (int) A->data / sizeof(GLfloat));
fprintf (stderr, " %7.3f", d[i]); fprintf (stderr, " %7.3f", d[i]);
} }
@ -2593,7 +2593,7 @@ jwzgles_glInterleavedArrays (GLenum format, GLsizei stride, const void *data)
jwzgles_glEnableClientState (GL_VERTEX_ARRAY); jwzgles_glEnableClientState (GL_VERTEX_ARRAY);
if (!state->replaying_list) if (!state->replaying_list)
LOG4 ("%sglInterleavedArrays %s %d %lX", LOG4 ("%sglInterleavedArrays %s %d %lX",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
mode_desc (format), stride, (unsigned long) data); mode_desc (format), stride, (unsigned long) data);
@ -2602,7 +2602,7 @@ jwzgles_glInterleavedArrays (GLenum format, GLsizei stride, const void *data)
glVertexPointer (2, GL_FLOAT, stride, c); glVertexPointer (2, GL_FLOAT, stride, c);
CHECK("glVertexPointer"); CHECK("glVertexPointer");
if (!state->replaying_list) if (!state->replaying_list)
LOG3 ("%s -> glVertexPointer 2 FLOAT %d %lX", LOG3 ("%s -> glVertexPointer 2 FLOAT %d %lX",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
stride, (unsigned long) c); stride, (unsigned long) c);
break; break;
@ -2610,11 +2610,11 @@ jwzgles_glInterleavedArrays (GLenum format, GLsizei stride, const void *data)
glVertexPointer (3, GL_FLOAT, stride, c); glVertexPointer (3, GL_FLOAT, stride, c);
CHECK("glVertexPointer"); CHECK("glVertexPointer");
if (!state->replaying_list) if (!state->replaying_list)
LOG3 ("%s -> glVertexPointer 3 FLOAT %d %lX", LOG3 ("%s -> glVertexPointer 3 FLOAT %d %lX",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
stride, (unsigned long) c); stride, (unsigned long) c);
break; break;
case GL_C4UB_V2F: case GL_C4UB_V2F:
if (stride == 0) if (stride == 0)
stride = 4*B + 2*F; stride = 4*B + 2*F;
jwzgles_glEnableClientState (GL_COLOR_ARRAY); jwzgles_glEnableClientState (GL_COLOR_ARRAY);
@ -2650,14 +2650,14 @@ jwzgles_glInterleavedArrays (GLenum format, GLsizei stride, const void *data)
glNormalPointer (GL_FLOAT, stride, c); glNormalPointer (GL_FLOAT, stride, c);
CHECK("glNormalPointer"); CHECK("glNormalPointer");
if (!state->replaying_list) if (!state->replaying_list)
LOG3 ("%s -> glNormalPointer FLOAT %d %lX", LOG3 ("%s -> glNormalPointer FLOAT %d %lX",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
stride, (unsigned long) c); stride, (unsigned long) c);
c += 3*F; c += 3*F;
glVertexPointer (3, GL_FLOAT, stride, c); glVertexPointer (3, GL_FLOAT, stride, c);
CHECK("glVertexPointer"); CHECK("glVertexPointer");
if (!state->replaying_list) if (!state->replaying_list)
LOG3 ("%s -> glVertexPointer 3 FLOAT %d %lX", LOG3 ("%s -> glVertexPointer 3 FLOAT %d %lX",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
stride, (unsigned long) c); stride, (unsigned long) c);
break; break;
@ -2987,7 +2987,7 @@ jwzgles_glTexImage2D (GLenum target,
type = GL_UNSIGNED_BYTE; type = GL_UNSIGNED_BYTE;
if (! state->replaying_list) if (! state->replaying_list)
LOG10 ("direct %-12s %s %d %s %d %d %d %s %s 0x%lX", "glTexImage2D", LOG10 ("direct %-12s %s %d %s %d %d %d %s %s 0x%lX", "glTexImage2D",
mode_desc(target), level, mode_desc(internalFormat), mode_desc(target), level, mode_desc(internalFormat),
width, height, border, mode_desc(format), mode_desc(type), width, height, border, mode_desc(format), mode_desc(type),
(unsigned long) data); (unsigned long) data);
@ -3011,7 +3011,7 @@ jwzgles_glTexSubImage2D (GLenum target, GLint level,
"glTexSubImage2D not allowed inside glNewList"); "glTexSubImage2D not allowed inside glNewList");
if (! state->replaying_list) if (! state->replaying_list)
LOG10 ("direct %-12s %s %d %d %d %d %d %s %s 0x%lX", "glTexSubImage2D", LOG10 ("direct %-12s %s %d %d %d %d %d %s %s 0x%lX", "glTexSubImage2D",
mode_desc(target), level, xoffset, yoffset, width, height, mode_desc(target), level, xoffset, yoffset, width, height,
mode_desc (format), mode_desc (type), (unsigned long) pixels); mode_desc (format), mode_desc (type), (unsigned long) pixels);
glTexSubImage2D (target, level, xoffset, yoffset, width, height, glTexSubImage2D (target, level, xoffset, yoffset, width, height,
@ -3082,12 +3082,12 @@ jwzgles_glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLsizei height, GLint x, GLint y, GLsizei width, GLsizei height,
GLint border) GLint border)
{ {
Assert (!state->compiling_verts, Assert (!state->compiling_verts,
"glCopyTexImage2D not allowed inside glBegin"); "glCopyTexImage2D not allowed inside glBegin");
Assert (!state->compiling_list, /* technically legal, but stupid! */ Assert (!state->compiling_list, /* technically legal, but stupid! */
"glCopyTexImage2D not allowed inside glNewList"); "glCopyTexImage2D not allowed inside glNewList");
if (! state->replaying_list) if (! state->replaying_list)
LOG9 ("direct %-12s %s %d %s %d %d %d %d %d", "glCopyTexImage2D", LOG9 ("direct %-12s %s %d %s %d %d %d %d %d", "glCopyTexImage2D",
mode_desc(target), level, mode_desc(internalformat), mode_desc(target), level, mode_desc(internalformat),
x, y, width, height, border); x, y, width, height, border);
glCopyTexImage2D (target, level, internalformat, x, y, width, height, glCopyTexImage2D (target, level, internalformat, x, y, width, height,
@ -3106,7 +3106,7 @@ jwzgles_glTexGenfv (GLenum coord, GLenum pname, const GLfloat *params)
texgen_state *s = NULL; texgen_state *s = NULL;
if (pname == GL_TEXTURE_GEN_MODE) if (pname == GL_TEXTURE_GEN_MODE)
LOG5 ("%sdirect %-12s %s %s %s", LOG5 ("%sdirect %-12s %s %s %s",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
"glTexGenfv", "glTexGenfv",
mode_desc(coord), mode_desc(pname), mode_desc(params[0])); mode_desc(coord), mode_desc(pname), mode_desc(params[0]));
@ -3161,7 +3161,7 @@ jwzgles_glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params)
} }
if (pname == GL_TEXTURE_GEN_MODE) if (pname == GL_TEXTURE_GEN_MODE)
LOG5 ("%sdirect %-12s %s %s -> %s", LOG5 ("%sdirect %-12s %s %s -> %s",
(state->compiling_list || state->replaying_list ? " " : ""), (state->compiling_list || state->replaying_list ? " " : ""),
"glGetTexGenfv", "glGetTexGenfv",
mode_desc(coord), mode_desc(pname), mode_desc(params[0])); mode_desc(coord), mode_desc(pname), mode_desc(params[0]));
@ -3180,7 +3180,7 @@ dot_product (int rank, GLfloat *a, GLfloat *b)
/* A dot B => (A[1] * B[1]) + ... + (A[n] * B[n]) */ /* A dot B => (A[1] * B[1]) + ... + (A[n] * B[n]) */
GLfloat ret = 0; GLfloat ret = 0;
int i; int i;
for (i = 0; i < rank; i++) for (i = 0; i < rank; i++)
ret += a[i] * b[i]; ret += a[i] * b[i];
return ret; return ret;
} }
@ -3204,7 +3204,7 @@ generate_texture_coords (GLuint first, GLuint count)
{ GL_T, ISENABLED_TEXTURE_GEN_T, 0, { 0, } }, { GL_T, ISENABLED_TEXTURE_GEN_T, 0, { 0, } },
{ GL_R, ISENABLED_TEXTURE_GEN_R, 0, { 0, } }, { GL_R, ISENABLED_TEXTURE_GEN_R, 0, { 0, } },
{ GL_Q, ISENABLED_TEXTURE_GEN_Q, 0, { 0, }}}; { GL_Q, ISENABLED_TEXTURE_GEN_Q, 0, { 0, }}};
int tcoords = 0; int tcoords = 0;
/* Read the texture plane configs that were stored with glTexGen. /* Read the texture plane configs that were stored with glTexGen.
@ -3372,7 +3372,7 @@ jwzgles_gluBuild2DMipmaps (GLenum target,
format = GL_RGBA; format = GL_RGBA;
} }
jwzgles_glTexImage2D (target, 0, internalFormat, w2, h2, 0, jwzgles_glTexImage2D (target, 0, internalFormat, w2, h2, 0,
format, type, data); format, type, data);
free (d2); free (d2);
@ -3724,11 +3724,11 @@ jwzgles_gluErrorString (GLenum error)
subsequently-recorded call to glDrawArrays. This is a little weird. subsequently-recorded call to glDrawArrays. This is a little weird.
*/ */
void void
jwzgles_glVertexPointer (GLuint size, GLuint type, GLuint stride, jwzgles_glVertexPointer (GLuint size, GLuint type, GLuint stride,
const GLvoid *ptr) const GLvoid *ptr)
{ {
if (! state->replaying_list) if (! state->replaying_list)
LOG5 ("direct %-12s %d %s %d 0x%lX", "glVertexPointer", LOG5 ("direct %-12s %d %s %d 0x%lX", "glVertexPointer",
size, mode_desc(type), stride, (unsigned long) ptr); size, mode_desc(type), stride, (unsigned long) ptr);
glVertexPointer (size, type, stride, ptr); /* the real one */ glVertexPointer (size, type, stride, ptr); /* the real one */
CHECK("glVertexPointer"); CHECK("glVertexPointer");
@ -3739,29 +3739,29 @@ void
jwzgles_glNormalPointer (GLuint type, GLuint stride, const GLvoid *ptr) jwzgles_glNormalPointer (GLuint type, GLuint stride, const GLvoid *ptr)
{ {
if (! state->replaying_list) if (! state->replaying_list)
LOG4 ("direct %-12s %s %d 0x%lX", "glNormalPointer", LOG4 ("direct %-12s %s %d 0x%lX", "glNormalPointer",
mode_desc(type), stride, (unsigned long) ptr); mode_desc(type), stride, (unsigned long) ptr);
glNormalPointer (type, stride, ptr); /* the real one */ glNormalPointer (type, stride, ptr); /* the real one */
CHECK("glNormalPointer"); CHECK("glNormalPointer");
} }
void void
jwzgles_glColorPointer (GLuint size, GLuint type, GLuint stride, jwzgles_glColorPointer (GLuint size, GLuint type, GLuint stride,
const GLvoid *ptr) const GLvoid *ptr)
{ {
if (! state->replaying_list) if (! state->replaying_list)
LOG5 ("direct %-12s %d %s %d 0x%lX", "glColorPointer", LOG5 ("direct %-12s %d %s %d 0x%lX", "glColorPointer",
size, mode_desc(type), stride, (unsigned long) ptr); size, mode_desc(type), stride, (unsigned long) ptr);
glColorPointer (size, type, stride, ptr); /* the real one */ glColorPointer (size, type, stride, ptr); /* the real one */
CHECK("glColorPointer"); CHECK("glColorPointer");
} }
void void
jwzgles_glTexCoordPointer (GLuint size, GLuint type, GLuint stride, jwzgles_glTexCoordPointer (GLuint size, GLuint type, GLuint stride,
const GLvoid *ptr) const GLvoid *ptr)
{ {
if (! state->replaying_list) if (! state->replaying_list)
LOG5 ("direct %-12s %d %s %d 0x%lX", "glTexCoordPointer", LOG5 ("direct %-12s %d %s %d 0x%lX", "glTexCoordPointer",
size, mode_desc(type), stride, (unsigned long) ptr); size, mode_desc(type), stride, (unsigned long) ptr);
glTexCoordPointer (size, type, stride, ptr); /* the real one */ glTexCoordPointer (size, type, stride, ptr); /* the real one */
CHECK("glTexCoordPointer"); CHECK("glTexCoordPointer");
@ -3820,7 +3820,7 @@ jwzgles_glTexParameterf (GLuint target, GLuint pname, GLfloat param)
else else
{ {
if (! state->replaying_list) if (! state->replaying_list)
LOG4 ("direct %-12s %s %s %7.3f", "glTexParameterf", LOG4 ("direct %-12s %s %s %7.3f", "glTexParameterf",
mode_desc(target), mode_desc(pname), param); mode_desc(target), mode_desc(pname), param);
glTexParameterf (target, pname, param); /* the real one */ glTexParameterf (target, pname, param); /* the real one */
CHECK("glTexParameterf"); CHECK("glTexParameterf");
@ -3856,7 +3856,7 @@ jwzgles_glBindTexture (GLuint target, GLuint texture)
/* else */ /* else */
{ {
if (! state->replaying_list) if (! state->replaying_list)
LOG3 ("direct %-12s %s %d", "glBindTexture", LOG3 ("direct %-12s %s %d", "glBindTexture",
mode_desc(target), texture); mode_desc(target), texture);
glBindTexture (target, texture); /* the real one */ glBindTexture (target, texture); /* the real one */
CHECK("glBindTexture"); CHECK("glBindTexture");
@ -3917,7 +3917,7 @@ jwzgles_glOrtho (GLfloat left, GLfloat right,
void void
jwzgles_gluPerspective (GLdouble fovy, GLdouble aspect, jwzgles_gluPerspective (GLdouble fovy, GLdouble aspect,
GLdouble near, GLdouble far) GLdouble near, GLdouble far)
{ {
GLfloat m[16]; GLfloat m[16];
@ -3955,9 +3955,9 @@ jwzgles_gluLookAt (GLfloat eyex, GLfloat eyey, GLfloat eyez,
GLfloat m[16]; GLfloat m[16];
GLfloat x[3], y[3], z[3]; GLfloat x[3], y[3], z[3];
GLfloat mag; GLfloat mag;
/* Make rotation matrix */ /* Make rotation matrix */
/* Z vector */ /* Z vector */
z[0] = eyex - centerx; z[0] = eyex - centerx;
z[1] = eyey - centery; z[1] = eyey - centery;
@ -3968,41 +3968,41 @@ jwzgles_gluLookAt (GLfloat eyex, GLfloat eyey, GLfloat eyez,
z[1] /= mag; z[1] /= mag;
z[2] /= mag; z[2] /= mag;
} }
/* Y vector */ /* Y vector */
y[0] = upx; y[0] = upx;
y[1] = upy; y[1] = upy;
y[2] = upz; y[2] = upz;
/* X vector = Y cross Z */ /* X vector = Y cross Z */
x[0] = y[1] * z[2] - y[2] * z[1]; x[0] = y[1] * z[2] - y[2] * z[1];
x[1] = -y[0] * z[2] + y[2] * z[0]; x[1] = -y[0] * z[2] + y[2] * z[0];
x[2] = y[0] * z[1] - y[1] * z[0]; x[2] = y[0] * z[1] - y[1] * z[0];
/* Recompute Y = Z cross X */ /* Recompute Y = Z cross X */
y[0] = z[1] * x[2] - z[2] * x[1]; y[0] = z[1] * x[2] - z[2] * x[1];
y[1] = -z[0] * x[2] + z[2] * x[0]; y[1] = -z[0] * x[2] + z[2] * x[0];
y[2] = z[0] * x[1] - z[1] * x[0]; y[2] = z[0] * x[1] - z[1] * x[0];
/* mpichler, 19950515 */ /* mpichler, 19950515 */
/* cross product gives area of parallelogram, which is < 1.0 for /* cross product gives area of parallelogram, which is < 1.0 for
* non-perpendicular unit-length vectors; so normalize x, y here * non-perpendicular unit-length vectors; so normalize x, y here
*/ */
mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]); mag = sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
if (mag) { if (mag) {
x[0] /= mag; x[0] /= mag;
x[1] /= mag; x[1] /= mag;
x[2] /= mag; x[2] /= mag;
} }
mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]); mag = sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
if (mag) { if (mag) {
y[0] /= mag; y[0] /= mag;
y[1] /= mag; y[1] /= mag;
y[2] /= mag; y[2] /= mag;
} }
#define M(row,col) m[col*4+row] #define M(row,col) m[col*4+row]
M(0, 0) = x[0]; M(0, 1) = x[1]; M(0, 2) = x[2]; M(0, 3) = 0.0; M(0, 0) = x[0]; M(0, 1) = x[1]; M(0, 2) = x[2]; M(0, 3) = 0.0;
M(1, 0) = y[0]; M(1, 1) = y[1]; M(1, 2) = y[2]; M(1, 3) = 0.0; M(1, 0) = y[0]; M(1, 1) = y[1]; M(1, 2) = y[2]; M(1, 3) = 0.0;
@ -4011,7 +4011,7 @@ jwzgles_gluLookAt (GLfloat eyex, GLfloat eyey, GLfloat eyez,
#undef M #undef M
jwzgles_glMultMatrixf(m); jwzgles_glMultMatrixf(m);
/* Translate Eye to Origin */ /* Translate Eye to Origin */
jwzgles_glTranslatef(-eyex, -eyey, -eyez); jwzgles_glTranslatef(-eyex, -eyey, -eyez);
} }
@ -4024,7 +4024,7 @@ static void __gluMultMatrixVecd (const GLdouble matrix[16],
int i; int i;
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
out[i] = out[i] =
in[0] * matrix[0*4+i] + in[0] * matrix[0*4+i] +
in[1] * matrix[1*4+i] + in[1] * matrix[1*4+i] +
in[2] * matrix[2*4+i] + in[2] * matrix[2*4+i] +
@ -4033,8 +4033,8 @@ static void __gluMultMatrixVecd (const GLdouble matrix[16],
} }
GLint GLint
jwzgles_gluProject (GLdouble objx, GLdouble objy, GLdouble objz, jwzgles_gluProject (GLdouble objx, GLdouble objy, GLdouble objz,
const GLdouble modelMatrix[16], const GLdouble modelMatrix[16],
const GLdouble projMatrix[16], const GLdouble projMatrix[16],
const GLint viewport[4], const GLint viewport[4],
GLdouble *winx, GLdouble *winy, GLdouble *winz) GLdouble *winx, GLdouble *winy, GLdouble *winz)

View file

@ -2275,7 +2275,7 @@ void kpgetdim(const char *buf, int32_t leng, int32_t *xsiz, int32_t *ysiz)
cptr = &cptr[B_BIG16(B_UNBUF16(&cptr[2]))+2]; cptr = &cptr[B_BIG16(B_UNBUF16(&cptr[2]))+2];
} }
} }
else else
{ {
if ((ubuf[0] == 'G') && (ubuf[1] == 'I') && (ubuf[2] == 'F')) //.GIF if ((ubuf[0] == 'G') && (ubuf[1] == 'I') && (ubuf[2] == 'F')) //.GIF
{ {

View file

@ -2702,7 +2702,7 @@ int32_t polymost_mddraw(const tspritetype *tspr)
allocmodelverts = maxmodelverts; allocmodelverts = maxmodelverts;
} }
mdmodel_t *const vm = models[tile2model[Ptile2tile(tspr->picnum, mdmodel_t *const vm = models[tile2model[Ptile2tile(tspr->picnum,
(tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal)].modelid]; (tspr->owner >= MAXSPRITES) ? tspr->pal : sprite[tspr->owner].pal)].modelid];
if (vm->mdnum == 1) { return polymost_voxdraw((voxmodel_t *)vm,tspr); } if (vm->mdnum == 1) { return polymost_voxdraw((voxmodel_t *)vm,tspr); }
if (vm->mdnum == 3) { return polymost_md3draw((md3model_t *)vm,tspr); } if (vm->mdnum == 3) { return polymost_md3draw((md3model_t *)vm,tspr); }

View file

@ -891,7 +891,7 @@ void polymer_uninit(void)
prhighpalookups[i][j].map = 0; prhighpalookups[i][j].map = 0;
} }
j++; j++;
} }
i++; i++;
} }
@ -1741,7 +1741,7 @@ void polymer_texinvalidate(void)
void polymer_definehighpalookup(char basepalnum, char palnum, char *data) void polymer_definehighpalookup(char basepalnum, char palnum, char *data)
{ {
prhighpalookups[basepalnum][palnum].data = (char *)Xmalloc(PR_HIGHPALOOKUP_DATA_SIZE); prhighpalookups[basepalnum][palnum].data = (char *)Xmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
Bmemcpy(prhighpalookups[basepalnum][palnum].data, data, PR_HIGHPALOOKUP_DATA_SIZE); Bmemcpy(prhighpalookups[basepalnum][palnum].data, data, PR_HIGHPALOOKUP_DATA_SIZE);
} }
@ -2014,17 +2014,17 @@ static void polymer_displayrooms(const int16_t dacursectnum)
// while (front < back) // while (front < back)
// { // {
// sec = &sector[sectorqueue[front]]; // sec = &sector[sectorqueue[front]];
// //
// polymer_drawsector(sectorqueue[front]); // polymer_drawsector(sectorqueue[front]);
// //
// i = 0; // i = 0;
// while (i < sec->wallnum) // while (i < sec->wallnum)
// { // {
// polymer_drawwall(sectorqueue[front], sec->wallptr + i); // polymer_drawwall(sectorqueue[front], sec->wallptr + i);
// //
// i++; // i++;
// } // }
// //
// front++; // front++;
// } // }
@ -3698,7 +3698,7 @@ static void polymer_computeplane(_prplane* p)
} }
i+= (p->indices) ? 3 : 1; i+= (p->indices) ? 3 : 1;
} }
while ((p->indices && i < p->indicescount) || while ((p->indices && i < p->indicescount) ||
(!p->indices && i < p->vertcount)); (!p->indices && i < p->vertcount));
} }
@ -3793,13 +3793,13 @@ static inline int32_t polymer_planeinfrustum(_prplane *plane, float* frustum)
{ {
int32_t i, j, k = -1; int32_t i, j, k = -1;
i = 4; i = 4;
do do
{ {
int32_t ii = i * 4; int32_t ii = i * 4;
j = k = plane->vertcount - 1; j = k = plane->vertcount - 1;
do do
{ {
k -= ((frustum[ii + 0] * plane->buffer[j].x + k -= ((frustum[ii + 0] * plane->buffer[j].x +
@ -4634,7 +4634,7 @@ static void polymer_drawmdsprite(tspritetype *tspr)
// bglDisable(GL_TEXTURE_2D); // bglDisable(GL_TEXTURE_2D);
// bglBegin(GL_LINES); // bglBegin(GL_LINES);
// bglColor4f(1.0, 1.0, 1.0, 1.0); // bglColor4f(1.0, 1.0, 1.0, 1.0);
// //
// int i = 0; // int i = 0;
// while (i < s->numverts) // while (i < s->numverts)
// { // {
@ -4740,7 +4740,7 @@ static void polymer_drawmdsprite(tspritetype *tspr)
curlight = 0; curlight = 0;
do { do {
materialbits = polymer_bindmaterial(&mdspritematerial, modellights, modellightcount); materialbits = polymer_bindmaterial(&mdspritematerial, modellights, modellightcount);
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, 0); bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, 0);
polymer_unbindmaterial(materialbits); polymer_unbindmaterial(materialbits);
} while ((++curlight < modellightcount) && (curlight < pr_maxlightpasses)); } while ((++curlight < modellightcount) && (curlight < pr_maxlightpasses));
@ -5671,7 +5671,7 @@ static void polymer_compileprogram(int32_t programbits)
#ifdef PR_LINEAR_FOG #ifdef PR_LINEAR_FOG
if (programbits & prprogrambits[PR_BIT_FOG].bit) if (programbits & prprogrambits[PR_BIT_FOG].bit)
{ {
prprograms[programbits].uniform_linearFog = bglGetUniformLocationARB(program, "linearFog"); prprograms[programbits].uniform_linearFog = bglGetUniformLocationARB(program, "linearFog");
} }
#endif #endif
// PR_BIT_GLOW_MAP // PR_BIT_GLOW_MAP

View file

@ -391,7 +391,7 @@ void polymost_glinit()
texcache_init(); texcache_init();
texcache_loadoffsets(); texcache_loadoffsets();
texcache_openfiles(); texcache_openfiles();
texcache_setupmemcache(); texcache_setupmemcache();
texcache_checkgarbage(); texcache_checkgarbage();
@ -1682,7 +1682,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
for (int i=0; i<n; ++i) for (int i=0; i<n; ++i)
{ {
//Up/down rotation //Up/down rotation
vec3f_t const orot = { dpxy[i].x - ghalfx, vec3f_t const orot = { dpxy[i].x - ghalfx,
(dpxy[i].y - ghoriz) * gchang - ozgs, (dpxy[i].y - ghoriz) * gchang - ozgs,
(dpxy[i].y - ghoriz) * gshang + ozgc }; (dpxy[i].y - ghoriz) * gshang + ozgc };
@ -2189,7 +2189,7 @@ static void polymost_domost(float x0, float y0, float x1, float y1)
//Test for intersection on umost (0) and dmost (1) //Test for intersection on umost (0) and dmost (1)
float const d[2] = { ((dm0.y - dm1.y) * dx) - ((dm0.x - dm1.x) * cv[0]), float const d[2] = { ((dm0.y - dm1.y) * dx) - ((dm0.x - dm1.x) * cv[0]),
((dm0.y - dm1.y) * dx) - ((dm0.x - dm1.x) * cv[1]) }; ((dm0.y - dm1.y) * dx) - ((dm0.x - dm1.x) * cv[1]) };
float const n[2] = { ((dm0.y - cy[0]) * dx) - ((dm0.x - n0.x) * cv[0]), float const n[2] = { ((dm0.y - cy[0]) * dx) - ((dm0.x - n0.x) * cv[0]),
@ -3285,7 +3285,7 @@ static void polymost_drawalls(int32_t const bunch)
ytex.v = vv[1]; ytex.v = vv[1];
otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->ceilingypanning*(float)i*(1.f/256.f) : vv[0]; otex.v = r_parallaxskypanning ? vv[0] + dd*(float)sec->ceilingypanning*(float)i*(1.f/256.f) : vv[0];
i = globalpicnum; i = globalpicnum;
float const r = (cy1-cy0)/(x1-x0); //slope of line float const r = (cy1-cy0)/(x1-x0); //slope of line
o.y = fviewingrange/(ghalfx*256.f); o.z = 1.f/o.y; o.y = fviewingrange/(ghalfx*256.f); o.z = 1.f/o.y;
@ -3802,7 +3802,7 @@ static void polymost_initmosts(const float * px, const float * py, int const n)
vsp[vcnt].cy[0] = vsp[vcnt].fy[0] = py[imin]; vsp[vcnt].cy[0] = vsp[vcnt].fy[0] = py[imin];
vcnt++; vcnt++;
int i = imin+1, j = imin-1; int i = imin+1, j = imin-1;
if (i >= n) i = 0; if (i >= n) i = 0;
if (j < 0) j = n-1; if (j < 0) j = n-1;
@ -3901,7 +3901,7 @@ void polymost_drawrooms()
} }
} }
#endif #endif
//Polymost supports true look up/down :) Here, we convert horizon to angle. //Polymost supports true look up/down :) Here, we convert horizon to angle.
//gchang&gshang are cos&sin of this angle (respectively) //gchang&gshang are cos&sin of this angle (respectively)
fviewingrange = (float) viewingrange; fviewingrange = (float) viewingrange;
@ -4561,8 +4561,8 @@ void polymost_drawsprite(int32_t snum)
float f = (float)(tsiz.x >> 1) + (float)off.x; float f = (float)(tsiz.x >> 1) + (float)off.x;
vec2f_t const vf = { extent.x * f, extent.y * f }; vec2f_t const vf = { extent.x * f, extent.y * f };
vec2f_t vec0 = { (float)(pos.x - globalposx) - vf.x, vec2f_t vec0 = { (float)(pos.x - globalposx) - vf.x,
(float)(pos.y - globalposy) - vf.y }; (float)(pos.y - globalposy) - vf.y };
int32_t const s = tspr->owner; int32_t const s = tspr->owner;
@ -5362,7 +5362,7 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
do do
{ {
int32_t zz = z+1; if (zz == nn) zz = 0; int32_t zz = z+1; if (zz == nn) zz = 0;
float const y1 = py2[z], y2 = py2[zz]-y1; float const y1 = py2[z], y2 = py2[zz]-y1;
if ((cy1 <= y1) && (y1 <= cy2)) { pxy[n].y = y1; pxy[n].x = px2[z]; n++; } if ((cy1 <= y1) && (y1 <= cy2)) { pxy[n].y = y1; pxy[n].x = px2[z]; n++; }
float fy = (float)(y2 <= 0 ? cy2 : cy1); d = fy - y1; float fy = (float)(y2 <= 0 ? cy2 : cy1); d = fy - y1;
if ((d < y2) != (d < 0)) { pxy[n].y = fy; pxy[n].x = (px2[zz]-px2[z])*d/y2 + px2[z]; n++; } if ((d < y2) != (d < 0)) { pxy[n].y = fy; pxy[n].x = (px2[zz]-px2[z])*d/y2 + px2[z]; n++; }
@ -5779,7 +5779,7 @@ int32_t polymost_printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t ba
int const c = Bstrlen(name); int const c = Bstrlen(name);
bglColor4ub(b.r,b.g,b.b,255); bglColor4ub(b.r,b.g,b.b,255);
bglBegin(GL_QUADS); bglBegin(GL_QUADS);
bglVertex2i(xpos,ypos); bglVertex2i(xpos,ypos);
@ -6027,7 +6027,7 @@ void polymost_initosdfuncs(void)
{ "r_pr_vbos", "contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void *) &pr_vbos, CVAR_INT | CVAR_RESTARTVID, 0, 2 }, { "r_pr_vbos", "contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void *) &pr_vbos, CVAR_INT | CVAR_RESTARTVID, 0, 2 },
{ "r_pr_buckets", "controls batching of primitives. 0: no batching. 1: buckets of materials.", (void *)&pr_buckets, CVAR_BOOL | CVAR_NOSAVE | CVAR_RESTARTVID, 0, 1 }, { "r_pr_buckets", "controls batching of primitives. 0: no batching. 1: buckets of materials.", (void *)&pr_buckets, CVAR_BOOL | CVAR_NOSAVE | CVAR_RESTARTVID, 0, 1 },
{ "r_pr_gpusmoothing", "toggles model animation interpolation", (void *)&pr_gpusmoothing, CVAR_INT, 0, 1 }, { "r_pr_gpusmoothing", "toggles model animation interpolation", (void *)&pr_gpusmoothing, CVAR_INT, 0, 1 },
{ "r_pr_overrideparallax", "overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", { "r_pr_overrideparallax", "overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens",
(void *) &pr_overrideparallax, CVAR_BOOL | CVAR_NOSAVE, 0, 1 }, (void *) &pr_overrideparallax, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_parallaxscale", "overriden parallax mapping offset scale", (void *) &pr_parallaxscale, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 }, { "r_pr_parallaxscale", "overriden parallax mapping offset scale", (void *) &pr_parallaxscale, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 },
{ "r_pr_parallaxbias", "overriden parallax mapping offset bias", (void *) &pr_parallaxbias, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 }, { "r_pr_parallaxbias", "overriden parallax mapping offset bias", (void *) &pr_parallaxbias, CVAR_FLOAT | CVAR_NOSAVE, -10, 10 },

View file

@ -1969,7 +1969,7 @@ int32_t handleevents_sdlcommon(SDL_Event *ev)
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
{ {
int32_t j; int32_t j;
// some of these get reordered to match winlayer // some of these get reordered to match winlayer
switch (ev->button.button) switch (ev->button.button)
{ {

View file

@ -270,7 +270,7 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, FALSE); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, "text", 0, NULL); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode2dcombo), cell, "text", 0, NULL);
} }
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dcombo, 1,2, 0,1, gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dcombo, 1,2, 0,1,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 6); (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 6);
gtk_widget_add_accelerator(stwidgets.vmode2dcombo, "grab_focus", stwidgets.accel_group, gtk_widget_add_accelerator(stwidgets.vmode2dcombo, "grab_focus", stwidgets.accel_group,
GDK_2, GDK_MOD1_MASK, GDK_2, GDK_MOD1_MASK,
@ -300,14 +300,14 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL);
} }
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 1,2, gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 1,2,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0); (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0);
gtk_widget_add_accelerator(stwidgets.vmode3dcombo, "grab_focus", stwidgets.accel_group, gtk_widget_add_accelerator(stwidgets.vmode3dcombo, "grab_focus", stwidgets.accel_group,
GDK_3, GDK_MOD1_MASK, GDK_3, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE); GTK_ACCEL_VISIBLE);
// Empty horizontal layout // Empty horizontal layout
stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0); stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,1, 2,3, (GtkAttachOptions)0, gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,1, 2,3, (GtkAttachOptions)0,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0); (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
// Always show config checkbox // Always show config checkbox

View file

@ -43,7 +43,7 @@ static pthtyp *texcache_tryart(int32_t const dapicnum, int32_t const dapalnum, i
// load from art // load from art
for (pth=texcache.list[j]; pth; pth=pth->next) for (pth=texcache.list[j]; pth; pth=pth->next)
if (pth->picnum == dapicnum && pth->palnum == dapalnum && pth->shade == dashade && if (pth->picnum == dapicnum && pth->palnum == dapalnum && pth->shade == dashade &&
(pth->flags & (PTH_CLAMPED | PTH_HIGHTILE | PTH_NOTRANSFIX)) == (pth->flags & (PTH_CLAMPED | PTH_HIGHTILE | PTH_NOTRANSFIX)) ==
(TO_PTH_CLAMPED(dameth) | TO_PTH_NOTRANSFIX(dameth)) && (TO_PTH_CLAMPED(dameth) | TO_PTH_NOTRANSFIX(dameth)) &&
polymost_want_npotytex(dameth, tilesiz[dapicnum].y) == !!(pth->flags&PTH_NPOTWALL) polymost_want_npotytex(dameth, tilesiz[dapicnum].y) == !!(pth->flags&PTH_NPOTWALL)
@ -454,7 +454,7 @@ char const * texcache_calcid(char *cachefn, const char *fn, const int32_t len, c
XXH32((uint8_t *)id.name, fnlen, TEXCACHEMAGIC[3]), XXH32((uint8_t *)id.name, fnlen, TEXCACHEMAGIC[3]),
XXH32((uint8_t *)id.name, Bstrlen(id.name), TEXCACHEMAGIC[3]), XXH32((uint8_t *)id.name, Bstrlen(id.name), TEXCACHEMAGIC[3]),
XXH32((uint8_t *)&id, sizeof(struct texcacheid_t), TEXCACHEMAGIC[3])); XXH32((uint8_t *)&id, sizeof(struct texcacheid_t), TEXCACHEMAGIC[3]));
return cachefn; return cachefn;
} }

View file

@ -69,7 +69,7 @@ print "Creating highpalookup map %s for palette %d with depth %d:%d:%d..." % (sy
for k in range(zdim): for k in range(zdim):
for j in range(ydim): for j in range(ydim):
for i in range(xdim): for i in range(xdim):
rgb = [float(i) / (xdim - 1), float(j) / (ydim - 1), float(k) / (zdim - 1)] rgb = [float(i) / (xdim - 1), float(j) / (ydim - 1), float(k) / (zdim - 1)]
rgb = makehighpalookuppixel(palnum, rgb) rgb = makehighpalookuppixel(palnum, rgb)
# save as BGRA as that's what TGA uses # save as BGRA as that's what TGA uses
pixels.append(struct.pack('BBBB', int(rgb[2] * 255), int(rgb[1] * 255), int(rgb[0] * 255), 255)) pixels.append(struct.pack('BBBB', int(rgb[2] * 255), int(rgb[1] * 255), int(rgb[0] * 255), 255))

View file

@ -38,7 +38,7 @@ import types
import textwrap import textwrap
import logging import logging
reload(logging) reload(logging)
import sys, struct, string, math import sys, struct, string, math
@ -76,14 +76,14 @@ class md3Vert:
xyz = [] xyz = []
normal = 0 normal = 0
binaryFormat = "<3hh" binaryFormat = "<3hh"
def __init__(self): def __init__(self):
self.xyz = [0, 0, 0] self.xyz = [0, 0, 0]
self.normal = 0 self.normal = 0
def GetSize(self): def GetSize(self):
return struct.calcsize(self.binaryFormat) return struct.calcsize(self.binaryFormat)
# copied from PhaethonH <phaethon@linux.ucla.edu> md3.py # copied from PhaethonH <phaethon@linux.ucla.edu> md3.py
def Decode(self, latlng): def Decode(self, latlng):
lat = (latlng >> 8) & 0xFF; lat = (latlng >> 8) & 0xFF;
@ -95,11 +95,11 @@ class md3Vert:
z = math.cos(lng) z = math.cos(lng)
retval = [ x, y, z ] retval = [ x, y, z ]
return retval return retval
# copied from PhaethonH <phaethon@linux.ucla.edu> md3.py # copied from PhaethonH <phaethon@linux.ucla.edu> md3.py
def Encode(self, normal): def Encode(self, normal):
x, y, z = normal x, y, z = normal
# normalise # normalise
l = math.sqrt((x*x) + (y*y) + (z*z)) l = math.sqrt((x*x) + (y*y) + (z*z))
if l == 0: if l == 0:
@ -107,13 +107,13 @@ class md3Vert:
x = x/l x = x/l
y = y/l y = y/l
z = z/l z = z/l
if (x == 0.0) & (y == 0.0) : if (x == 0.0) & (y == 0.0) :
if z > 0.0: if z > 0.0:
return 0 return 0
else: else:
return (128 << 8) return (128 << 8)
# Encode a normal vector into a 16-bit latitude-longitude value # Encode a normal vector into a 16-bit latitude-longitude value
#lng = math.acos(z) #lng = math.acos(z)
#lat = math.acos(x / math.sin(lng)) #lat = math.acos(x / math.sin(lng))
@ -122,7 +122,7 @@ class md3Vert:
lat = math.atan2(y, x) * 255 / (2 * math.pi) lat = math.atan2(y, x) * 255 / (2 * math.pi)
retval = ((int(lat) & 0xFF) << 8) | (int(lng) & 0xFF) retval = ((int(lat) & 0xFF) << 8) | (int(lng) & 0xFF)
return retval return retval
def Load(self, file): def Load(self, file):
tmpData = file.read(struct.calcsize(self.binaryFormat)) tmpData = file.read(struct.calcsize(self.binaryFormat))
data = struct.unpack(self.binaryFormat, tmpData) data = struct.unpack(self.binaryFormat, tmpData)
@ -131,7 +131,7 @@ class md3Vert:
self.xyz[2] = data[2] * MD3_XYZ_SCALE self.xyz[2] = data[2] * MD3_XYZ_SCALE
self.normal = data[3] self.normal = data[3]
return self return self
def Save(self, file): def Save(self, file):
tmpData = [0] * 4 tmpData = [0] * 4
tmpData[0] = self.xyz[0] / MD3_XYZ_SCALE tmpData[0] = self.xyz[0] / MD3_XYZ_SCALE
@ -141,7 +141,7 @@ class md3Vert:
data = struct.pack(self.binaryFormat, tmpData[0], tmpData[1], tmpData[2], tmpData[3]) data = struct.pack(self.binaryFormat, tmpData[0], tmpData[1], tmpData[2], tmpData[3])
file.write(data) file.write(data)
#print "Wrote MD3 Vertex: ", data #print "Wrote MD3 Vertex: ", data
def Dump(self): def Dump(self):
log.info("MD3 Vertex") log.info("MD3 Vertex")
log.info("X: %s", self.xyz[0]) log.info("X: %s", self.xyz[0])
@ -149,7 +149,7 @@ class md3Vert:
log.info("Z: %s", self.xyz[2]) log.info("Z: %s", self.xyz[2])
log.info("Normal: %s", self.normal) log.info("Normal: %s", self.normal)
log.info("") log.info("")
class md3TexCoord: class md3TexCoord:
u = 0.0 u = 0.0
v = 0.0 v = 0.0
@ -159,7 +159,7 @@ class md3TexCoord:
def __init__(self): def __init__(self):
self.u = 0.0 self.u = 0.0
self.v = 0.0 self.v = 0.0
def GetSize(self): def GetSize(self):
return struct.calcsize(self.binaryFormat) return struct.calcsize(self.binaryFormat)
@ -184,7 +184,7 @@ class md3TexCoord:
log.info("U: %s", self.u) log.info("U: %s", self.u)
log.info("V: %s", self.v) log.info("V: %s", self.v)
log.info("") log.info("")
class md3Triangle: class md3Triangle:
indexes = [] indexes = []
@ -193,7 +193,7 @@ class md3Triangle:
def __init__(self): def __init__(self):
self.indexes = [ 0, 0, 0 ] self.indexes = [ 0, 0, 0 ]
def GetSize(self): def GetSize(self):
return struct.calcsize(self.binaryFormat) return struct.calcsize(self.binaryFormat)
@ -223,13 +223,13 @@ class md3Triangle:
class md3Shader: class md3Shader:
name = "" name = ""
index = 0 index = 0
binaryFormat = "<%dsi" % MAX_QPATH binaryFormat = "<%dsi" % MAX_QPATH
def __init__(self): def __init__(self):
self.name = "" self.name = ""
self.index = 0 self.index = 0
def GetSize(self): def GetSize(self):
return struct.calcsize(self.binaryFormat) return struct.calcsize(self.binaryFormat)
@ -272,9 +272,9 @@ class md3Surface:
triangles = [] triangles = []
uv = [] uv = []
verts = [] verts = []
binaryFormat = "<4s%ds10i" % MAX_QPATH # 1 int, name, then 10 ints binaryFormat = "<4s%ds10i" % MAX_QPATH # 1 int, name, then 10 ints
def __init__(self): def __init__(self):
self.ident = "" self.ident = ""
self.name = "" self.name = ""
@ -292,7 +292,7 @@ class md3Surface:
self.triangles = [] self.triangles = []
self.uv = [] self.uv = []
self.verts = [] self.verts = []
def GetSize(self): def GetSize(self):
sz = struct.calcsize(self.binaryFormat) sz = struct.calcsize(self.binaryFormat)
self.ofsTriangles = sz self.ofsTriangles = sz
@ -309,7 +309,7 @@ class md3Surface:
sz += v.GetSize() sz += v.GetSize()
self.ofsEnd = sz self.ofsEnd = sz
return self.ofsEnd return self.ofsEnd
def Load(self, file, log): def Load(self, file, log):
# where are we in the file (for calculating real offsets) # where are we in the file (for calculating real offsets)
ofsBegin = file.tell() ofsBegin = file.tell()
@ -327,28 +327,28 @@ class md3Surface:
self.ofsUV = data[9] self.ofsUV = data[9]
self.ofsVerts = data[10] self.ofsVerts = data[10]
self.ofsEnd = data[11] self.ofsEnd = data[11]
# load the tri info # load the tri info
file.seek(ofsBegin + self.ofsTriangles, 0) file.seek(ofsBegin + self.ofsTriangles, 0)
for i in range(0, self.numTriangles): for i in range(0, self.numTriangles):
self.triangles.append(md3Triangle()) self.triangles.append(md3Triangle())
self.triangles[i].Load(file) self.triangles[i].Load(file)
#self.triangles[i].Dump(log) #self.triangles[i].Dump(log)
# load the shader info # load the shader info
file.seek(ofsBegin + self.ofsShaders, 0) file.seek(ofsBegin + self.ofsShaders, 0)
for i in range(0, self.numShaders): for i in range(0, self.numShaders):
self.shaders.append(md3Shader()) self.shaders.append(md3Shader())
self.shaders[i].Load(file) self.shaders[i].Load(file)
#self.shaders[i].Dump(log) #self.shaders[i].Dump(log)
# load the uv info # load the uv info
file.seek(ofsBegin + self.ofsUV, 0) file.seek(ofsBegin + self.ofsUV, 0)
for i in range(0, self.numVerts): for i in range(0, self.numVerts):
self.uv.append(md3TexCoord()) self.uv.append(md3TexCoord())
self.uv[i].Load(file) self.uv[i].Load(file)
#self.uv[i].Dump(log) #self.uv[i].Dump(log)
# load the verts info # load the verts info
file.seek(ofsBegin + self.ofsVerts, 0) file.seek(ofsBegin + self.ofsVerts, 0)
for i in range(0, self.numFrames): for i in range(0, self.numFrames):
@ -357,12 +357,12 @@ class md3Surface:
#i*self.numVerts+j=where in the surface vertex list the vert position for this frame is #i*self.numVerts+j=where in the surface vertex list the vert position for this frame is
self.verts[(i * self.numVerts) + j].Load(file) self.verts[(i * self.numVerts) + j].Load(file)
#self.verts[j].Dump(log) #self.verts[j].Dump(log)
# go to the end of this structure # go to the end of this structure
file.seek(ofsBegin+self.ofsEnd, 0) file.seek(ofsBegin+self.ofsEnd, 0)
return self return self
def Save(self, file): def Save(self, file):
self.GetSize() self.GetSize()
tmpData = [0] * 12 tmpData = [0] * 12
@ -412,23 +412,23 @@ class md3Surface:
log.info("Offset to Verts: %s", self.ofsVerts) log.info("Offset to Verts: %s", self.ofsVerts)
log.info("Offset to end: %s", self.ofsEnd) log.info("Offset to end: %s", self.ofsEnd)
log.info("") log.info("")
class md3Tag: class md3Tag:
name = "" name = ""
origin = [] origin = []
axis = [] axis = []
binaryFormat="<%ds3f9f" % MAX_QPATH binaryFormat="<%ds3f9f" % MAX_QPATH
def __init__(self): def __init__(self):
self.name = "" self.name = ""
self.origin = [0, 0, 0] self.origin = [0, 0, 0]
self.axis = [0, 0, 0, 0, 0, 0, 0, 0, 0] self.axis = [0, 0, 0, 0, 0, 0, 0, 0, 0]
def GetSize(self): def GetSize(self):
return struct.calcsize(self.binaryFormat) return struct.calcsize(self.binaryFormat)
def Load(self, file): def Load(self, file):
tmpData = file.read(struct.calcsize(self.binaryFormat)) tmpData = file.read(struct.calcsize(self.binaryFormat))
data = struct.unpack(self.binaryFormat, tmpData) data = struct.unpack(self.binaryFormat, tmpData)
@ -446,7 +446,7 @@ class md3Tag:
self.axis[7] = data[11] self.axis[7] = data[11]
self.axis[8] = data[12] self.axis[8] = data[12]
return self return self
def Save(self, file): def Save(self, file):
tmpData = [0] * 13 tmpData = [0] * 13
tmpData[0] = self.name tmpData[0] = self.name
@ -465,30 +465,30 @@ class md3Tag:
data = struct.pack(self.binaryFormat, tmpData[0],tmpData[1],tmpData[2],tmpData[3],tmpData[4],tmpData[5],tmpData[6], tmpData[7], tmpData[8], tmpData[9], tmpData[10], tmpData[11], tmpData[12]) data = struct.pack(self.binaryFormat, tmpData[0],tmpData[1],tmpData[2],tmpData[3],tmpData[4],tmpData[5],tmpData[6], tmpData[7], tmpData[8], tmpData[9], tmpData[10], tmpData[11], tmpData[12])
file.write(data) file.write(data)
#print "wrote MD3 Tag structure: ",data #print "wrote MD3 Tag structure: ",data
def Dump(self, log): def Dump(self, log):
log.info("MD3 Tag") log.info("MD3 Tag")
log.info("Name: %s", self.name) log.info("Name: %s", self.name)
log.info("Origin: %s", self.origin) log.info("Origin: %s", self.origin)
log.info("Axis: %s", self.axis) log.info("Axis: %s", self.axis)
log.info("") log.info("")
class md3Frame: class md3Frame:
mins = 0 mins = 0
maxs = 0 maxs = 0
localOrigin = 0 localOrigin = 0
radius = 0.0 radius = 0.0
name = "" name = ""
binaryFormat="<3f3f3ff16s" binaryFormat="<3f3f3ff16s"
def __init__(self): def __init__(self):
self.mins = [0, 0, 0] self.mins = [0, 0, 0]
self.maxs = [0, 0, 0] self.maxs = [0, 0, 0]
self.localOrigin = [0, 0, 0] self.localOrigin = [0, 0, 0]
self.radius = 0.0 self.radius = 0.0
self.name = "" self.name = ""
def GetSize(self): def GetSize(self):
return struct.calcsize(self.binaryFormat) return struct.calcsize(self.binaryFormat)
@ -614,7 +614,7 @@ class md3Object:
self.frames.append(md3Frame()) self.frames.append(md3Frame())
self.frames[i].Load(file) self.frames[i].Load(file)
#self.frames[i].Dump(log) #self.frames[i].Dump(log)
# load the tags info # load the tags info
file.seek(self.ofsTags, 0) file.seek(self.ofsTags, 0)
for i in range(0, self.numFrames): for i in range(0, self.numFrames):
@ -623,7 +623,7 @@ class md3Object:
tag.Load(file) tag.Load(file)
#tag.Dump(log) #tag.Dump(log)
self.tags.append(tag) self.tags.append(tag)
# load the surface info # load the surface info
file.seek(self.ofsSurfaces, 0) file.seek(self.ofsSurfaces, 0)
for i in range(0, self.numSurfaces): for i in range(0, self.numSurfaces):
@ -653,10 +653,10 @@ class md3Object:
for f in self.frames: for f in self.frames:
f.Save(file) f.Save(file)
for t in self.tags: for t in self.tags:
t.Save(file) t.Save(file)
for s in self.surfaces: for s in self.surfaces:
s.Save(file) s.Save(file)
@ -689,7 +689,7 @@ def StripPath(path):
path = path[c:] path = path[c:]
break break
return path return path
# strips the model from path # strips the model from path
def StripModel(path): def StripModel(path):
for c in range(len(path), 0, -1): for c in range(len(path), 0, -1):
@ -708,7 +708,7 @@ def StripExtension(name):
best = n best = n
name = name[0:best] name = name[0:best]
return name return name
# strips gamedir # strips gamedir
def StripGamePath(name): def StripGamePath(name):
gamepath = GAMEDIR.replace( '\\', '/' ) gamepath = GAMEDIR.replace( '\\', '/' )
@ -760,7 +760,7 @@ def RadiusFromBounds(mins, maxs):
corner = [0, 0, 0] corner = [0, 0, 0]
a = 0 a = 0
b = 0 b = 0
for i in range(0, 3): for i in range(0, 3):
a = abs(mins[i]) a = abs(mins[i])
b = abs(maxs[i]) b = abs(maxs[i])
@ -788,17 +788,17 @@ def MatrixFromAngles(pitch, yaw, roll):
sr = math.sin(DEG2RAD(roll)) sr = math.sin(DEG2RAD(roll))
cr = math.cos(DEG2RAD(roll)) cr = math.cos(DEG2RAD(roll))
# return [[cp * cy, (sr * sp * cy + cr * -sy), (cr * sp * cy + -sr * -sy), 0.0], # return [[cp * cy, (sr * sp * cy + cr * -sy), (cr * sp * cy + -sr * -sy), 0.0],
# [cp * sy, (sr * sp * sy + cr * cy), (cr * sp * sy + -sr * cy), 0.0], # [cp * sy, (sr * sp * sy + cr * cy), (cr * sp * sy + -sr * cy), 0.0],
# [-sp, sr * cp, cr * cp, 0.0], # [-sp, sr * cp, cr * cp, 0.0],
# [0.0, 0.0, 0.0, 1.0]] # [0.0, 0.0, 0.0, 1.0]]
return [[cp * cy, cp * sy, -sp, 0.0], return [[cp * cy, cp * sy, -sp, 0.0],
[(sr * sp * cy + cr * -sy), (sr * sp * sy + cr * cy), sr * cp, 0.0], [(sr * sp * cy + cr * -sy), (sr * sp * sy + cr * cy), sr * cp, 0.0],
[(cr * sp * cy + -sr * -sy), (cr * sp * sy + -sr * cy), cr * cp, 0.0], [(cr * sp * cy + -sr * -sy), (cr * sp * sy + -sr * cy), cr * cp, 0.0],
[0.0, 0.0, 0.0, 1.0]] [0.0, 0.0, 0.0, 1.0]]
def MatrixTransformPoint(m, p): def MatrixTransformPoint(m, p):
return [m[0][0] * p[0] + m[1][0] * p[1] + m[2][0] * p[2] + m[3][0], return [m[0][0] * p[0] + m[1][0] * p[1] + m[2][0] * p[2] + m[3][0],
m[0][1] * p[0] + m[1][1] * p[1] + m[2][1] * p[2] + m[3][1], m[0][1] * p[0] + m[1][1] * p[1] + m[2][1] * p[2] + m[3][1],
@ -809,7 +809,7 @@ def MatrixTransformNormal(m, p):
return [m[0][0] * p[0] + m[1][0] * p[1] + m[2][0] * p[2], return [m[0][0] * p[0] + m[1][0] * p[1] + m[2][0] * p[2],
m[0][1] * p[0] + m[1][1] * p[1] + m[2][1] * p[2], m[0][1] * p[0] + m[1][1] * p[1] + m[2][1] * p[2],
m[0][2] * p[0] + m[1][2] * p[1] + m[2][2] * p[2]] m[0][2] * p[0] + m[1][2] * p[1] + m[2][2] * p[2]]
def MatrixMultiply(b, a): def MatrixMultiply(b, a):
return [[ return [[
a[0][0] * b[0][0] + a[0][1] * b[1][0] + a[0][2] * b[2][0], a[0][0] * b[0][0] + a[0][1] * b[1][0] + a[0][2] * b[2][0],
@ -832,7 +832,7 @@ def MatrixMultiply(b, a):
a[3][0] * b[0][2] + a[3][1] * b[1][2] + a[3][2] * b[2][2] + b[3][2], a[3][0] * b[0][2] + a[3][1] * b[1][2] + a[3][2] * b[2][2] + b[3][2],
1.0, 1.0,
]] ]]
def MatrixSetupTransform(forward, left, up, origin): def MatrixSetupTransform(forward, left, up, origin):
return [[forward[0], forward[1], forward[2], origin[0]], return [[forward[0], forward[1], forward[2], origin[0]],
[left[0], left[1], left[2], origin[1]], [left[0], left[1], left[2], origin[1]],
@ -840,54 +840,54 @@ def MatrixSetupTransform(forward, left, up, origin):
[0.0, 0.0, 0.0, 1.0]] [0.0, 0.0, 0.0, 1.0]]
# our own logger class. it works just the same as a normal logger except # our own logger class. it works just the same as a normal logger except
# all info messages get show. # all info messages get show.
class Logger(logging.Logger): class Logger(logging.Logger):
def __init__(self, name,level = logging.NOTSET): def __init__(self, name,level = logging.NOTSET):
logging.Logger.__init__(self, name, level) logging.Logger.__init__(self, name, level)
self.has_warnings = False self.has_warnings = False
self.has_errors = False self.has_errors = False
self.has_critical = False self.has_critical = False
def info(self, msg, *args, **kwargs): def info(self, msg, *args, **kwargs):
apply(self._log,(logging.INFO, msg, args), kwargs) apply(self._log,(logging.INFO, msg, args), kwargs)
def warning(self, msg, *args, **kwargs): def warning(self, msg, *args, **kwargs):
logging.Logger.warning(self, msg, *args, **kwargs) logging.Logger.warning(self, msg, *args, **kwargs)
self.has_warnings = True self.has_warnings = True
def error(self, msg, *args, **kwargs): def error(self, msg, *args, **kwargs):
logging.Logger.error(self, msg, *args, **kwargs) logging.Logger.error(self, msg, *args, **kwargs)
self.has_errors = True self.has_errors = True
def critical(self, msg, *args, **kwargs): def critical(self, msg, *args, **kwargs):
logging.Logger.critical(self, msg, *args, **kwargs) logging.Logger.critical(self, msg, *args, **kwargs)
self.has_errors = True self.has_errors = True
# should be able to make this print to stdout in realtime and save MESSAGES # should be able to make this print to stdout in realtime and save MESSAGES
# as well. perhaps also have a log to file option # as well. perhaps also have a log to file option
class LogHandler(logging.StreamHandler): class LogHandler(logging.StreamHandler):
def __init__(self): def __init__(self):
logging.StreamHandler.__init__(self, sys.stdout) logging.StreamHandler.__init__(self, sys.stdout)
if "md3_export_log" not in Blender.Text.Get(): if "md3_export_log" not in Blender.Text.Get():
self.outtext = Blender.Text.New("md3_export_log") self.outtext = Blender.Text.New("md3_export_log")
else: else:
self.outtext = Blender.Text.Get('md3_export_log') self.outtext = Blender.Text.Get('md3_export_log')
self.outtext.clear() self.outtext.clear()
self.lastmsg = '' self.lastmsg = ''
def emit(self, record): def emit(self, record):
# print to stdout and to a new blender text object # print to stdout and to a new blender text object
msg = self.format(record) msg = self.format(record)
if msg == self.lastmsg: if msg == self.lastmsg:
return return
self.lastmsg = msg self.lastmsg = msg
self.outtext.write("%s\n" %msg) self.outtext.write("%s\n" %msg)
logging.StreamHandler.emit(self, record) logging.StreamHandler.emit(self, record)
logging.setLoggerClass(Logger) logging.setLoggerClass(Logger)
@ -899,50 +899,50 @@ handler.setFormatter(formatter)
log.addHandler(handler) log.addHandler(handler)
# set this to minimum output level. eg. logging.DEBUG, logging.WARNING, logging.ERROR # set this to minimum output level. eg. logging.DEBUG, logging.WARNING, logging.ERROR
# logging.CRITICAL. logging.INFO will make little difference as these always get # logging.CRITICAL. logging.INFO will make little difference as these always get
# output'd # output'd
log.setLevel(logging.WARNING) log.setLevel(logging.WARNING)
class BlenderGui: class BlenderGui:
def __init__(self): def __init__(self):
text = """A log has been written to a blender text window. Change this window type to text = """A log has been written to a blender text window. Change this window type to
a text window and you will be able to select the file md3_export_log.""" a text window and you will be able to select the file md3_export_log."""
text = textwrap.wrap(text,40) text = textwrap.wrap(text,40)
text += [''] text += ['']
if log.has_critical: if log.has_critical:
text += ['There were critical errors!!!!'] text += ['There were critical errors!!!!']
elif log.has_errors: elif log.has_errors:
text += ['There were errors!'] text += ['There were errors!']
elif log.has_warnings: elif log.has_warnings:
text += ['There were warnings'] text += ['There were warnings']
# add any more text before here # add any more text before here
text.reverse() text.reverse()
self.msg = text self.msg = text
Blender.Draw.Register(self.gui, self.event, self.button_event) Blender.Draw.Register(self.gui, self.event, self.button_event)
def gui(self,): def gui(self,):
quitbutton = Blender.Draw.Button("Exit", 1, 0, 0, 100, 20, "Close Window") quitbutton = Blender.Draw.Button("Exit", 1, 0, 0, 100, 20, "Close Window")
y = 35 y = 35
for line in self.msg: for line in self.msg:
BGL.glRasterPos2i(10,y) BGL.glRasterPos2i(10,y)
Blender.Draw.Text(line) Blender.Draw.Text(line)
y+=15 y+=15
def event(self,evt, val): def event(self,evt, val):
if evt == Blender.Draw.ESCKEY: if evt == Blender.Draw.ESCKEY:
Blender.Draw.Exit() Blender.Draw.Exit()
return return
def button_event(self,evt): def button_event(self,evt):
if evt == 1: if evt == 1:
Blender.Draw.Exit() Blender.Draw.Exit()
@ -988,12 +988,12 @@ def ProcessSurface(scene, blenderObject, md3, pathName, modelName):
surf.numFrames = md3.numFrames surf.numFrames = md3.numFrames
surf.name = blenderObject.getName() surf.name = blenderObject.getName()
surf.ident = MD3_IDENT surf.ident = MD3_IDENT
# create shader for surface # create shader for surface
surf.shaders.append(md3Shader()) surf.shaders.append(md3Shader())
surf.numShaders += 1 surf.numShaders += 1
surf.shaders[0].index = 0 surf.shaders[0].index = 0
log.info("Materials: %s", mesh.materials) log.info("Materials: %s", mesh.materials)
# :P # :P
#shaderpath=Blender.Draw.PupStrInput("shader path for "+blenderObject.name+":", "", MAX_QPATH ) #shaderpath=Blender.Draw.PupStrInput("shader path for "+blenderObject.name+":", "", MAX_QPATH )
@ -1011,13 +1011,13 @@ def ProcessSurface(scene, blenderObject, md3, pathName, modelName):
# process each face in the mesh # process each face in the mesh
for face in mesh.faces: for face in mesh.faces:
tris_in_this_face = [] #to handle quads and up... tris_in_this_face = [] #to handle quads and up...
# this makes a list of indices for each tri in this face. a quad will be [[0,1,1],[0,2,3]] # this makes a list of indices for each tri in this face. a quad will be [[0,1,1],[0,2,3]]
for vi in range(1, len(face.v)-1): for vi in range(1, len(face.v)-1):
tris_in_this_face.append([0, vi, vi + 1]) tris_in_this_face.append([0, vi, vi + 1])
# loop across each tri in the face, then each vertex in the tri # loop across each tri in the face, then each vertex in the tri
for this_tri in tris_in_this_face: for this_tri in tris_in_this_face:
numFaces += 1 numFaces += 1
@ -1032,19 +1032,19 @@ def ProcessSurface(scene, blenderObject, md3, pathName, modelName):
elif mesh.vertexUV: elif mesh.vertexUV:
uv = (face.v[i].uvco[0], face.v[i].uvco[1]) uv = (face.v[i].uvco[0], face.v[i].uvco[1])
else: else:
uv = (0.0, 0.0) # handle case with no tex coords uv = (0.0, 0.0) # handle case with no tex coords
if vertDict.has_key((index, uv)): if vertDict.has_key((index, uv)):
# if we've seen this exact vertex before, simply add it # if we've seen this exact vertex before, simply add it
# to the tris list of vertex indices # to the tris list of vertex indices
tri.indexes[tri_ind] = vertDict[(index, uv)] tri.indexes[tri_ind] = vertDict[(index, uv)]
else: else:
# havent seen this tri before # havent seen this tri before
# (or its uv coord is different, so we need to duplicate it) # (or its uv coord is different, so we need to duplicate it)
vertDict[(index, uv)] = numVerts vertDict[(index, uv)] = numVerts
# put the uv coord into the list # put the uv coord into the list
# (uv coord are directly related to each vertex) # (uv coord are directly related to each vertex)
tex = md3TexCoord() tex = md3TexCoord()
@ -1054,11 +1054,11 @@ def ProcessSurface(scene, blenderObject, md3, pathName, modelName):
tri.indexes[tri_ind] = numVerts tri.indexes[tri_ind] = numVerts
# now because we have created a new index, # now because we have created a new index,
# we need a way to link it to the index that # we need a way to link it to the index that
# blender returns for NMVert.index # blender returns for NMVert.index
if indexDict.has_key(index): if indexDict.has_key(index):
# already there - each of the entries against # already there - each of the entries against
# this key represents the same vertex with a # this key represents the same vertex with a
# different uv value # different uv value
ilist = indexDict[index] ilist = indexDict[index]
@ -1124,23 +1124,23 @@ def ProcessSurface(scene, blenderObject, md3, pathName, modelName):
def Export(fileName): def Export(fileName):
if(fileName.find('.md3', -4) <= 0): if(fileName.find('.md3', -4) <= 0):
fileName += '.md3' fileName += '.md3'
log.info("Starting ...") log.info("Starting ...")
log.info("Exporting MD3 format to: %s", fileName) log.info("Exporting MD3 format to: %s", fileName)
pathName = StripGamePath(StripModel(fileName)) pathName = StripGamePath(StripModel(fileName))
log.info("Shader path name: %s", pathName) log.info("Shader path name: %s", pathName)
modelName = StripExtension(StripPath(fileName)) modelName = StripExtension(StripPath(fileName))
log.info("Model name: %s", modelName) log.info("Model name: %s", modelName)
md3 = md3Object() md3 = md3Object()
md3.ident = MD3_IDENT md3.ident = MD3_IDENT
md3.version = MD3_VERSION md3.version = MD3_VERSION
tagList = [] tagList = []
# get the scene # get the scene
scene = Blender.Scene.getCurrent() scene = Blender.Scene.getCurrent()
context = scene.getRenderingContext() context = scene.getRenderingContext()
@ -1175,10 +1175,10 @@ def Export(fileName):
else: else:
log.info("Skipping object: %s", obj.name) log.info("Skipping object: %s", obj.name)
# work out the transforms for the tags for each frame of the export # work out the transforms for the tags for each frame of the export
for i in range(1, md3.numFrames + 1): for i in range(1, md3.numFrames + 1):
# needed to update IPO's value, but probably not the best way for that... # needed to update IPO's value, but probably not the best way for that...
scene.makeCurrent() scene.makeCurrent()
Blender.Set("curframe", i) Blender.Set("curframe", i)
@ -1189,15 +1189,15 @@ def Export(fileName):
t.origin[0] = matrix[3][0] t.origin[0] = matrix[3][0]
t.origin[1] = matrix[3][1] t.origin[1] = matrix[3][1]
t.origin[2] = matrix[3][2] t.origin[2] = matrix[3][2]
t.axis[0] = matrix[0][0] t.axis[0] = matrix[0][0]
t.axis[1] = matrix[0][1] t.axis[1] = matrix[0][1]
t.axis[2] = matrix[0][2] t.axis[2] = matrix[0][2]
t.axis[3] = matrix[1][0] t.axis[3] = matrix[1][0]
t.axis[4] = matrix[1][1] t.axis[4] = matrix[1][1]
t.axis[5] = matrix[1][2] t.axis[5] = matrix[1][2]
t.axis[6] = matrix[2][0] t.axis[6] = matrix[2][0]
t.axis[7] = matrix[2][1] t.axis[7] = matrix[2][1]
t.axis[8] = matrix[2][2] t.axis[8] = matrix[2][2]
@ -1213,7 +1213,7 @@ def Export(fileName):
def FileSelectorCallback(fileName): def FileSelectorCallback(fileName):
Export(fileName) Export(fileName)
BlenderGui() BlenderGui()
Blender.Window.FileSelector(FileSelectorCallback, "Export Quake3 MD3") Blender.Window.FileSelector(FileSelectorCallback, "Export Quake3 MD3")

View file

@ -1068,7 +1068,7 @@ static BOOL InitDirectInput(void)
// initprintf(" - Creating %s device\n", devicedef.name); // initprintf(" - Creating %s device\n", devicedef.name);
result = IDirectInput7_CreateDeviceEx(lpDI, bREFGUID guidDevs, bREFIID IID_IDirectInputDevice7, (LPVOID *)&dev, NULL); result = IDirectInput7_CreateDeviceEx(lpDI, bREFGUID guidDevs, bREFIID IID_IDirectInputDevice7, (LPVOID *)&dev, NULL);
if (FAILED(result)) { HorribleDInputDeath("Failed creating device", result); } if (FAILED(result)) { HorribleDInputDeath("Failed creating device", result); }
else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result)); else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result));

View file

@ -559,6 +559,6 @@ Foreground colors:
^8 8 ^9 9 ^10 10^11 11^12 12^13 13^14 14^15 15 ^8 8 ^9 9 ^10 10^11 11^12 12^13 13^14 14^15 15
Background colors: Background colors:
^15,0 0 ^0,1 1 ^0,2 2 ^0,3 3 ^0,4 4 ^0,5 5 ^0,6 6 ^0,7 7 ^15,0 0 ^0,1 1 ^0,2 2 ^0,3 3 ^0,4 4 ^0,5 5 ^0,6 6 ^0,7 7
^0,8 8 ^0,9 9 ^0,10 10^0,11 11^0,12 12^0,13 13^0,14 14^0,15 15 ^0,8 8 ^0,9 9 ^0,10 10^0,11 11^0,12 12^0,13 13^0,14 14^0,15 15

View file

@ -308,7 +308,7 @@ extern "C" {
typedef DWORD64 (WINAPI *PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess,DWORD64 Address); typedef DWORD64 (WINAPI *PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess,DWORD64 Address);
typedef DWORD64 (WINAPI *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,HANDLE hThread,LPADDRESS64 lpaddr); typedef DWORD64 (WINAPI *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,HANDLE hThread,LPADDRESS64 lpaddr);
WINBOOL IMAGEAPI StackWalk64(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME64 StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE64 WINBOOL IMAGEAPI StackWalk64(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME64 StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE64
GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress); GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
#ifdef _IMAGEHLP64 #ifdef _IMAGEHLP64
@ -323,7 +323,7 @@ GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress);
typedef DWORD (WINAPI *PGET_MODULE_BASE_ROUTINE)(HANDLE hProcess,DWORD Address); typedef DWORD (WINAPI *PGET_MODULE_BASE_ROUTINE)(HANDLE hProcess,DWORD Address);
typedef DWORD (WINAPI *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE hProcess,HANDLE hThread,LPADDRESS lpaddr); typedef DWORD (WINAPI *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE hProcess,HANDLE hThread,LPADDRESS lpaddr);
WINBOOL IMAGEAPI StackWalk(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE WINBOOL IMAGEAPI StackWalk(DWORD MachineType,HANDLE hProcess,HANDLE hThread,LPSTACKFRAME StackFrame,PVOID ContextRecord,PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,PGET_MODULE_BASE_ROUTINE
GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE TranslateAddress); GetModuleBaseRoutine,PTRANSLATE_ADDRESS_ROUTINE TranslateAddress);
#endif #endif

View file

@ -21,17 +21,17 @@ DEFINE_GUID(CLSID_CDirect3DRMAnimation, 0x4fa35698, 0x623f, 0x11cf, 0xac, 0x
DEFINE_GUID(CLSID_CDirect3DRMAnimationSet, 0x4fa35699, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); DEFINE_GUID(CLSID_CDirect3DRMAnimationSet, 0x4fa35699, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1);
DEFINE_GUID(CLSID_CDirect3DRMUserVisual, 0x4fa3569a, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); DEFINE_GUID(CLSID_CDirect3DRMUserVisual, 0x4fa3569a, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1);
DEFINE_GUID(CLSID_CDirect3DRMShadow, 0x4fa3569b, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1); DEFINE_GUID(CLSID_CDirect3DRMShadow, 0x4fa3569b, 0x623f, 0x11cf, 0xac, 0x4a, 0x0, 0x0, 0xc0, 0x38, 0x25, 0xa1);
DEFINE_GUID(CLSID_CDirect3DRMViewportInterpolator, DEFINE_GUID(CLSID_CDirect3DRMViewportInterpolator,
0xde9eaa1, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); 0xde9eaa1, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(CLSID_CDirect3DRMFrameInterpolator, DEFINE_GUID(CLSID_CDirect3DRMFrameInterpolator,
0xde9eaa2, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); 0xde9eaa2, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(CLSID_CDirect3DRMMeshInterpolator, DEFINE_GUID(CLSID_CDirect3DRMMeshInterpolator,
0xde9eaa3, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); 0xde9eaa3, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(CLSID_CDirect3DRMLightInterpolator, DEFINE_GUID(CLSID_CDirect3DRMLightInterpolator,
0xde9eaa6, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); 0xde9eaa6, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(CLSID_CDirect3DRMMaterialInterpolator, DEFINE_GUID(CLSID_CDirect3DRMMaterialInterpolator,
0xde9eaa7, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); 0xde9eaa7, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(CLSID_CDirect3DRMTextureInterpolator, DEFINE_GUID(CLSID_CDirect3DRMTextureInterpolator,
0xde9eaa8, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3); 0xde9eaa8, 0x3b84, 0x11d0, 0x9b, 0x6d, 0x0, 0x0, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(CLSID_CDirect3DRMProgressiveMesh, 0x4516ec40, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3); DEFINE_GUID(CLSID_CDirect3DRMProgressiveMesh, 0x4516ec40, 0x8f20, 0x11d0, 0x9b, 0x6d, 0x00, 0x00, 0xc0, 0x78, 0x1b, 0xc3);
DEFINE_GUID(CLSID_CDirect3DRMClippedVisual, 0x5434e72d, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a); DEFINE_GUID(CLSID_CDirect3DRMClippedVisual, 0x5434e72d, 0x6d66, 0x11d1, 0xbb, 0xb, 0x0, 0x0, 0xf8, 0x75, 0x86, 0x5a);

View file

@ -3,7 +3,7 @@
static const struct { static const struct {
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
unsigned char pixel_data[32 * 32 * 4 + 1]; unsigned char pixel_data[32 * 32 * 4 + 1];
} sdlappicon = { } sdlappicon = {
32, 32, 4, 32, 32, 4,

View file

@ -3,7 +3,7 @@
static const struct { static const struct {
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */ unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */
unsigned char pixel_data[48 * 48 * 4 + 1]; unsigned char pixel_data[48 * 48 * 4 + 1];
} sdlappicon = { } sdlappicon = {
48, 48, 4, 48, 48, 4,

View file

@ -4216,7 +4216,7 @@ ACTOR_STATIC void G_MoveActors(void)
if ((TEST_SYNC_KEY(g_player[p].sync->bits, SK_FIRE) || (ps->quick_kick > 0)) && sprite[ps->i].extra > 0) if ((TEST_SYNC_KEY(g_player[p].sync->bits, SK_FIRE) || (ps->quick_kick > 0)) && sprite[ps->i].extra > 0)
if (ps->quick_kick > 0 || if (ps->quick_kick > 0 ||
(PWEAPON(p, ps->curr_weapon, WorksLike) != HANDREMOTE_WEAPON && PWEAPON(p, ps->curr_weapon, WorksLike) != HANDBOMB_WEAPON && (PWEAPON(p, ps->curr_weapon, WorksLike) != HANDREMOTE_WEAPON && PWEAPON(p, ps->curr_weapon, WorksLike) != HANDBOMB_WEAPON &&
PWEAPON(p, ps->curr_weapon, WorksLike) != TRIPBOMB_WEAPON && ps->ammo_amount[ps->curr_weapon] >= 0)) PWEAPON(p, ps->curr_weapon, WorksLike) != TRIPBOMB_WEAPON && ps->ammo_amount[ps->curr_weapon] >= 0))
{ {
for (x=0; x<8; x++) for (x=0; x<8; x++)

View file

@ -86,7 +86,7 @@ typedef struct
float gameControlsAlpha; float gameControlsAlpha;
} droidinput_t; } droidinput_t;
typedef struct typedef struct
{ {
int32_t audio_sample_rate; int32_t audio_sample_rate;
int32_t audio_buffer_size; int32_t audio_buffer_size;

View file

@ -66,7 +66,7 @@ dukeanim_t *Anim_Find(const char *s)
dukeanim_t * Anim_Setup(const char *fn, uint8_t fdelay, void (*sound_func)(int32_t)) dukeanim_t * Anim_Setup(const char *fn, uint8_t fdelay, void (*sound_func)(int32_t))
{ {
dukeanim_t * anim = Anim_Find(fn); dukeanim_t * anim = Anim_Find(fn);
if (!anim) if (!anim)
anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t)); anim = (dukeanim_t *)Xcalloc(1, sizeof(dukeanim_t));

View file

@ -6683,7 +6683,7 @@ static void Keys3d(void)
wall[searchwall].extra = tempextra; wall[searchwall].extra = tempextra;
fixxrepeat(searchwall, templenrepquot); fixxrepeat(searchwall, templenrepquot);
} }
if (AIMING_AT_WALL) if (AIMING_AT_WALL)
@ -7402,7 +7402,7 @@ static void Keys2d(void)
if (tcursectornum >= 0) if (tcursectornum >= 0)
{ {
Bsprintf(tempbuf,"Sector %d Extra: ",tcursectornum); Bsprintf(tempbuf,"Sector %d Extra: ",tcursectornum);
sector[tcursectornum].extra = getnumber16(tempbuf,sector[tcursectornum].extra,BTAG_MAX,1); sector[tcursectornum].extra = getnumber16(tempbuf,sector[tcursectornum].extra,BTAG_MAX,1);
} }
} }
} }
@ -10112,7 +10112,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
sectorpals[isec][1] = sector[isec].ceilingpal; sectorpals[isec][1] = sector[isec].ceilingpal;
sector[isec].floorpal = sprite[i].pal; sector[isec].floorpal = sprite[i].pal;
sector[isec].ceilingpal = sprite[i].pal; sector[isec].ceilingpal = sprite[i].pal;
for (w = headspritesect[isec]; w >= 0; w = nextspritesect[w]) for (w = headspritesect[isec]; w >= 0; w = nextspritesect[w])
{ {
if (w == i) if (w == i)
@ -10336,7 +10336,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
} }
shade = (i+16384 == pointhighlight) ? 7 - (M32_THROB>>1) : sprite[i].shade; shade = (i+16384 == pointhighlight) ? 7 - (M32_THROB>>1) : sprite[i].shade;
if (m32_sideview) if (m32_sideview)
{ {
screencoords(&xp1, &yp1, sprite[i].x-pos.x, sprite[i].y-pos.y, zoom); screencoords(&xp1, &yp1, sprite[i].x-pos.x, sprite[i].y-pos.y, zoom);
@ -10344,7 +10344,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
yp1 -= mulscale14(tilesiz[picnum].y<<2, zoom); yp1 -= mulscale14(tilesiz[picnum].y<<2, zoom);
xp1 += halfxdim16; xp1 += halfxdim16;
} }
else else
ovhscrcoords(sprite[i].x, sprite[i].y-(tilesiz[picnum].y<<2), &xp1, &yp1); ovhscrcoords(sprite[i].x, sprite[i].y-(tilesiz[picnum].y<<2), &xp1, &yp1);
ydim16 = ydim - STATUS2DSIZ2; // XXX? ydim16 = ydim - STATUS2DSIZ2; // XXX?
@ -10786,11 +10786,11 @@ void ExtCheckKeys(void)
for (w=headspritesect[isec]; w>=0; w=nextspritesect[w]) for (w=headspritesect[isec]; w>=0; w=nextspritesect[w])
{ {
if (w == i) if (w == i)
continue; continue;
sprite[w].shade = spriteshades[w]; sprite[w].shade = spriteshades[w];
sprite[w].pal = spritepals[w]; sprite[w].pal = spritepals[w];
} }
} }
} }

View file

@ -1368,7 +1368,7 @@ static void Yax_SetBunchInterpolation(int32_t sectnum, int32_t cf)
if (bunchnum < 0 || bunchnum >= numyaxbunches) if (bunchnum < 0 || bunchnum >= numyaxbunches)
return; return;
for (SECTORS_OF_BUNCH(bunchnum, YAX_CEILING, i)) for (SECTORS_OF_BUNCH(bunchnum, YAX_CEILING, i))
G_SetInterpolation(&sector[i].ceilingz); G_SetInterpolation(&sector[i].ceilingz);
for (SECTORS_OF_BUNCH(bunchnum, YAX_FLOOR, i)) for (SECTORS_OF_BUNCH(bunchnum, YAX_FLOOR, i))

View file

@ -2578,7 +2578,7 @@ LUNATIC_EXTERN void C_DefineProjectile(int32_t j, int32_t what, int32_t val)
proj->shade = val; break; proj->shade = val; break;
case PROJ_XREPEAT: case PROJ_XREPEAT:
proj->xrepeat = val; break; proj->xrepeat = val; break;
case PROJ_YREPEAT: case PROJ_YREPEAT:
proj->yrepeat = val; break; proj->yrepeat = val; break;
case PROJ_PAL: case PROJ_PAL:
proj->pal = val; break; proj->pal = val; break;

View file

@ -1042,7 +1042,7 @@ enum ScriptKeywords_t
CON_SCRIPTSIZE, // 329 CON_SCRIPTSIZE, // 329
CON_SETGAMENAME, // 330 CON_SETGAMENAME, // 330
CON_CMENU, // 331 CON_CMENU, // 331
CON_GETTIMEDATE, // 332 CON_GETTIMEDATE, // 332
CON_ACTIVATECHEAT, // 333 CON_ACTIVATECHEAT, // 333
CON_SETGAMEPALETTE, // 334 CON_SETGAMEPALETTE, // 334
CON_SETDEFNAME, // 335 CON_SETDEFNAME, // 335

View file

@ -257,7 +257,7 @@ static int32_t VM_CheckSquished(void)
(fz - cz >= (32<<8) || (sc->lotag&32768)) : (fz - cz >= (32<<8) || (sc->lotag&32768)) :
(fz - cz >= (12<<8))) (fz - cz >= (12<<8)))
return 0; return 0;
P_DoQuote(QUOTE_SQUISHED, vm.g_pp); P_DoQuote(QUOTE_SQUISHED, vm.g_pp);
if (A_CheckEnemySprite(vm.g_sp)) if (A_CheckEnemySprite(vm.g_sp))
@ -5829,7 +5829,7 @@ void G_SaveMapState(void)
mapinfo->savedstate = (mapstate_t *) Xaligned_alloc(16, sizeof(mapstate_t)); mapinfo->savedstate = (mapstate_t *) Xaligned_alloc(16, sizeof(mapstate_t));
Bmemset(mapinfo->savedstate, 0, sizeof(mapstate_t)); Bmemset(mapinfo->savedstate, 0, sizeof(mapstate_t));
} }
mapstate_t *save = mapinfo->savedstate; mapstate_t *save = mapinfo->savedstate;
if (save == NULL) if (save == NULL)

View file

@ -964,7 +964,7 @@ void __fastcall VM_SetSector(register int32_t const iSector, register int32_t co
case SECTOR_CEILINGZ: s->ceilingz = iSet; break; case SECTOR_CEILINGZ: s->ceilingz = iSet; break;
case SECTOR_CEILINGZVEL: s->extra = iSet; case SECTOR_CEILINGZVEL: s->extra = iSet;
if ((iSet = GetAnimationGoal(&s->ceilingz)) != -1) if ((iSet = GetAnimationGoal(&s->ceilingz)) != -1)
case SECTOR_CEILINGZGOAL: case SECTOR_CEILINGZGOAL:
SetAnimation(iSector, &s->ceilingz, iSet, s->extra); SetAnimation(iSector, &s->ceilingz, iSet, s->extra);
break; break;

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#ifndef DRIVERS_H #ifndef DRIVERS_H

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/** /**
@ -82,24 +82,24 @@ static void FillBufferPortion(char * ptr, int32_t remaining)
while (remaining >= len) { while (remaining >= len) {
if (MixBufferUsed == MixBufferSize) { if (MixBufferUsed == MixBufferSize) {
MixCallBack(); MixCallBack();
MixBufferUsed = 0; MixBufferUsed = 0;
MixBufferCurrent++; MixBufferCurrent++;
if (MixBufferCurrent >= MixBufferCount) { if (MixBufferCurrent >= MixBufferCount) {
MixBufferCurrent -= MixBufferCount; MixBufferCurrent -= MixBufferCount;
} }
} }
while (remaining >= len && MixBufferUsed < MixBufferSize) { while (remaining >= len && MixBufferUsed < MixBufferSize) {
sptr = MixBuffer + (MixBufferCurrent * MixBufferSize) + MixBufferUsed; sptr = MixBuffer + (MixBufferCurrent * MixBufferSize) + MixBufferUsed;
len = MixBufferSize - MixBufferUsed; len = MixBufferSize - MixBufferUsed;
if (remaining < len) { if (remaining < len) {
len = remaining; len = remaining;
} }
memcpy(ptr, sptr, len); memcpy(ptr, sptr, len);
ptr += len; ptr += len;
MixBufferUsed += len; MixBufferUsed += len;
remaining -= len; remaining -= len;
@ -113,7 +113,7 @@ static void FillBuffer(int32_t bufnum)
LPVOID ptr, ptr2; LPVOID ptr, ptr2;
DWORD remaining, remaining2; DWORD remaining, remaining2;
int32_t retries = 1; int32_t retries = 1;
//initprintf( "DirectSound FillBuffer: filling %d\n", bufnum); //initprintf( "DirectSound FillBuffer: filling %d\n", bufnum);
do { do {
@ -140,28 +140,28 @@ static void FillBuffer(int32_t bufnum)
} }
break; break;
} while (1); } while (1);
if (ptr) { if (ptr) {
FillBufferPortion((char *) ptr, remaining); FillBufferPortion((char *) ptr, remaining);
} }
if (ptr2) { if (ptr2) {
FillBufferPortion((char *) ptr2, remaining2); FillBufferPortion((char *) ptr2, remaining2);
} }
IDirectSoundBuffer_Unlock(lpdsbsec, ptr, remaining, ptr2, remaining2); IDirectSoundBuffer_Unlock(lpdsbsec, ptr, remaining, ptr2, remaining2);
} }
static DWORD WINAPI fillDataThread(LPVOID lpParameter) static DWORD WINAPI fillDataThread(LPVOID lpParameter)
{ {
DWORD waitret, waitret2; DWORD waitret, waitret2;
HANDLE handles[] = { handles[0] = notifyPositions[0].hEventNotify, HANDLE handles[] = { handles[0] = notifyPositions[0].hEventNotify,
handles[1] = notifyPositions[1].hEventNotify, handles[1] = notifyPositions[1].hEventNotify,
handles[2] = notifyPositions[2].hEventNotify }; handles[2] = notifyPositions[2].hEventNotify };
UNREFERENCED_PARAMETER(lpParameter); UNREFERENCED_PARAMETER(lpParameter);
do { do {
waitret = WaitForMultipleObjects(3, handles, FALSE, INFINITE); waitret = WaitForMultipleObjects(3, handles, FALSE, INFINITE);
switch (waitret) { switch (waitret) {
case WAIT_OBJECT_0: case WAIT_OBJECT_0:
case WAIT_OBJECT_0+1: case WAIT_OBJECT_0+1:
@ -184,7 +184,7 @@ static DWORD WINAPI fillDataThread(LPVOID lpParameter)
break; break;
} }
} while (1); } while (1);
return 0; return 0;
} }
@ -197,79 +197,79 @@ int32_t DirectSoundDrv_GetError(void)
const char *DirectSoundDrv_ErrorString( int32_t ErrorNumber ) const char *DirectSoundDrv_ErrorString( int32_t ErrorNumber )
{ {
const char *ErrorString; const char *ErrorString;
switch( ErrorNumber ) switch( ErrorNumber )
{ {
case DSErr_Warning : case DSErr_Warning :
case DSErr_Error : case DSErr_Error :
ErrorString = DirectSoundDrv_ErrorString( ErrorCode ); ErrorString = DirectSoundDrv_ErrorString( ErrorCode );
break; break;
case DSErr_Ok : case DSErr_Ok :
ErrorString = "DirectSound ok."; ErrorString = "DirectSound ok.";
break; break;
case DSErr_Uninitialised: case DSErr_Uninitialised:
ErrorString = "DirectSound uninitialised."; ErrorString = "DirectSound uninitialised.";
break; break;
case DSErr_DirectSoundCreate: case DSErr_DirectSoundCreate:
ErrorString = "DirectSound error: DirectSoundCreate failed."; ErrorString = "DirectSound error: DirectSoundCreate failed.";
break; break;
case DSErr_SetCooperativeLevel: case DSErr_SetCooperativeLevel:
ErrorString = "DirectSound error: SetCooperativeLevel failed."; ErrorString = "DirectSound error: SetCooperativeLevel failed.";
break; break;
case DSErr_CreateSoundBuffer: case DSErr_CreateSoundBuffer:
ErrorString = "DirectSound error: primary CreateSoundBuffer failed."; ErrorString = "DirectSound error: primary CreateSoundBuffer failed.";
break; break;
case DSErr_CreateSoundBufferSecondary: case DSErr_CreateSoundBufferSecondary:
ErrorString = "DirectSound error: secondary CreateSoundBuffer failed."; ErrorString = "DirectSound error: secondary CreateSoundBuffer failed.";
break; break;
case DSErr_SetFormat: case DSErr_SetFormat:
ErrorString = "DirectSound error: primary buffer SetFormat failed."; ErrorString = "DirectSound error: primary buffer SetFormat failed.";
break; break;
case DSErr_SetFormatSecondary: case DSErr_SetFormatSecondary:
ErrorString = "DirectSound error: secondary buffer SetFormat failed."; ErrorString = "DirectSound error: secondary buffer SetFormat failed.";
break; break;
case DSErr_Notify: case DSErr_Notify:
ErrorString = "DirectSound error: failed querying secondary buffer for notify interface."; ErrorString = "DirectSound error: failed querying secondary buffer for notify interface.";
break; break;
case DSErr_NotifyEvents: case DSErr_NotifyEvents:
ErrorString = "DirectSound error: failed creating notify events."; ErrorString = "DirectSound error: failed creating notify events.";
break; break;
case DSErr_SetNotificationPositions: case DSErr_SetNotificationPositions:
ErrorString = "DirectSound error: failed setting notification positions."; ErrorString = "DirectSound error: failed setting notification positions.";
break; break;
case DSErr_Play: case DSErr_Play:
ErrorString = "DirectSound error: primary buffer Play failed."; ErrorString = "DirectSound error: primary buffer Play failed.";
break; break;
case DSErr_PlaySecondary: case DSErr_PlaySecondary:
ErrorString = "DirectSound error: secondary buffer Play failed."; ErrorString = "DirectSound error: secondary buffer Play failed.";
break; break;
case DSErr_CreateThread: case DSErr_CreateThread:
ErrorString = "DirectSound error: failed creating mix thread."; ErrorString = "DirectSound error: failed creating mix thread.";
break; break;
case DSErr_CreateMutex: case DSErr_CreateMutex:
ErrorString = "DirectSound error: failed creating mix mutex."; ErrorString = "DirectSound error: failed creating mix mutex.";
break; break;
default: default:
ErrorString = "Unknown DirectSound error code."; ErrorString = "Unknown DirectSound error code.";
break; break;
} }
return ErrorString; return ErrorString;
} }
@ -305,38 +305,38 @@ int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, void * i
HRESULT err; HRESULT err;
DSBUFFERDESC bufdesc; DSBUFFERDESC bufdesc;
WAVEFORMATEX wfex; WAVEFORMATEX wfex;
if (Initialised) { if (Initialised) {
DirectSoundDrv_PCM_Shutdown(); DirectSoundDrv_PCM_Shutdown();
} }
err = DirectSoundCreate(0, &lpds, 0); err = DirectSoundCreate(0, &lpds, 0);
if (FAILED( err )) { if (FAILED( err )) {
ErrorCode = DSErr_DirectSoundCreate; ErrorCode = DSErr_DirectSoundCreate;
return DSErr_Error; return DSErr_Error;
} }
err = IDirectSound_SetCooperativeLevel(lpds, (HWND) initdata, DSSCL_PRIORITY); err = IDirectSound_SetCooperativeLevel(lpds, (HWND) initdata, DSSCL_PRIORITY);
if (FAILED( err )) { if (FAILED( err )) {
TeardownDSound(err); TeardownDSound(err);
ErrorCode = DSErr_SetCooperativeLevel; ErrorCode = DSErr_SetCooperativeLevel;
return DSErr_Error; return DSErr_Error;
} }
memset(&bufdesc, 0, sizeof(DSBUFFERDESC)); memset(&bufdesc, 0, sizeof(DSBUFFERDESC));
bufdesc.dwSize = sizeof(DSBUFFERDESC); bufdesc.dwSize = sizeof(DSBUFFERDESC);
bufdesc.dwFlags = DSBCAPS_LOCSOFTWARE | bufdesc.dwFlags = DSBCAPS_LOCSOFTWARE |
DSBCAPS_PRIMARYBUFFER | DSBCAPS_PRIMARYBUFFER |
DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GETCURRENTPOSITION2 |
DSBCAPS_STICKYFOCUS ; DSBCAPS_STICKYFOCUS ;
err = IDirectSound_CreateSoundBuffer(lpds, &bufdesc, &lpdsbprimary, 0); err = IDirectSound_CreateSoundBuffer(lpds, &bufdesc, &lpdsbprimary, 0);
if (FAILED( err )) { if (FAILED( err )) {
TeardownDSound(err); TeardownDSound(err);
ErrorCode = DSErr_CreateSoundBuffer; ErrorCode = DSErr_CreateSoundBuffer;
return DSErr_Error; return DSErr_Error;
} }
memset(&wfex, 0, sizeof(WAVEFORMATEX)); memset(&wfex, 0, sizeof(WAVEFORMATEX));
wfex.wFormatTag = WAVE_FORMAT_PCM; wfex.wFormatTag = WAVE_FORMAT_PCM;
wfex.nChannels = *numchannels; wfex.nChannels = *numchannels;
@ -344,28 +344,28 @@ int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, void * i
wfex.wBitsPerSample = 16; wfex.wBitsPerSample = 16;
wfex.nBlockAlign = wfex.nChannels * wfex.wBitsPerSample / 8; wfex.nBlockAlign = wfex.nChannels * wfex.wBitsPerSample / 8;
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign; wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
err = IDirectSoundBuffer_SetFormat(lpdsbprimary, &wfex); err = IDirectSoundBuffer_SetFormat(lpdsbprimary, &wfex);
if (FAILED( err )) { if (FAILED( err )) {
TeardownDSound(err); TeardownDSound(err);
ErrorCode = DSErr_SetFormat; ErrorCode = DSErr_SetFormat;
return DSErr_Error; return DSErr_Error;
} }
bufdesc.dwFlags = DSBCAPS_LOCSOFTWARE | bufdesc.dwFlags = DSBCAPS_LOCSOFTWARE |
DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_CTRLPOSITIONNOTIFY |
DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GETCURRENTPOSITION2 |
DSBCAPS_STICKYFOCUS ; DSBCAPS_STICKYFOCUS ;
bufdesc.dwBufferBytes = wfex.nBlockAlign * 2560 * 2; bufdesc.dwBufferBytes = wfex.nBlockAlign * 2560 * 2;
bufdesc.lpwfxFormat = &wfex; bufdesc.lpwfxFormat = &wfex;
err = IDirectSound_CreateSoundBuffer(lpds, &bufdesc, &lpdsbsec, 0); err = IDirectSound_CreateSoundBuffer(lpds, &bufdesc, &lpdsbsec, 0);
if (FAILED( err )) { if (FAILED( err )) {
TeardownDSound(err); TeardownDSound(err);
ErrorCode = DSErr_SetFormatSecondary; ErrorCode = DSErr_SetFormatSecondary;
return DSErr_Error; return DSErr_Error;
} }
err = IDirectSoundBuffer_QueryInterface(lpdsbsec, &IID_IDirectSoundNotify, err = IDirectSoundBuffer_QueryInterface(lpdsbsec, &IID_IDirectSoundNotify,
(LPVOID *) &lpdsnotify); (LPVOID *) &lpdsnotify);
if (FAILED( err )) { if (FAILED( err )) {
@ -373,7 +373,7 @@ int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, void * i
ErrorCode = DSErr_Notify; ErrorCode = DSErr_Notify;
return DSErr_Error; return DSErr_Error;
} }
notifyPositions[0].dwOffset = 0; notifyPositions[0].dwOffset = 0;
notifyPositions[0].hEventNotify = CreateEvent(NULL, FALSE, FALSE, NULL); notifyPositions[0].hEventNotify = CreateEvent(NULL, FALSE, FALSE, NULL);
notifyPositions[1].dwOffset = bufdesc.dwBufferBytes / 2; notifyPositions[1].dwOffset = bufdesc.dwBufferBytes / 2;
@ -387,32 +387,32 @@ int32_t DirectSoundDrv_PCM_Init(int32_t *mixrate, int32_t *numchannels, void * i
ErrorCode = DSErr_NotifyEvents; ErrorCode = DSErr_NotifyEvents;
return DSErr_Error; return DSErr_Error;
} }
err = IDirectSoundNotify_SetNotificationPositions(lpdsnotify, 3, notifyPositions); err = IDirectSoundNotify_SetNotificationPositions(lpdsnotify, 3, notifyPositions);
if (FAILED( err )) { if (FAILED( err )) {
TeardownDSound(err); TeardownDSound(err);
ErrorCode = DSErr_SetNotificationPositions; ErrorCode = DSErr_SetNotificationPositions;
return DSErr_Error; return DSErr_Error;
} }
err = IDirectSoundBuffer_Play(lpdsbprimary, 0, 0, DSBPLAY_LOOPING); err = IDirectSoundBuffer_Play(lpdsbprimary, 0, 0, DSBPLAY_LOOPING);
if (FAILED( err )) { if (FAILED( err )) {
TeardownDSound(err); TeardownDSound(err);
ErrorCode = DSErr_Play; ErrorCode = DSErr_Play;
return DSErr_Error; return DSErr_Error;
} }
mutex = CreateMutex(0, FALSE, 0); mutex = CreateMutex(0, FALSE, 0);
if (!mutex) { if (!mutex) {
TeardownDSound(DS_OK); TeardownDSound(DS_OK);
ErrorCode = DSErr_CreateMutex; ErrorCode = DSErr_CreateMutex;
return DSErr_Error; return DSErr_Error;
} }
Initialised = 1; Initialised = 1;
// initprintf("DirectSound Init: yay\n"); // initprintf("DirectSound Init: yay\n");
return DSErr_Ok; return DSErr_Ok;
} }
@ -421,11 +421,11 @@ void DirectSoundDrv_PCM_Shutdown(void)
if (!Initialised) { if (!Initialised) {
return; return;
} }
DirectSoundDrv_PCM_StopPlayback(); DirectSoundDrv_PCM_StopPlayback();
TeardownDSound(DS_OK); TeardownDSound(DS_OK);
Initialised = 0; Initialised = 0;
} }
@ -433,14 +433,14 @@ int32_t DirectSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
int32_t NumDivisions, void ( *CallBackFunc )( void ) ) int32_t NumDivisions, void ( *CallBackFunc )( void ) )
{ {
HRESULT err; HRESULT err;
if (!Initialised) { if (!Initialised) {
ErrorCode = DSErr_Uninitialised; ErrorCode = DSErr_Uninitialised;
return DSErr_Error; return DSErr_Error;
} }
DirectSoundDrv_PCM_StopPlayback(); DirectSoundDrv_PCM_StopPlayback();
MixBuffer = BufferStart; MixBuffer = BufferStart;
MixBufferSize = BufferSize; MixBufferSize = BufferSize;
MixBufferCount = NumDivisions; MixBufferCount = NumDivisions;
@ -450,7 +450,7 @@ int32_t DirectSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
// prime the buffer // prime the buffer
FillBuffer(0); FillBuffer(0);
mixThread = CreateThread(NULL, 0, fillDataThread, 0, 0, 0); mixThread = CreateThread(NULL, 0, fillDataThread, 0, 0, 0);
if (!mixThread) { if (!mixThread) {
ErrorCode = DSErr_CreateThread; ErrorCode = DSErr_CreateThread;
@ -458,15 +458,15 @@ int32_t DirectSoundDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
} }
SetThreadPriority(mixThread, THREAD_PRIORITY_ABOVE_NORMAL); SetThreadPriority(mixThread, THREAD_PRIORITY_ABOVE_NORMAL);
err = IDirectSoundBuffer_Play(lpdsbsec, 0, 0, DSBPLAY_LOOPING); err = IDirectSoundBuffer_Play(lpdsbsec, 0, 0, DSBPLAY_LOOPING);
if (FAILED( err )) { if (FAILED( err )) {
ErrorCode = DSErr_PlaySecondary; ErrorCode = DSErr_PlaySecondary;
return DSErr_Error; return DSErr_Error;
} }
Playing = 1; Playing = 1;
return DSErr_Ok; return DSErr_Ok;
} }
@ -475,17 +475,17 @@ void DirectSoundDrv_PCM_StopPlayback(void)
if (!Playing) { if (!Playing) {
return; return;
} }
IDirectSoundBuffer_Stop(lpdsbsec); IDirectSoundBuffer_Stop(lpdsbsec);
IDirectSoundBuffer_SetCurrentPosition(lpdsbsec, 0); IDirectSoundBuffer_SetCurrentPosition(lpdsbsec, 0);
Playing = 0; Playing = 0;
} }
void DirectSoundDrv_PCM_Lock(void) void DirectSoundDrv_PCM_Lock(void)
{ {
DWORD err; DWORD err;
err = WaitForSingleObject(mutex, INFINITE); err = WaitForSingleObject(mutex, INFINITE);
if (err != WAIT_OBJECT_0) { if (err != WAIT_OBJECT_0) {
if (MV_Printf) if (MV_Printf)

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include "inttypes.h" #include "inttypes.h"

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/** /**

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */

View file

@ -1,23 +1,23 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/** /**
* libSDL output driver for MultiVoc * libSDL output driver for MultiVoc
*/ */
@ -67,7 +67,7 @@ static void fillData(int32_t chan, void *ptr, int32_t remaining, void *udata)
UNREFERENCED_PARAMETER(chan); UNREFERENCED_PARAMETER(chan);
UNREFERENCED_PARAMETER(udata); UNREFERENCED_PARAMETER(udata);
if (!MixBuffer || !MixCallBack) if (!MixBuffer || !MixCallBack)
return; return;
@ -76,24 +76,24 @@ static void fillData(int32_t chan, void *ptr, int32_t remaining, void *udata)
while (remaining > 0) { while (remaining > 0) {
if (MixBufferUsed == MixBufferSize) { if (MixBufferUsed == MixBufferSize) {
MixCallBack(); MixCallBack();
MixBufferUsed = 0; MixBufferUsed = 0;
MixBufferCurrent++; MixBufferCurrent++;
if (MixBufferCurrent >= MixBufferCount) { if (MixBufferCurrent >= MixBufferCount) {
MixBufferCurrent -= MixBufferCount; MixBufferCurrent -= MixBufferCount;
} }
} }
while (remaining > 0 && MixBufferUsed < MixBufferSize) { while (remaining > 0 && MixBufferUsed < MixBufferSize) {
sptr = MixBuffer + (MixBufferCurrent * MixBufferSize) + MixBufferUsed; sptr = MixBuffer + (MixBufferCurrent * MixBufferSize) + MixBufferUsed;
len = MixBufferSize - MixBufferUsed; len = MixBufferSize - MixBufferUsed;
if (remaining < len) { if (remaining < len) {
len = remaining; len = remaining;
} }
memcpy(ptr, sptr, len); memcpy(ptr, sptr, len);
ptr = (void *)((uintptr_t)(ptr) + len); ptr = (void *)((uintptr_t)(ptr) + len);
MixBufferUsed += len; MixBufferUsed += len;
remaining -= len; remaining -= len;
@ -112,7 +112,7 @@ int32_t SDLDrv_GetError(void)
const char *SDLDrv_ErrorString( int32_t ErrorNumber ) const char *SDLDrv_ErrorString( int32_t ErrorNumber )
{ {
const char *ErrorString; const char *ErrorString;
switch( ErrorNumber ) { switch( ErrorNumber ) {
case SDLErr_Warning : case SDLErr_Warning :
case SDLErr_Error : case SDLErr_Error :
@ -122,7 +122,7 @@ const char *SDLDrv_ErrorString( int32_t ErrorNumber )
case SDLErr_Ok : case SDLErr_Ok :
ErrorString = "SDL Audio ok."; ErrorString = "SDL Audio ok.";
break; break;
case SDLErr_Uninitialised: case SDLErr_Uninitialised:
ErrorString = "SDL Audio uninitialised."; ErrorString = "SDL Audio uninitialised.";
break; break;
@ -228,25 +228,25 @@ int32_t SDLDrv_PCM_BeginPlayback(char *BufferStart, int32_t BufferSize,
ErrorCode = SDLErr_Uninitialised; ErrorCode = SDLErr_Uninitialised;
return SDLErr_Error; return SDLErr_Error;
} }
if (Playing) { if (Playing) {
SDLDrv_PCM_StopPlayback(); SDLDrv_PCM_StopPlayback();
} }
MixBuffer = BufferStart; MixBuffer = BufferStart;
MixBufferSize = BufferSize; MixBufferSize = BufferSize;
MixBufferCount = NumDivisions; MixBufferCount = NumDivisions;
MixBufferCurrent = 0; MixBufferCurrent = 0;
MixBufferUsed = 0; MixBufferUsed = 0;
MixCallBack = CallBackFunc; MixCallBack = CallBackFunc;
// prime the buffer // prime the buffer
MixCallBack(); MixCallBack();
Mix_Resume(-1); Mix_Resume(-1);
Playing = 1; Playing = 1;
return SDLErr_Ok; return SDLErr_Ok;
} }
@ -257,7 +257,7 @@ void SDLDrv_PCM_StopPlayback(void)
} }
Mix_Pause(-1); Mix_Pause(-1);
Playing = 0; Playing = 0;
} }

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/** /**

View file

@ -442,7 +442,7 @@ int32_t MV_PlayVOC3D(char *ptr, uint32_t ptrlength, int32_t loophow, int32_t pit
// Ensure angle is within 0 - 127 // Ensure angle is within 0 - 127
angle &= MV_MAXPANPOSITION; angle &= MV_MAXPANPOSITION;
return MV_PlayVOC(ptr, ptrlength, loophow, -1, pitchoffset, max(0, 255 - distance), return MV_PlayVOC(ptr, ptrlength, loophow, -1, pitchoffset, max(0, 255 - distance),
MV_PanTable[ angle ][ volume ].left, MV_PanTable[ angle ][ volume ].right, priority, callbackval); MV_PanTable[ angle ][ volume ].left, MV_PanTable[ angle ][ volume ].right, priority, callbackval);
} }

View file

@ -1,28 +1,28 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include "_multivc.h" #include "_multivc.h"
/* /*
JBF: JBF:
position = offset of starting sample in start position = offset of starting sample in start
rate = resampling increment rate = resampling increment
start = sound data start = sound data
@ -35,20 +35,20 @@ void MV_Mix16BitMono(uint32_t position, uint32_t rate, const char *start, uint32
uint8_t const * const source = (uint8_t const *) start; uint8_t const * const source = (uint8_t const *) start;
int16_t *dest = (int16_t *) MV_MixDestination; int16_t *dest = (int16_t *) MV_MixDestination;
int32_t sample0; int32_t sample0;
while (length--) { while (length--) {
sample0 = source[position >> 16]; sample0 = source[position >> 16];
position += rate; position += rate;
sample0 = MV_LeftVolume[sample0] + *dest; sample0 = MV_LeftVolume[sample0] + *dest;
if (sample0 < -32768) sample0 = -32768; if (sample0 < -32768) sample0 = -32768;
else if (sample0 > 32767) sample0 = 32767; else if (sample0 > 32767) sample0 = 32767;
*dest = (int16_t) sample0; *dest = (int16_t) sample0;
dest += MV_SampleSize / 2; dest += MV_SampleSize / 2;
} }
MV_MixPosition = position; MV_MixPosition = position;
MV_MixDestination = (char *) dest; MV_MixDestination = (char *) dest;
} }
@ -59,25 +59,25 @@ void MV_Mix16BitStereo(uint32_t position, uint32_t rate, const char *start, uint
uint8_t const * const source = (uint8_t const *) start; uint8_t const * const source = (uint8_t const *) start;
int16_t *dest = (int16_t *) MV_MixDestination; int16_t *dest = (int16_t *) MV_MixDestination;
int32_t sample0, sample1; int32_t sample0, sample1;
while (length--) { while (length--) {
sample0 = source[position >> 16]; sample0 = source[position >> 16];
sample1 = sample0; sample1 = sample0;
position += rate; position += rate;
sample0 = MV_LeftVolume[sample0] + *dest; sample0 = MV_LeftVolume[sample0] + *dest;
sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2); sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2);
if (sample0 < -32768) sample0 = -32768; if (sample0 < -32768) sample0 = -32768;
else if (sample0 > 32767) sample0 = 32767; else if (sample0 > 32767) sample0 = 32767;
if (sample1 < -32768) sample1 = -32768; if (sample1 < -32768) sample1 = -32768;
else if (sample1 > 32767) sample1 = 32767; else if (sample1 > 32767) sample1 = 32767;
*dest = (int16_t) sample0; *dest = (int16_t) sample0;
*(dest + MV_RightChannelOffset/2) = (int16_t) sample1; *(dest + MV_RightChannelOffset/2) = (int16_t) sample1;
dest += MV_SampleSize / 2; dest += MV_SampleSize / 2;
} }
MV_MixPosition = position; MV_MixPosition = position;
MV_MixDestination = (char *) dest; MV_MixDestination = (char *) dest;
} }
@ -88,7 +88,7 @@ void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint
uint16_t const * const source = (uint16_t const *) start; uint16_t const * const source = (uint16_t const *) start;
int16_t *dest = (int16_t *) MV_MixDestination; int16_t *dest = (int16_t *) MV_MixDestination;
int32_t sample0l, sample0h, sample0; int32_t sample0l, sample0h, sample0;
while (length--) { while (length--) {
sample0 = source[position >> 16]; sample0 = source[position >> 16];
#ifdef BIGENDIAN #ifdef BIGENDIAN
@ -99,18 +99,18 @@ void MV_Mix16BitMono16(uint32_t position, uint32_t rate, const char *start, uint
sample0h = (sample0 >> 8) ^ 128; sample0h = (sample0 >> 8) ^ 128;
#endif #endif
position += rate; position += rate;
sample0l = MV_LeftVolume[sample0l] >> 8; sample0l = MV_LeftVolume[sample0l] >> 8;
sample0h = MV_LeftVolume[sample0h]; sample0h = MV_LeftVolume[sample0h];
sample0 = sample0l + sample0h + 128 + *dest; sample0 = sample0l + sample0h + 128 + *dest;
if (sample0 < -32768) sample0 = -32768; if (sample0 < -32768) sample0 = -32768;
else if (sample0 > 32767) sample0 = 32767; else if (sample0 > 32767) sample0 = 32767;
*dest = (int16_t) sample0; *dest = (int16_t) sample0;
dest += MV_SampleSize / 2; dest += MV_SampleSize / 2;
} }
MV_MixPosition = position; MV_MixPosition = position;
MV_MixDestination = (char *) dest; MV_MixDestination = (char *) dest;
} }
@ -122,7 +122,7 @@ void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, ui
int16_t *dest = (int16_t *) MV_MixDestination; int16_t *dest = (int16_t *) MV_MixDestination;
int32_t sample0l, sample0h, sample0; int32_t sample0l, sample0h, sample0;
int32_t sample1l, sample1h, sample1; int32_t sample1l, sample1h, sample1;
while (length--) { while (length--) {
sample0 = source[position >> 16]; sample0 = source[position >> 16];
#ifdef BIGENDIAN #ifdef BIGENDIAN
@ -135,7 +135,7 @@ void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, ui
sample1l = sample0l; sample1l = sample0l;
sample1h = sample0h; sample1h = sample0h;
position += rate; position += rate;
sample0l = MV_LeftVolume[sample0l] >> 8; sample0l = MV_LeftVolume[sample0l] >> 8;
sample0h = MV_LeftVolume[sample0h]; sample0h = MV_LeftVolume[sample0h];
sample1l = MV_RightVolume[sample1l] >> 8; sample1l = MV_RightVolume[sample1l] >> 8;
@ -146,13 +146,13 @@ void MV_Mix16BitStereo16(uint32_t position, uint32_t rate, const char *start, ui
else if (sample0 > 32767) sample0 = 32767; else if (sample0 > 32767) sample0 = 32767;
if (sample1 < -32768) sample1 = -32768; if (sample1 < -32768) sample1 = -32768;
else if (sample1 > 32767) sample1 = 32767; else if (sample1 > 32767) sample1 = 32767;
*dest = (int16_t) sample0; *dest = (int16_t) sample0;
*(dest + MV_RightChannelOffset/2) = (int16_t) sample1; *(dest + MV_RightChannelOffset/2) = (int16_t) sample1;
dest += MV_SampleSize / 2; dest += MV_SampleSize / 2;
} }
MV_MixPosition = position; MV_MixPosition = position;
MV_MixDestination = (char *) dest; MV_MixDestination = (char *) dest;
} }
@ -162,7 +162,7 @@ void MV_16BitReverb(char const *src, char *dest, int16_t *volume, int32_t count)
uint16_t const * input = (uint16_t const *) src; uint16_t const * input = (uint16_t const *) src;
int16_t * output = (int16_t *) dest; int16_t * output = (int16_t *) dest;
int16_t sample0l, sample0h, sample0; int16_t sample0l, sample0h, sample0;
do { do {
sample0 = *input++; sample0 = *input++;
#if 0 //def BIGENDIAN #if 0 //def BIGENDIAN
@ -172,7 +172,7 @@ void MV_16BitReverb(char const *src, char *dest, int16_t *volume, int32_t count)
sample0l = sample0 & 255; sample0l = sample0 & 255;
sample0h = (sample0 >> 8) ^ 128; sample0h = (sample0 >> 8) ^ 128;
#endif #endif
sample0l = ((int16_t *) volume)[sample0l] >> 8; sample0l = ((int16_t *) volume)[sample0l] >> 8;
sample0h = ((int16_t *) volume)[sample0h]; sample0h = ((int16_t *) volume)[sample0h];
*output++ = (int16_t) (sample0l + sample0h + 128); *output++ = (int16_t) (sample0l + sample0h + 128);

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include "_multivc.h" #include "_multivc.h"
@ -23,7 +23,7 @@
/* /*
JBF: JBF:
position = offset of starting sample in start position = offset of starting sample in start
rate = resampling increment rate = resampling increment
start = sound data start = sound data
@ -36,21 +36,21 @@ void MV_Mix16BitMono8Stereo(uint32_t position, uint32_t rate, const char *start,
uint8_t const * const source = (uint8_t const *) start; uint8_t const * const source = (uint8_t const *) start;
int16_t *dest = (int16_t *) MV_MixDestination; int16_t *dest = (int16_t *) MV_MixDestination;
int32_t sample0, sample1; int32_t sample0, sample1;
while (length--) { while (length--) {
sample0 = source[(position >> 16) << 1]; sample0 = source[(position >> 16) << 1];
sample1 = source[((position >> 16) << 1) + 1]; sample1 = source[((position >> 16) << 1) + 1];
position += rate; position += rate;
sample0 = (MV_LeftVolume[sample0] + MV_LeftVolume[sample1]) / 2 + *dest; sample0 = (MV_LeftVolume[sample0] + MV_LeftVolume[sample1]) / 2 + *dest;
if (sample0 < -32768) sample0 = -32768; if (sample0 < -32768) sample0 = -32768;
else if (sample0 > 32767) sample0 = 32767; else if (sample0 > 32767) sample0 = 32767;
*dest = (int16_t) sample0; *dest = (int16_t) sample0;
dest += MV_SampleSize / 2; dest += MV_SampleSize / 2;
} }
MV_MixPosition = position; MV_MixPosition = position;
MV_MixDestination = (char *) dest; MV_MixDestination = (char *) dest;
} }
@ -61,25 +61,25 @@ void MV_Mix16BitStereo8Stereo(uint32_t position, uint32_t rate, const char *star
uint8_t const * const source = (uint8_t const *) start; uint8_t const * const source = (uint8_t const *) start;
int16_t *dest = (int16_t *) MV_MixDestination; int16_t *dest = (int16_t *) MV_MixDestination;
int32_t sample0, sample1; int32_t sample0, sample1;
while (length--) { while (length--) {
sample0 = source[(position >> 16) << 1]; sample0 = source[(position >> 16) << 1];
sample1 = source[((position >> 16) << 1) + 1]; sample1 = source[((position >> 16) << 1) + 1];
position += rate; position += rate;
sample0 = MV_LeftVolume[sample0] + *dest; sample0 = MV_LeftVolume[sample0] + *dest;
sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2); sample1 = MV_RightVolume[sample1] + *(dest + MV_RightChannelOffset / 2);
if (sample0 < -32768) sample0 = -32768; if (sample0 < -32768) sample0 = -32768;
else if (sample0 > 32767) sample0 = 32767; else if (sample0 > 32767) sample0 = 32767;
if (sample1 < -32768) sample1 = -32768; if (sample1 < -32768) sample1 = -32768;
else if (sample1 > 32767) sample1 = 32767; else if (sample1 > 32767) sample1 = 32767;
*dest = (int16_t) sample0; *dest = (int16_t) sample0;
*(dest + MV_RightChannelOffset/2) = (int16_t) sample1; *(dest + MV_RightChannelOffset/2) = (int16_t) sample1;
dest += MV_SampleSize / 2; dest += MV_SampleSize / 2;
} }
MV_MixPosition = position; MV_MixPosition = position;
MV_MixDestination = (char *) dest; MV_MixDestination = (char *) dest;
} }
@ -91,7 +91,7 @@ void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start
int16_t *dest = (int16_t *) MV_MixDestination; int16_t *dest = (int16_t *) MV_MixDestination;
int32_t sample0l, sample0h, sample0; int32_t sample0l, sample0h, sample0;
int32_t sample1l, sample1h, sample1; int32_t sample1l, sample1h, sample1;
while (length--) { while (length--) {
sample0 = source[(position >> 16) << 1]; sample0 = source[(position >> 16) << 1];
sample1 = source[((position >> 16) << 1) + 1]; sample1 = source[((position >> 16) << 1) + 1];
@ -107,23 +107,23 @@ void MV_Mix16BitMono16Stereo(uint32_t position, uint32_t rate, const char *start
sample1h = (sample1 >> 8) ^ 128; sample1h = (sample1 >> 8) ^ 128;
#endif #endif
position += rate; position += rate;
sample0l = MV_LeftVolume[sample0l] >> 8; sample0l = MV_LeftVolume[sample0l] >> 8;
sample0h = MV_LeftVolume[sample0h]; sample0h = MV_LeftVolume[sample0h];
sample0 = sample0l + sample0h + 128; sample0 = sample0l + sample0h + 128;
sample1l = MV_LeftVolume[sample1l] >> 8; sample1l = MV_LeftVolume[sample1l] >> 8;
sample1h = MV_LeftVolume[sample1h]; sample1h = MV_LeftVolume[sample1h];
sample1 = sample1l + sample1h + 128; sample1 = sample1l + sample1h + 128;
sample0 = (sample0 + sample1) / 2 + *dest; sample0 = (sample0 + sample1) / 2 + *dest;
if (sample0 < -32768) sample0 = -32768; if (sample0 < -32768) sample0 = -32768;
else if (sample0 > 32767) sample0 = 32767; else if (sample0 > 32767) sample0 = 32767;
*dest = (int16_t) sample0; *dest = (int16_t) sample0;
dest += MV_SampleSize / 2; dest += MV_SampleSize / 2;
} }
MV_MixPosition = position; MV_MixPosition = position;
MV_MixDestination = (char *) dest; MV_MixDestination = (char *) dest;
} }
@ -135,7 +135,7 @@ void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *sta
int16_t *dest = (int16_t *) MV_MixDestination; int16_t *dest = (int16_t *) MV_MixDestination;
int32_t sample0l, sample0h, sample0; int32_t sample0l, sample0h, sample0;
int32_t sample1l, sample1h, sample1; int32_t sample1l, sample1h, sample1;
while (length--) { while (length--) {
sample0 = source[(position >> 16) << 1]; sample0 = source[(position >> 16) << 1];
sample1 = source[((position >> 16) << 1) + 1]; sample1 = source[((position >> 16) << 1) + 1];
@ -151,7 +151,7 @@ void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *sta
sample1h = (sample1 >> 8) ^ 128; sample1h = (sample1 >> 8) ^ 128;
#endif #endif
position += rate; position += rate;
sample0l = MV_LeftVolume[sample0l] >> 8; sample0l = MV_LeftVolume[sample0l] >> 8;
sample0h = MV_LeftVolume[sample0h]; sample0h = MV_LeftVolume[sample0h];
sample1l = MV_RightVolume[sample1l] >> 8; sample1l = MV_RightVolume[sample1l] >> 8;
@ -162,13 +162,13 @@ void MV_Mix16BitStereo16Stereo(uint32_t position, uint32_t rate, const char *sta
else if (sample0 > 32767) sample0 = 32767; else if (sample0 > 32767) sample0 = 32767;
if (sample1 < -32768) sample1 = -32768; if (sample1 < -32768) sample1 = -32768;
else if (sample1 > 32767) sample1 = 32767; else if (sample1 > 32767) sample1 = 32767;
*dest = (int16_t) sample0; *dest = (int16_t) sample0;
*(dest + MV_RightChannelOffset/2) = (int16_t) sample1; *(dest + MV_RightChannelOffset/2) = (int16_t) sample1;
dest += MV_SampleSize / 2; dest += MV_SampleSize / 2;
} }
MV_MixPosition = position; MV_MixPosition = position;
MV_MixDestination = (char *) dest; MV_MixDestination = (char *) dest;
} }

View file

@ -915,7 +915,7 @@ int32_t MV_Init(int32_t soundcard, int32_t MixRate, int32_t Voices, int32_t numc
// MV_TotalMemory + 2: FIXME, see valgrind_errors.log // MV_TotalMemory + 2: FIXME, see valgrind_errors.log
int const totalmem = Voices * sizeof(VoiceNode) + MV_TOTALBUFFERSIZE + 2; int const totalmem = Voices * sizeof(VoiceNode) + MV_TOTALBUFFERSIZE + 2;
char *ptr = (char *) Xaligned_alloc(16, totalmem); char *ptr = (char *) Xaligned_alloc(16, totalmem);
if (!ptr) if (!ptr)

View file

@ -1,21 +1,21 @@
/* /*
Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2009 Jonathon Fowler <jf@jonof.id.au>
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
/** /**
@ -53,9 +53,9 @@ typedef struct {
void * ptr; void * ptr;
size_t length; size_t length;
size_t pos; size_t pos;
OggVorbis_File vf; OggVorbis_File vf;
char block[BLOCKSIZE]; char block[BLOCKSIZE];
int32_t lastbitstream; int32_t lastbitstream;
} vorbis_data; } vorbis_data;
@ -457,7 +457,7 @@ int32_t MV_PlayVorbis(char *ptr, uint32_t ptrlength, int32_t loopstart, int32_t
MV_SetVoiceVolume( voice, vol, left, right ); MV_SetVoiceVolume( voice, vol, left, right );
MV_PlayVoice( voice ); MV_PlayVoice( voice );
return voice->handle; return voice->handle;
} }

View file

@ -14,7 +14,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.

View file

@ -14,7 +14,7 @@ of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.

View file

@ -114,7 +114,7 @@ static inline uint16_t findpage(uint16_t framenumber)
// this scans the last used page and higher first and then scans the // this scans the last used page and higher first and then scans the
// previously accessed pages afterwards if it doesn't find anything // previously accessed pages afterwards if it doesn't find anything
do do
{ {
for (; i<anim->lpheader->nLps; i++) for (; i<anim->lpheader->nLps; i++)
if (anim->LpArray[i].baseRecord <= framenumber && if (anim->LpArray[i].baseRecord <= framenumber &&
@ -130,7 +130,7 @@ static inline uint16_t findpage(uint16_t framenumber)
} }
} }
while (0); while (0);
return i; return i;
} }
@ -336,7 +336,7 @@ uint8_t * ANIM_DrawFrame(int32_t framenumber)
do drawframe(cnt++); do drawframe(cnt++);
while (cnt < framenumber); while (cnt < framenumber);
anim->currentframe = framenumber; anim->currentframe = framenumber;
return anim->imagebuffer; return anim->imagebuffer;
} }

View file

@ -120,7 +120,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define KEYSC_gPGDN 0x51 #define KEYSC_gPGDN 0x51
#define KEYSC_gINS 0x52 #define KEYSC_gINS 0x52
#define KEYSC_gDEL 0x53 #define KEYSC_gDEL 0x53
#define KEYSC_F11 0x57 #define KEYSC_F11 0x57
#define KEYSC_F12 0x58 #define KEYSC_F12 0x58
@ -140,7 +140,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define KEYSC_PGDN 0xD1 #define KEYSC_PGDN 0xD1
#define KEYSC_INSERT 0xD2 #define KEYSC_INSERT 0xD2
#define KEYSC_DELETE 0xD3 #define KEYSC_DELETE 0xD3
#define asc_Esc 27 #define asc_Esc 27
#define asc_Enter 13 #define asc_Enter 13
#define asc_Space 32 #define asc_Space 32

View file

@ -1764,7 +1764,7 @@ static void FuncMenu_Process(const StatusBarMenu *m, int32_t col, int32_t row)
for (i=0; i<MAXSPRITES; i++) for (i=0; i<MAXSPRITES; i++)
j += correct_picnum(&sprite[i].picnum); j += correct_picnum(&sprite[i].picnum);
printmessage16("Replaced %d invalid tiles",j); printmessage16("Replaced %d invalid tiles",j);
} }
break; break;

View file

@ -2511,7 +2511,7 @@ repeatcase:
C_CUSTOMERROR("local variable `%s' already defined.", tlabel); C_CUSTOMERROR("local variable `%s' already defined.", tlabel);
else else
{ {
uint16_t *numlocals = (cs.currentStateIdx >= 0) ? uint16_t *numlocals = (cs.currentStateIdx >= 0) ?
&statesinfo[cs.currentStateIdx].numlocals : &aEventNumLocals[cs.currentEvent]; &statesinfo[cs.currentStateIdx].numlocals : &aEventNumLocals[cs.currentEvent];
if (((int32_t)(*numlocals))+1 > M32_MAX_LOCALS) if (((int32_t)(*numlocals))+1 > M32_MAX_LOCALS)
@ -2544,7 +2544,7 @@ repeatcase:
{ {
const int32_t asize = *(g_scriptPtr-1); const int32_t asize = *(g_scriptPtr-1);
if (cs.currentStateIdx < 0 && cs.currentEvent < 0) if (cs.currentStateIdx < 0 && cs.currentEvent < 0)
Gv_NewArray(tlabel, NULL, asize, GAMEARRAY_NORMAL); Gv_NewArray(tlabel, NULL, asize, GAMEARRAY_NORMAL);
else // local array else // local array
{ {

View file

@ -90,7 +90,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define SK_OPEN 29 #define SK_OPEN 29
#define SK_INVENTORY 30 #define SK_INVENTORY 30
#define SK_ESCAPE 31 #define SK_ESCAPE 31
// rotatesprite flags // rotatesprite flags
#define ROTATE_SPRITE_TRANSLUCENT (BIT(0)) #define ROTATE_SPRITE_TRANSLUCENT (BIT(0))
#define ROTATE_SPRITE_VIEW_CLIP (BIT(1)) // clip to view #define ROTATE_SPRITE_VIEW_CLIP (BIT(1)) // clip to view

View file

@ -22,7 +22,7 @@ LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo )
//HWND hParent = NULL; // find a better value for your app //HWND hParent = NULL; // find a better value for your app
// firstly see if dbghelp.dll is around and has the function we need // firstly see if dbghelp.dll is around and has the function we need
// look next to the EXE first, as the one in System32 might be old // look next to the EXE first, as the one in System32 might be old
// (e.g. Windows 2000) // (e.g. Windows 2000)
HMODULE hDll = NULL; HMODULE hDll = NULL;
char szDbgHelpPath[_MAX_PATH]; char szDbgHelpPath[_MAX_PATH];

View file

@ -2699,7 +2699,7 @@ static void M_MenuEntryLinkActivate(MenuEntry_t *entry)
setrendermode(prend); setrendermode(prend);
G_GameExit("Failed restoring old video mode."); G_GameExit("Failed restoring old video mode.");
} }
else else
{ {
onvideomodechange(p.bppmax > 8); onvideomodechange(p.bppmax > 8);
#ifdef USE_OPENGL #ifdef USE_OPENGL

View file

@ -61,7 +61,7 @@ void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
if (GAME_isspace(ch)) return; if (GAME_isspace(ch)) return;
if ((ac = GAME_getchartile(ch)) == -1) if ((ac = GAME_getchartile(ch)) == -1)
return; return;
usehightile = (osdhightile && ht); usehightile = (osdhightile && ht);
rotatesprite_fs(OSD_SCALE(9*x<<16), rotatesprite_fs(OSD_SCALE(9*x<<16),
OSD_SCALE((y<<3)<<16), OSD_SCALE((y<<3)<<16),

View file

@ -3390,7 +3390,7 @@ void P_DropWeapon(int32_t snum)
if ((unsigned)cw >= MAX_WEAPONS) if ((unsigned)cw >= MAX_WEAPONS)
return; return;
if (krand()&1) if (krand()&1)
A_Spawn(p->i, WeaponPickupSprites[cw]); A_Spawn(p->i, WeaponPickupSprites[cw]);
else switch (cw) else switch (cw)
@ -3871,7 +3871,7 @@ static void P_ProcessWeapon(int32_t snum)
if (TEST_SYNC_KEY(sb_snum, SK_FIRE)) if (TEST_SYNC_KEY(sb_snum, SK_FIRE))
{ {
P_SetWeaponGamevars(snum, p); P_SetWeaponGamevars(snum, p);
if (VM_OnEvent(EVENT_PRESSEDFIRE, p->i, snum) != 0) if (VM_OnEvent(EVENT_PRESSEDFIRE, p->i, snum) != 0)
sb_snum &= ~BIT(SK_FIRE); sb_snum &= ~BIT(SK_FIRE);
} }
@ -3879,7 +3879,7 @@ static void P_ProcessWeapon(int32_t snum)
if (TEST_SYNC_KEY(sb_snum, SK_HOLSTER)) // 'Holster Weapon if (TEST_SYNC_KEY(sb_snum, SK_HOLSTER)) // 'Holster Weapon
{ {
P_SetWeaponGamevars(snum, p); P_SetWeaponGamevars(snum, p);
if (VM_OnEvent(EVENT_HOLSTER, p->i, snum) == 0) if (VM_OnEvent(EVENT_HOLSTER, p->i, snum) == 0)
{ {
if (PWEAPON(snum, p->curr_weapon, WorksLike) != KNEE_WEAPON) if (PWEAPON(snum, p->curr_weapon, WorksLike) != KNEE_WEAPON)

View file

@ -1657,7 +1657,7 @@ void G_ResetTimers(uint8_t keepgtics)
void G_ClearFIFO(void) void G_ClearFIFO(void)
{ {
int32_t i = MAXPLAYERS-1; int32_t i = MAXPLAYERS-1;
g_emuJumpTics = 0; g_emuJumpTics = 0;
Bmemset(&avg, 0, sizeof(input_t)); Bmemset(&avg, 0, sizeof(input_t));
@ -1818,7 +1818,7 @@ int32_t G_EnterLevel(int32_t g)
S_ClearSoundLocks(); S_ClearSoundLocks();
FX_SetReverb(0); FX_SetReverb(0);
setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP); setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP);
} }
if (G_HaveUserMap()) if (G_HaveUserMap())
{ {

View file

@ -125,7 +125,7 @@ int32_t RTS_IsInitialized(void)
} }
#define RTS_BAD_LUMP(lump) ((uint32_t)lump >= (uint32_t)rts_numlumps) #define RTS_BAD_LUMP(lump) ((uint32_t)lump >= (uint32_t)rts_numlumps)
int32_t RTS_SoundLength(int32_t lump) int32_t RTS_SoundLength(int32_t lump)
{ {

View file

@ -729,7 +729,7 @@ int32_t A_PlaySound(uint32_t num, int32_t i)
{ {
if (EDUKE32_PREDICT_FALSE((unsigned)num > (unsigned)g_maxSoundPos)) return -1; if (EDUKE32_PREDICT_FALSE((unsigned)num > (unsigned)g_maxSoundPos)) return -1;
return (unsigned)i >= MAXSPRITES ? S_PlaySound(num) : return (unsigned)i >= MAXSPRITES ? S_PlaySound(num) :
S_PlaySound3D(num, i, (vec3_t *)&sprite[i]); S_PlaySound3D(num, i, (vec3_t *)&sprite[i]);
} }

View file

@ -528,9 +528,9 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL);
} }
#ifdef POLYMER #ifdef POLYMER
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0); (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0);
#else #else
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 7); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 7);
@ -595,7 +595,7 @@ static GtkWidget *create_window(void)
// Empty horizontal layout // Empty horizontal layout
stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0); stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,3, 3,4, (GtkAttachOptions)0, gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,3, 3,4, (GtkAttachOptions)0,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 4, 0); (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 4, 0);
// Autoload checkbox // Autoload checkbox

View file

@ -1,20 +1,20 @@
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/* /*
Copyright (C) 2013 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2013 Jonathon Fowler <jf@jonof.id.au>
This file is part of JFShadowWarrior This file is part of JFShadowWarrior
Shadow Warrior is free software; you can redistribute it and/or Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@ -34,16 +34,16 @@
if (self) { if (self) {
struct grpfile *p; struct grpfile *p;
int i; int i;
list = [[NSMutableArray alloc] init]; list = [[NSMutableArray alloc] init];
for (p = foundgrps; p; p=p->next) { for (p = foundgrps; p; p=p->next) {
for (i=0; i<numgrpfiles; i++) if (p->crcval == grpfiles[i].crcval) break; for (i=0; i<numgrpfiles; i++) if (p->crcval == grpfiles[i].crcval) break;
if (i == numgrpfiles) continue; if (i == numgrpfiles) continue;
[list addObject:[[GrpFile alloc] initWithGrpfile:p andName:[NSString stringWithUTF8String:grpfiles[i].name]]]; [list addObject:[[GrpFile alloc] initWithGrpfile:p andName:[NSString stringWithUTF8String:grpfiles[i].name]]];
} }
} }
return self; return self;
} }

View file

@ -1,20 +1,20 @@
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/* /*
Copyright (C) 2013 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2013 Jonathon Fowler <jf@jonof.id.au>
This file is part of JFShadowWarrior This file is part of JFShadowWarrior
Shadow Warrior is free software; you can redistribute it and/or Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

View file

@ -1,20 +1,20 @@
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
/* /*
Copyright (C) 2007 Jonathon Fowler <jf@jonof.id.au> Copyright (C) 2007 Jonathon Fowler <jf@jonof.id.au>
This file is part of JFShadowWarrior This file is part of JFShadowWarrior
Shadow Warrior is free software; you can redistribute it and/or Shadow Warrior is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@ -64,7 +64,7 @@ static struct soundQuality_t {
IBOutlet NSPopUpButton *videoMode3DPUButton; IBOutlet NSPopUpButton *videoMode3DPUButton;
IBOutlet NSPopUpButton *soundQualityPUButton; IBOutlet NSPopUpButton *soundQualityPUButton;
IBOutlet NSScrollView *gameList; IBOutlet NSScrollView *gameList;
IBOutlet NSButton *cancelButton; IBOutlet NSButton *cancelButton;
IBOutlet NSButton *startButton; IBOutlet NSButton *startButton;
} }
@ -99,7 +99,7 @@ static struct soundQuality_t {
int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState); int i, mode3d, fullscreen = ([fullscreenButton state] == NSOnState);
int idx3d = -1; int idx3d = -1;
int xdim, ydim, bpp; int xdim, ydim, bpp;
if (firstTime) { if (firstTime) {
xdim = settings.xdim3d; xdim = settings.xdim3d;
ydim = settings.ydim3d; ydim = settings.ydim3d;
@ -111,7 +111,7 @@ static struct soundQuality_t {
ydim = validmode[mode3d].ydim; ydim = validmode[mode3d].ydim;
bpp = validmode[mode3d].bpp; bpp = validmode[mode3d].bpp;
} }
} }
mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1); mode3d = checkvideomode(&xdim, &ydim, bpp, fullscreen, 1);
if (mode3d < 0) { if (mode3d < 0) {
@ -123,7 +123,7 @@ static struct soundQuality_t {
break; break;
} }
} }
[modeslist3d release]; [modeslist3d release];
[videoMode3DPUButton removeAllItems]; [videoMode3DPUButton removeAllItems];
@ -144,9 +144,9 @@ static struct soundQuality_t {
- (void)populateSoundQuality:(BOOL)firstTime - (void)populateSoundQuality:(BOOL)firstTime
{ {
int i, curidx = -1; int i, curidx = -1;
[soundQualityPUButton removeAllItems]; [soundQualityPUButton removeAllItems];
for (i = 0; soundQualities[i].frequency > 0; i++) { for (i = 0; soundQualities[i].frequency > 0; i++) {
const char *ch; const char *ch;
switch (soundQualities[i].channels) { switch (soundQualities[i].channels) {
@ -154,14 +154,14 @@ static struct soundQuality_t {
case 2: ch = "Stereo"; break; case 2: ch = "Stereo"; break;
default: ch = "?"; break; default: ch = "?"; break;
} }
NSString *s = [NSString stringWithFormat:@"%dkHz, %d-bit, %s", NSString *s = [NSString stringWithFormat:@"%dkHz, %d-bit, %s",
soundQualities[i].frequency / 1000, soundQualities[i].frequency / 1000,
soundQualities[i].samplesize, soundQualities[i].samplesize,
ch ch
]; ];
[soundQualityPUButton addItemWithTitle:s]; [soundQualityPUButton addItemWithTitle:s];
if (firstTime && if (firstTime &&
soundQualities[i].frequency == settings.samplerate && soundQualities[i].frequency == settings.samplerate &&
soundQualities[i].samplesize == settings.bitspersample && soundQualities[i].samplesize == settings.bitspersample &&
@ -169,12 +169,12 @@ static struct soundQuality_t {
curidx = i; curidx = i;
} }
} }
if (firstTime && curidx < 0) { if (firstTime && curidx < 0) {
soundQualities[i].frequency = settings.samplerate; soundQualities[i].frequency = settings.samplerate;
soundQualities[i].samplesize = settings.bitspersample; soundQualities[i].samplesize = settings.bitspersample;
soundQualities[i].channels = settings.channels; soundQualities[i].channels = settings.channels;
const char *ch; const char *ch;
switch (soundQualities[i].channels) { switch (soundQualities[i].channels) {
case 1: ch = "Mono"; break; case 1: ch = "Mono"; break;
@ -187,11 +187,11 @@ static struct soundQuality_t {
ch ch
]; ];
[soundQualityPUButton addItemWithTitle:s]; [soundQualityPUButton addItemWithTitle:s];
curidx = i++; curidx = i++;
soundQualities[i].frequency = -1; soundQualities[i].frequency = -1;
} }
if (curidx >= 0) { if (curidx >= 0) {
[soundQualityPUButton selectItemAtIndex:curidx]; [soundQualityPUButton selectItemAtIndex:curidx];
} }
@ -220,14 +220,14 @@ static struct soundQuality_t {
settings.bpp3d = validmode[mode].bpp; settings.bpp3d = validmode[mode].bpp;
settings.fullscreen = validmode[mode].fs; settings.fullscreen = validmode[mode].fs;
} }
int quality = [soundQualityPUButton indexOfSelectedItem]; int quality = [soundQualityPUButton indexOfSelectedItem];
if (quality >= 0) { if (quality >= 0) {
settings.samplerate = soundQualities[quality].frequency; settings.samplerate = soundQualities[quality].frequency;
settings.bitspersample = soundQualities[quality].samplesize; settings.bitspersample = soundQualities[quality].samplesize;
settings.channels = soundQualities[quality].channels; settings.channels = soundQualities[quality].channels;
} }
int row = [[gameList documentView] selectedRow]; int row = [[gameList documentView] selectedRow];
if (row >= 0) { if (row >= 0) {
struct grpfile *p = [[gamelistsrc grpAtIndex:row] entryptr]; struct grpfile *p = [[gamelistsrc grpAtIndex:row] entryptr];
@ -235,7 +235,7 @@ static struct soundQuality_t {
strcpy(settings.selectedgrp, p->name); strcpy(settings.selectedgrp, p->name);
} }
} }
settings.usemouse = [useMouseButton state] == NSOnState; settings.usemouse = [useMouseButton state] == NSOnState;
settings.usejoystick = [useJoystickButton state] == NSOnState; settings.usejoystick = [useJoystickButton state] == NSOnState;
settings.forcesetup = [alwaysShowButton state] == NSOnState; settings.forcesetup = [alwaysShowButton state] == NSOnState;
@ -260,7 +260,7 @@ static struct soundQuality_t {
while ((control = [enumerator nextObject])) { while ((control = [enumerator nextObject])) {
[control setEnabled:true]; [control setEnabled:true];
} }
gamelistsrc = [[GameListSource alloc] init]; gamelistsrc = [[GameListSource alloc] init];
[[gameList documentView] setDataSource:gamelistsrc]; [[gameList documentView] setDataSource:gamelistsrc];
[[gameList documentView] deselectAll:nil]; [[gameList documentView] deselectAll:nil];
@ -270,7 +270,7 @@ static struct soundQuality_t {
[[gameList documentView] scrollRowToVisible:row]; [[gameList documentView] scrollRowToVisible:row];
[[gameList documentView] selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO]; [[gameList documentView] selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
} }
[cancelButton setEnabled:true]; [cancelButton setEnabled:true];
[startButton setEnabled:true]; [startButton setEnabled:true];
@ -309,7 +309,7 @@ static struct soundQuality_t {
[text beginEditing]; [text beginEditing];
[messagesView replaceCharactersInRange:end withString:str]; [messagesView replaceCharactersInRange:end withString:str];
[text endEditing]; [text endEditing];
if (shouldAutoScroll) { if (shouldAutoScroll) {
end.location = [text length]; end.location = [text length];
end.length = 0; end.length = 0;
@ -329,22 +329,22 @@ static StartupWinController *startwin = nil;
int startwin_open(void) int startwin_open(void)
{ {
if (startwin != nil) return 1; if (startwin != nil) return 1;
startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"]; startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"];
if (startwin == nil) return -1; if (startwin == nil) return -1;
{ {
static unsigned soundQualityFrequencies[] = { 44100, 22050, 11025 }; static unsigned soundQualityFrequencies[] = { 44100, 22050, 11025 };
static unsigned soundQualitySampleSizes[] = { 16, 8 }; static unsigned soundQualitySampleSizes[] = { 16, 8 };
static unsigned soundQualityChannels[] = { 2, 1 }; static unsigned soundQualityChannels[] = { 2, 1 };
unsigned f, b, c, i; unsigned f, b, c, i;
i = sizeof(soundQualityFrequencies) * i = sizeof(soundQualityFrequencies) *
sizeof(soundQualitySampleSizes) * sizeof(soundQualitySampleSizes) *
sizeof(soundQualityChannels) / sizeof(soundQualityChannels) /
sizeof(int) + 2; // one for the terminator, one for a custom setting sizeof(int) + 2; // one for the terminator, one for a custom setting
soundQualities = (struct soundQuality_t *) malloc(i * sizeof(struct soundQuality_t)); soundQualities = (struct soundQuality_t *) malloc(i * sizeof(struct soundQuality_t));
i = 0; i = 0;
for (c = 0; c < sizeof(soundQualityChannels) / sizeof(int); c++) { for (c = 0; c < sizeof(soundQualityChannels) / sizeof(int); c++) {
for (b = 0; b < sizeof(soundQualitySampleSizes) / sizeof(int); b++) { for (b = 0; b < sizeof(soundQualitySampleSizes) / sizeof(int); b++) {
@ -352,15 +352,15 @@ int startwin_open(void)
soundQualities[i].frequency = soundQualityFrequencies[f]; soundQualities[i].frequency = soundQualityFrequencies[f];
soundQualities[i].samplesize = soundQualitySampleSizes[b]; soundQualities[i].samplesize = soundQualitySampleSizes[b];
soundQualities[i].channels = soundQualityChannels[c]; soundQualities[i].channels = soundQualityChannels[c];
i++; i++;
} }
} }
} }
soundQualities[i].frequency = -1; soundQualities[i].frequency = -1;
} }
[startwin setupMessagesMode]; [startwin setupMessagesMode];
[startwin showWindow:nil]; [startwin showWindow:nil];
@ -395,10 +395,10 @@ int startwin_puts(const char *s)
int startwin_settitle(const char *s) int startwin_settitle(const char *s)
{ {
NSString *ns; NSString *ns;
if (!s) return -1; if (!s) return -1;
if (startwin == nil) return 1; if (startwin == nil) return 1;
ns = [[NSString alloc] initWithCString:s]; ns = [[NSString alloc] initWithCString:s];
[startwin setTitle:ns]; [startwin setTitle:ns];
[ns release]; [ns release];
@ -418,9 +418,9 @@ extern int32 ScreenMode, ScreenWidth, ScreenHeight, ScreenBPP, ForceSetup, UseMo
int startwin_run(void) int startwin_run(void)
{ {
int retval; int retval;
if (startwin == nil) return 0; if (startwin == nil) return 0;
ScanGroups(); ScanGroups();
settings.fullscreen = ScreenMode; settings.fullscreen = ScreenMode;
@ -434,9 +434,9 @@ int startwin_run(void)
settings.usejoystick = UseJoystick; settings.usejoystick = UseJoystick;
settings.forcesetup = ForceSetup; settings.forcesetup = ForceSetup;
strncpy(settings.selectedgrp, grpfile, BMAX_PATH); strncpy(settings.selectedgrp, grpfile, BMAX_PATH);
[startwin setupRunMode]; [startwin setupRunMode];
switch ([NSApp runModalForWindow:[startwin window]]) { switch ([NSApp runModalForWindow:[startwin window]]) {
#ifdef MAC_OS_X_VERSION_10_9 #ifdef MAC_OS_X_VERSION_10_9
case NSModalResponseStop: retval = 1; break; case NSModalResponseStop: retval = 1; break;
@ -447,7 +447,7 @@ int startwin_run(void)
#endif #endif
default: retval = -1; default: retval = -1;
} }
[startwin setupMessagesMode]; [startwin setupMessagesMode];
if (retval) { if (retval) {
@ -463,6 +463,6 @@ int startwin_run(void)
ForceSetup = settings.forcesetup; ForceSetup = settings.forcesetup;
grpfile = settings.selectedgrp; grpfile = settings.selectedgrp;
} }
return retval; return retval;
} }