Fix the warnings when building with C++, add MSVC C++ build support. This also changes the internal type of lotags, hitags and cstat type fields to uint16_t instead of int16_t to clean up some dubious behavior wherein the code was using a value of 32768 as a flag in these fields for certain types of things, like invisible sprites (using the value as if it was uint16_t) where it was elsewhere checking if the value was < 0 (using the value as if it was int16_t). This change may break a few specific effects if any part of the relevant code was missed when looking for areas that needed to be addressed.

I think there's also a fix for the CON precache system breakage in here (lost it in my local tree when I started getting the C++ build working in MSVC, sorry!)


git-svn-id: https://svn.eduke32.com/eduke32@3159 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2012-11-14 23:32:43 +00:00
parent 2cea43f150
commit 3ff46c02b2
61 changed files with 710 additions and 510 deletions

View file

@ -208,7 +208,7 @@ endif
# compiler flags etc.
BASECFLAGS= -Wno-attributes
BASECONLYFLAGS=-Wimplicit -Wdeclaration-after-statement
BASECXXFLAGS= -fno-exceptions -fno-rtti -fpermissive
BASECXXFLAGS= -fno-exceptions -fno-rtti -fpermissive -Wno-write-strings -Wno-narrowing
BASEASFLAGS=-s #-g
BASELDFLAGS=

View file

@ -1,5 +1,5 @@
# EDuke32 Makefile for Microsoft NMake
CPLUSPLUS=1
SRC=source
OBJ=obj_win
EROOT=build
@ -25,16 +25,20 @@ DXROOT="H:\Microsoft DirectX SDK (February 2010)"
!ifdef DEBUG
# debugging options
flags_cl= /Od /Zi
flags_cl=/Od /Zi
flags_link=/DEBUG
!else
# release options
flags_cl=/O2 /GL /arch:SSE /MP /I$(WDKROOT)\inc\crt
flags_link=/RELEASE /LTCG /LIBPATH:$(WDKROOT)\lib\wxp\i386 /LIBPATH:$(WDKROOT)\lib\Crt\i386
flags_cl=/O2 /GL /arch:SSE /MP # /I$(WDKROOT)\inc\crt /I$(WDKROOT)\inc\api
flags_link=/RELEASE /LTCG # /LIBPATH:$(WDKROOT)\lib\wxp\i386 /LIBPATH:$(WDKROOT)\lib\Crt\i386
!endif
ENGINEOPTS=/DUSE_OPENGL /DPOLYMER
!ifdef CPLUSPLUS
ENGINEOPTS=$(ENGINEOPTS) /TP
!endif
CC=cl
AS=ml
LINK=link /nologo /opt:ref
@ -57,7 +61,7 @@ CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS /D "_CRT_SECURE_NO_DEPRECATE"
LIBS=$(LIBS) msvcrtd.lib
!else
# comment msvcrt_winxp.obj if not using the WDK
LIBS=$(LIBS) msvcrt.lib msvcrt_winxp.obj
LIBS=$(LIBS) msvcrt.lib # msvcrt_winxp.obj
!endif
JMACTOBJ=$(OBJ)\file_lib.$o \
@ -71,7 +75,9 @@ JMACTOBJ=$(OBJ)\file_lib.$o \
AUDIOLIBOBJ=$(OBJ)\midi.$o $(OBJ)\music.$o $(OBJ)\mpu401.$o
GAMEOBJS=$(OBJ)\game.$o \
$(OBJ)\game_inline.$o \
$(OBJ)\actors.$o \
$(OBJ)\actors_inline.$o \
$(OBJ)\anim.$o \
$(OBJ)\common.$o \
$(OBJ)\demo.$o \
@ -87,6 +93,7 @@ GAMEOBJS=$(OBJ)\game.$o \
$(OBJ)\premap.$o \
$(OBJ)\savegame.$o \
$(OBJ)\sector.$o \
$(OBJ)\sector_inline.$o \
$(OBJ)\rts.$o \
$(OBJ)\config.$o \
$(OBJ)\animlib.$o\

View file

@ -35,8 +35,8 @@ flags_link=/DEBUG
flags_lib=
!else
# release options
flags_cl=/O2 /GL /arch:SSE /MP /I$(WDKROOT)\inc\crt
flags_link=/RELEASE /LTCG /LIBPATH:$(WDKROOT)\lib\Crt\i386 /LIBPATH:$(WDKROOT)\lib\wxp\i386
flags_cl=/O2 /GL /arch:SSE /MP # /I$(WDKROOT)\inc\crt
flags_link=/RELEASE /LTCG # /LIBPATH:$(WDKROOT)\lib\Crt\i386 /LIBPATH:$(WDKROOT)\lib\wxp\i386
flags_lib=/LTCG
!endif
@ -45,7 +45,7 @@ AS=ml
RC=rc
LINK=link /opt:ref /nologo
CFLAGS=$(CFLAGS) /nologo /MT /J $(flags_cl) $(TARGETOPTS) /I$(INC)
ASFLAGS=/nologo /coff /c
ASFLAGS=/nologo /coff /c
EXESUFFIX=.exe
!ifdef DEBUG
CFLAGS=$(CFLAGS) /DDEBUGGINGAIDS /D "_CRT_SECURE_NO_DEPRECATE"

View file

@ -103,7 +103,7 @@ void yax_updategrays(int32_t posze);
#ifdef YAX_ENABLE
// more user tag hijacking: lotag/extra :/
# define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(&Ptr[Wall].lotag + 2*Cf))
# define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(int16_t *)(&Ptr[Wall].lotag + 2*Cf))
# define YAX_NEXTWALL(Wall, Cf) YAX_PTRNEXTWALL(wall, Wall, Cf)
# define YAX_NEXTWALLDEFAULT(Cf) (((Cf)==YAX_CEILING) ? 0 : -1)
@ -228,7 +228,7 @@ typedef struct
{
Tracker(Sector, int16_t) wallptr, wallnum;
Tracker(Sector, int32_t) ceilingz, floorz;
Tracker(Sector, int16_t) ceilingstat, floorstat;
Tracker(Sector, uint16_t) ceilingstat, floorstat;
Tracker(Sector, int16_t) ceilingpicnum, ceilingheinum;
Tracker(Sector, int8_t) ceilingshade;
Tracker(Sector, uint8_t) ceilingpal, ceilingxpanning, ceilingypanning;
@ -236,7 +236,8 @@ typedef struct
Tracker(Sector, int8_t) floorshade;
Tracker(Sector, uint8_t) floorpal, floorxpanning, floorypanning;
Tracker(Sector, uint8_t) visibility, filler;
Tracker(Sector, int16_t) lotag, hitag, extra;
Tracker(Sector, uint16_t) lotag, hitag;
Tracker(Sector, int16_t) extra;
} sectortype;
//cstat:
@ -257,11 +258,13 @@ typedef struct
typedef struct
{
Tracker(Wall, int32_t) x, y;
Tracker(Wall, int16_t) point2, nextwall, nextsector, cstat;
Tracker(Wall, int16_t) point2, nextwall, nextsector;
Tracker(Wall, uint16_t) cstat;
Tracker(Wall, int16_t) picnum, overpicnum;
Tracker(Wall, int8_t) shade;
Tracker(Wall, uint8_t) pal, xrepeat, yrepeat, xpanning, ypanning;
Tracker(Wall, int16_t) lotag, hitag, extra;
Tracker(Wall, uint16_t) lotag, hitag;
Tracker(Wall, int16_t) extra;
} walltype;
//cstat:
@ -287,14 +290,16 @@ typedef struct
typedef struct
{
Tracker(Sprite, int32_t) x, y, z;
Tracker(Sprite, int16_t) cstat, picnum;
Tracker(Sprite, uint16_t) cstat;
Tracker(Sprite, int16_t) picnum;
Tracker(Sprite, int8_t) shade;
Tracker(Sprite, uint8_t) pal, clipdist, filler;
Tracker(Sprite, uint8_t) xrepeat, yrepeat;
Tracker(Sprite, int8_t) xoffset, yoffset;
Tracker(Sprite, int16_t) sectnum, statnum;
Tracker(Sprite, int16_t) ang, owner, xvel, yvel, zvel;
Tracker(Sprite, int16_t) lotag, hitag, extra;
Tracker(Sprite, uint16_t) lotag, hitag;
Tracker(Sprite, int16_t) extra;
} spritetype;
typedef struct {
@ -407,7 +412,13 @@ EXTERN spritetype *tspriteptr[MAXSPRITESONSCREEN + 1];
EXTERN int32_t xdim, ydim, numpages;
EXTERN int32_t yxaspect, viewingrange;
#ifdef __cplusplus
extern "C" {
#endif
EXTERN intptr_t ylookup[MAXYDIM+1];
#ifdef __cplusplus
};
#endif
#define MAXVALIDMODES 256
EXTERN int32_t validmodecnt;
@ -469,8 +480,14 @@ EXTERN int16_t nextspritesect[MAXSPRITES], nextspritestat[MAXSPRITES];
EXTERN int16_t tilesizx[MAXTILES], tilesizy[MAXTILES];
EXTERN char picsiz[MAXTILES];
EXTERN char walock[MAXTILES];
#ifdef __cplusplus
extern "C" {
#endif
EXTERN char pow2char[8];
EXTERN int32_t pow2long[32];
#ifdef __cplusplus
};
#endif
EXTERN int32_t picanm[MAXTILES];
EXTERN intptr_t waloff[MAXTILES]; // stores pointers to cache -- SA

View file

@ -20,6 +20,13 @@
# define ATTRIBUTE(attrlist)
#endif
#ifndef min
#define min(x,y) ((x) < (y) ? (x) : (y))
#endif
#ifndef max
#define max(x,y) ((x) > (y) ? (x) : (y))
#endif
// This gives us access to 'intptr_t' and 'uintptr_t', which are
// abstractions to the size of a pointer on a given platform
// (ie, they're guaranteed to be the same size as a pointer)
@ -100,6 +107,7 @@
#endif
#if defined(_MSC_VER)
#include <direct.h>
# define inline __inline
# define longlong(x) x##i64
static inline float nearbyintf(float x)
@ -500,7 +508,13 @@ static inline uint16_t system_15bit_rand(void) { return ((uint16_t)rand())&0x7ff
# else
# define Btell tell
# endif
# ifdef _MSC_VER
# define Bstat stat
# define Bfstat fstat
# else
# define Bstat stat
# define Bfstat fstat
# endif
# define Bfopen fopen
# define Bfclose fclose
# define Bfflush fflush
@ -653,5 +667,38 @@ char *Bstrupr(char *);
if (fileptr) { Bfclose(fileptr); fileptr=NULL; } \
} while (0)
#define NOWARN(print_func, fmt, ...) do { \
print_func(fmt, ## __VA_ARGS__); \
} while (0)
#define NOWARN_RETURN(print_func, var, fmt, ...) do { \
var = print_func(fmt, ## __VA_ARGS__); \
} while (0)
// TODO: add MSVC pragmas to disable equivalent warning, if necessary later
#ifndef _MSC_VER
#ifdef _WIN32
// MinGW's _Pragma is completely broken so our GCC NOWARN macro is useless there
#pragma GCC diagnostic ignored "-Wformat"
#else
#undef NOWARN
#undef NOWARN_RETURN
#define NOWARN(print_func, fmt, ...) do { _Pragma("GCC diagnostic ignored \"-Wformat\"") \
print_func(fmt, ## __VA_ARGS__); \
_Pragma("GCC diagnostic warning \"-Wformat\"") } while (0)
#define NOWARN_RETURN(print_func, var, fmt, ...) do { _Pragma("GCC diagnostic ignored \"-Wformat\"") \
var = print_func(fmt, ## __VA_ARGS__); \
_Pragma("GCC diagnostic warning \"-Wformat\"") } while (0)
#endif
#endif
#define OSD_Printf_nowarn(fmt, ...) NOWARN(OSD_Printf, fmt, ## __VA_ARGS__)
#define Bsprintf_nowarn(fmt, ...) NOWARN(Bsprintf, fmt, ## __VA_ARGS__)
#define Bsprintf_nowarn_return(x, fmt, ...) NOWARN_RETURN(Bsprintf, x, fmt, ## __VA_ARGS__)
#define initprintf_nowarn(fmt, ...) NOWARN(initprintf, fmt, ## __VA_ARGS__)
#define message_nowarn(fmt, ...) NOWARN(message, fmt, ## __VA_ARGS__)
#endif // __compat_h__

View file

@ -32,7 +32,8 @@
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _STDINT
#define _STDINT
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
@ -245,3 +246,4 @@ typedef uint64_t uintmax_t;
#endif // _MSC_STDINT_H_ ]
#endif

View file

@ -595,7 +595,7 @@ NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedpmemalign(nedpo
/*! \ingroup v2malloc
\brief Allocates a block of memory sized \em size from pool \em p, aligned to \em alignment and according to the flags \em flags.
*/
NEDMALLOCDEPRECATED NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedpmalloc2(nedpool *p, size_t size, size_t alignment=0, unsigned flags=0) THROWSPEC;
NEDMALLOCEXTSPEC NEDMALLOCNOALIASATTR NEDMALLOCPTRATTR void * nedpmalloc2(nedpool *p, size_t size, size_t alignment=0, unsigned flags=0) THROWSPEC;
/*! \ingroup v2malloc
\brief Resizes the block of memory at \em mem in pool \em p to size \em size, aligned to \em alignment and according to the flags \em flags.
*/

View file

@ -85,8 +85,8 @@ enum osdflags_t
OSD_CAPS = 0x00000040
};
#define OSD_ALIAS (void *)0x1337
#define OSD_UNALIASED (void *)0xDEAD
#define OSD_ALIAS (int32_t (*)(const osdfuncparm_t*))0x1337
#define OSD_UNALIASED (int32_t (*)(const osdfuncparm_t*))0xDEAD
#define OSDCMD_OK 0
#define OSDCMD_SHOWHELP 1

View file

@ -8,31 +8,31 @@ class __TRACKER_NAME
public:
inline TrackedType* operator & ()
{
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
__TRACKER_GLOBAL_HOOK((uintptr_t)&this->TrackedValue);
return &this->TrackedValue;
}
inline TrackedType operator ++ ()
{
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
__TRACKER_GLOBAL_HOOK((uintptr_t)&this->TrackedValue);
return ++this->TrackedValue;
}
inline TrackedType operator ++ (int)
{
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
__TRACKER_GLOBAL_HOOK((uintptr_t)&this->TrackedValue);
return this->TrackedValue++;
}
inline TrackedType operator -- ()
{
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
__TRACKER_GLOBAL_HOOK((uintptr_t)&this->TrackedValue);
return --this->TrackedValue;
}
inline TrackedType operator -- (int)
{
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
__TRACKER_GLOBAL_HOOK((uintptr_t)&this->TrackedValue);
return this->TrackedValue--;
}

View file

@ -22,7 +22,7 @@ inline TrackedType __TRACKER_NAME<TrackedType>::operator __TRACKER_OPERATOR (__T
if (!isNoop) {
__TRACKER_GLOBAL_HOOK((int)&this->TrackedValue);
__TRACKER_GLOBAL_HOOK((uintptr_t)&this->TrackedValue);
return (this->TrackedValue __TRACKER_OPERATOR __TRACKER_RIGHTHAND);
} else {
return this->TrackedValue;

View file

@ -132,7 +132,8 @@ int32_t vlineasm1(int32_t vinc, intptr_t paloffs, int32_t cnt, uint32_t vplc, in
extern intptr_t palookupoffse[4];
extern int32_t vplce[4], vince[4];
extern uint32_t vplce[4];
extern int32_t vince[4];
extern intptr_t bufplce[4];
// cnt >= 1

View file

@ -383,10 +383,16 @@ int32_t baselayer_init(void)
# include <sys/mman.h>
#endif
#if !defined(NOASM) && !defined(GEKKO) && !defined(__ANDROID__)
extern "C" {
extern int32_t dep_begin, dep_end;
};
#endif
void makeasmwriteable(void)
{
#if !defined(NOASM) && !defined(GEKKO) && !defined(__ANDROID__)
extern int32_t dep_begin, dep_end;
// extern int32_t dep_begin, dep_end;
# if defined _WIN32
DWORD oldprot;
if (!VirtualProtect((LPVOID)&dep_begin, (SIZE_T)&dep_end - (SIZE_T)&dep_begin, PAGE_EXECUTE_READWRITE, &oldprot))

View file

@ -1580,19 +1580,19 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
}
// allocate temp storage
ptrs[np++] = mapinfo->sector = Bmalloc(highlightsectorcnt * sizeof(sectortype));
ptrs[np++] = mapinfo->sector = (sectortype *)Bmalloc(highlightsectorcnt * sizeof(sectortype));
if (!mapinfo->sector) return -2;
ptrs[np++] = mapinfo->wall = Bmalloc(tmpnumwalls * sizeof(walltype));
ptrs[np++] = mapinfo->wall = (walltype *)Bmalloc(tmpnumwalls * sizeof(walltype));
if (!mapinfo->wall) { free_n_ptrs(ptrs, np-1); return -2; }
#ifdef YAX_ENABLE
if (mapinfo->numyaxbunches > 0)
{
ptrs[np++] = mapinfo->bunchnum = Bmalloc(highlightsectorcnt*2*sizeof(int16_t));
ptrs[np++] = mapinfo->bunchnum = (int16_t *)Bmalloc(highlightsectorcnt*2*sizeof(int16_t));
if (!mapinfo->bunchnum) { free_n_ptrs(ptrs, np-1); return -2; }
ptrs[np++] = mapinfo->ynextwall = Bmalloc(tmpnumwalls*2*sizeof(int16_t));
ptrs[np++] = mapinfo->ynextwall = (int16_t *)Bmalloc(tmpnumwalls*2*sizeof(int16_t));
if (!mapinfo->ynextwall) { free_n_ptrs(ptrs, np-1); return -2; }
}
else
@ -1603,7 +1603,7 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
if (tmpnumsprites>0)
{
ptrs[np++] = mapinfo->sprite = Bmalloc(tmpnumsprites * sizeof(spritetype));
ptrs[np++] = mapinfo->sprite = (spritetype *)Bmalloc(tmpnumsprites * sizeof(spritetype));
if (!mapinfo->sprite) { free_n_ptrs(ptrs, np-1); return -2; }
}
else
@ -1640,7 +1640,7 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo)
{
// if a bunch was discarded
sectortype *const sec = &mapinfo->sector[i];
int16_t *const cs = j==YAX_CEILING ? &sec->ceilingstat : &sec->floorstat;
uint16_t *const cs = j==YAX_CEILING ? &sec->ceilingstat : &sec->floorstat;
uint8_t *const xp = j==YAX_CEILING ? &sec->ceilingxpanning : &sec->floorxpanning;
*cs &= ~YAX_BIT;
@ -2181,7 +2181,7 @@ void fade_editor_screen(int32_t keepcol)
{
char blackcol=0, greycol=whitecol-25, *cp;
int32_t pix, i, threecols = (keepcol >= 256);
char cols[3] = {keepcol&0xff, (keepcol>>8)&0xff, (keepcol>>16)&0xff};
char cols[3] = {(char)(keepcol&0xff), (char)((keepcol>>8)&0xff), (char)((keepcol>>16)&0xff)};
begindrawing();
cp = (char *)frameplace;
@ -2445,7 +2445,7 @@ static int32_t backup_drawn_walls(int32_t restore)
if (newnumwalls <= numwalls) // shouldn't happen
return 2;
tmpwall = Bmalloc((newnumwalls-numwalls) * sizeof(walltype));
tmpwall = (walltype *)Bmalloc((newnumwalls-numwalls) * sizeof(walltype));
if (!tmpwall)
return 1;
@ -2732,7 +2732,7 @@ static int32_t bakframe_fillandfade(char **origframeptr, int32_t sectnum, const
{
if (!*origframeptr)
{
*origframeptr = Bmalloc(xdim*ydim);
*origframeptr = (char *)Bmalloc(xdim*ydim);
if (*origframeptr)
{
begindrawing();
@ -4221,7 +4221,7 @@ rotate_hlsect_out:
// ^ |
// minfloorz ---|
ulz[0] = oldfz - swsecheight*((double)(oldfz-maxceilz)/(minfloorz-maxceilz));
ulz[0] = (int32_t)(oldfz - swsecheight*((double)(oldfz-maxceilz)/(minfloorz-maxceilz)));
ulz[0] &= ~255;
ulz[1] = ulz[0] + swsecheight;
@ -4969,8 +4969,8 @@ end_yax: ;
sector[refsect].wallnum += n;
if (refsect != numsectors-1)
{
walltype *tmpwall = Bmalloc(n * sizeof(walltype));
int16_t *tmponw = Bmalloc(n * sizeof(int16_t));
walltype *tmpwall = (walltype *)Bmalloc(n * sizeof(walltype));
int16_t *tmponw = (int16_t *)Bmalloc(n * sizeof(int16_t));
if (!tmpwall || !tmponw)
{
@ -5836,9 +5836,9 @@ end_point_dragging:
if (!delayerr)
message("Outer wall coordinates must coincide for both components");
OSD_Printf("wal0:%d (%d,%d)--(%d,%d)\n",(int)(wal0-wall),
OSD_Printf_nowarn("wal0:%d (%d,%d)--(%d,%d)\n",(int)(wal0-wall),
wal0->x,wal0->y, wal0p2->x,wal0p2->y);
OSD_Printf("wal1:%d (%d,%d)--(%d,%d)\n",(int)(wal1-wall),
OSD_Printf_nowarn("wal1:%d (%d,%d)--(%d,%d)\n",(int)(wal1-wall),
wal1->x,wal1->y, wal1p2->x,wal1p2->y);
goto end_join_sectors;
@ -8572,7 +8572,7 @@ int32_t fixspritesectors(void)
initprintf("--------------------\n");
printfirsttime = 1;
}
initprintf("Changed sectnum of sprite %d from %d to %d\n", i, sprite[i].sectnum, j);
initprintf_nowarn("Changed sectnum of sprite %d from %d to %d\n", i, sprite[i].sectnum, j);
changespritesect(i, j);
}
break;
@ -10021,9 +10021,10 @@ void printcoords16(int32_t posxe, int32_t posye, int16_t ange)
printext16(264, ydim-STATUS2DSIZ+128, v8?editorcolors[10]:whitecol, -1, snotbuf,0);
}
#define DOPRINT(Yofs, fmt, ...) \
Bsprintf(snotbuf, fmt, ## __VA_ARGS__); \
printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0);
#define DOPRINT(Yofs, fmt, ...) do { \
Bsprintf_nowarn(snotbuf, fmt, ## __VA_ARGS__); \
printext16(8+col*200, ydim/*-(row*96)*/-STATUS2DSIZ+Yofs, color, -1, snotbuf, 0); \
} while (0)
void showsectordata(int16_t sectnum, int16_t small)
{
@ -10547,9 +10548,9 @@ void test_map(int32_t mode)
else
{
#ifdef _WIN32
fullparam = Bstrrchr(mapster32_fullpath, '\\');
fullparam = (char *)Bstrrchr(mapster32_fullpath, '\\');
#else
fullparam = Bstrrchr(mapster32_fullpath, '/');
fullparam = (char *)Bstrrchr(mapster32_fullpath, '/');
#endif
if (fullparam)
{
@ -10572,7 +10573,7 @@ void test_map(int32_t mode)
// and a possible extra space not in testplay_addparam,
// the length should be Bstrlen(game_executable)+Bstrlen(param)+(slen+1)+2+1.
fullparam = Bmalloc(Bstrlen(game_executable)+Bstrlen(param)+slen+4);
fullparam = (char *)Bmalloc(Bstrlen(game_executable)+Bstrlen(param)+slen+4);
Bsprintf(fullparam,"\"%s\"",game_executable);
if (testplay_addparam)

View file

@ -315,7 +315,7 @@ char *listsearchpath(int32_t initp)
int32_t addsearchpath(const char *p)
{
struct stat st;
struct Bstat st;
char *s;
searchpath_t *srch;

View file

@ -14,7 +14,7 @@
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#define _WIN32_IE 0x0400
//#define _WIN32_IE 0x0400
#define _WIN32_WINNT 0x0501
#include <windows.h>
#include <shlobj.h>
@ -570,8 +570,8 @@ char *Bgetsystemdrives(void)
int32_t Bfilelength(int32_t fd)
{
struct stat st;
if (fstat(fd, &st) < 0) return -1;
struct Bstat st;
if (Bfstat(fd, &st) < 0) return -1;
return(int32_t)(st.st_size);
}
@ -643,7 +643,7 @@ struct Bdirent *Breaddir(BDIR *dir)
{
BDIR_real *dirr = (BDIR_real *)dir;
struct dirent *de;
struct stat st;
struct Bstat st;
char *fn;
#ifdef _MSC_VER

View file

@ -163,9 +163,9 @@ static void tile_from_truecolpic(int32_t tile, const palette_t *picptr, int32_t
const int32_t xsiz = tilesizx[tile], ysiz = tilesizy[tile];
int32_t i, j;
char *ftd = Bmalloc(xsiz*ysiz);
char *ftd = (char *)Bmalloc(xsiz*ysiz);
faketiledata[tile] = Bmalloc(xsiz*ysiz + 400);
faketiledata[tile] = (char *)Bmalloc(xsiz*ysiz + 400);
for (i=xsiz-1; i>=0; i--)
{
@ -1484,7 +1484,7 @@ static int32_t defsparser(scriptfile *script)
fd = kopen4load(fn, 0);
// load the highpalookup and send it to polymer
highpaldata = Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
highpaldata = (char *)Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
{
char *filebuf;
@ -1492,7 +1492,7 @@ static int32_t defsparser(scriptfile *script)
filesize = kfilelength(fd);
filebuf = Bmalloc(filesize);
filebuf = (char *)Bmalloc(filesize);
if (!filebuf) { kclose(fd); Bfree(highpaldata); break; }
klseek(fd, 0, SEEK_SET);

View file

@ -130,7 +130,22 @@ static int16_t *dotp1[MAXYDIM], *dotp2[MAXYDIM];
static int8_t tempbuf[MAXWALLS];
// referenced from asm
#ifdef __cplusplus
extern "C" {
#endif
int32_t ebpbak, espbak;
int32_t reciptable[2048], fpuasm;
intptr_t asm1, asm2, asm3, asm4, palookupoffse[4];
uint32_t vplce[4];
int32_t vince[4];
intptr_t bufplce[4];
int32_t globaltilesizy;
int32_t globalx1, globaly2, globalx3, globaly3;
#ifdef __cplusplus
};
#endif
static intptr_t slopalookup[16384]; // was 2048
#if defined(USE_OPENGL)
palette_t palookupfog[MAXPALOOKUPS];
@ -198,8 +213,6 @@ void initialize_engine_globals(void)
pow2long[31] = 2147483647L;
}
int32_t reciptable[2048], fpuasm;
char britable[16][256]; // JBF 20040207: full 8bit precision
extern char textfont[2048], smalltextfont[2048];
@ -850,8 +863,8 @@ void yax_preparedrawrooms(void)
if (getrendermode()==0 && ymostallocsize < xdimen*numyaxbunches)
{
ymostallocsize = xdimen*numyaxbunches;
yumost = Brealloc(yumost, ymostallocsize*sizeof(int16_t));
ydmost = Brealloc(ydmost, ymostallocsize*sizeof(int16_t));
yumost = (int16_t *)Brealloc(yumost, ymostallocsize*sizeof(int16_t));
ydmost = (int16_t *)Brealloc(ydmost, ymostallocsize*sizeof(int16_t));
if (!yumost || !ydmost)
{
@ -1252,6 +1265,7 @@ static walltype *loadwall, *loadwallinv;
static spritetype *loadsprite;
// sectoidx bits
#undef CM_NONE
#define CM_NONE (CM_MAX<<1)
#define CM_SOME (CM_NONE-1)
#define CM_OUTER (CM_MAX) // sector surrounds clipping sector
@ -1318,9 +1332,9 @@ int32_t clipmapinfo_load(void)
clipmapinfo_init();
loadsector = Bmalloc(MAXSECTORS * sizeof(sectortype));
loadwall = Bmalloc(MAXWALLS * sizeof(walltype));
loadsprite = Bmalloc(MAXSPRITES * sizeof(spritetype));
loadsector = (sectortype *)Bmalloc(MAXSECTORS * sizeof(sectortype));
loadwall = (walltype *)Bmalloc(MAXWALLS * sizeof(walltype));
loadsprite = (spritetype *)Bmalloc(MAXSPRITES * sizeof(spritetype));
if (!loadsector || !loadwall || !loadsprite)
{
@ -1394,8 +1408,8 @@ int32_t clipmapinfo_load(void)
}
// shrink
loadsector = Brealloc(loadsector, ournumsectors*sizeof(sectortype));
loadwall = Brealloc(loadwall, ournumwalls*sizeof(walltype));
loadsector = (sectortype *)Brealloc(loadsector, ournumsectors*sizeof(sectortype));
loadwall = (walltype *)Brealloc(loadwall, ournumwalls*sizeof(walltype));
Bmemcpy(sector, loadsector, ournumsectors*sizeof(sectortype));
Bmemcpy(wall, loadwall, ournumwalls*sizeof(walltype));
@ -1405,7 +1419,7 @@ int32_t clipmapinfo_load(void)
// vvvv don't use headsprite[sect,stat]! vvvv
sectoidx = Bmalloc(numsectors*sizeof(sectoidx[0]));
sectoidx = (int16_t *)Bmalloc(numsectors*sizeof(sectoidx[0]));
if (!sectoidx || !sector || !wall)
{
clipmapinfo_init();
@ -1447,8 +1461,8 @@ int32_t clipmapinfo_load(void)
int16_t ns, outersect;
int32_t pn,scnt, x,y,z, maxdist;
sectq = Bmalloc(numsectors*sizeof(sectq[0]));
tempictoidx = Bmalloc(MAXTILES*sizeof(tempictoidx[0]));
sectq = (int16_t *)Bmalloc(numsectors*sizeof(sectq[0]));
tempictoidx = (int16_t *)Bmalloc(MAXTILES*sizeof(tempictoidx[0]));
if (!sectq || !tempictoidx)
{
clipmapinfo_init();
@ -1687,7 +1701,7 @@ int32_t clipmapinfo_load(void)
Bmemcpy(loadwall, wall, ournumwalls*sizeof(walltype));
// loadwallinv will contain all walls with inverted orientation for x/y-flip handling
loadwallinv = Bmalloc(ournumwalls*sizeof(walltype));
loadwallinv = (walltype *)Bmalloc(ournumwalls*sizeof(walltype));
if (!loadwallinv)
{
clipmapinfo_init();
@ -2265,9 +2279,6 @@ static int32_t globalhisibility, globalpisibility, globalcisibility;
int32_t xyaspect;
static int32_t viewingrangerecip;
intptr_t asm1, asm2, asm3, asm4, palookupoffse[4];
int32_t vplce[4], vince[4];
intptr_t bufplce[4];
static char globalxshift, globalyshift;
static int32_t globalxpanning, globalypanning;
int32_t globalshade, globalorientation;
@ -2277,9 +2288,6 @@ static int32_t globalzd, globalyscale;
static int32_t globalxspan, globalyspan, globalispow2=1; // true if texture has power-of-two x and y size
static intptr_t globalbufplc;
int32_t globaltilesizy;
int32_t globalx1, globaly2, globalx3, globaly3;
static int32_t globaly1, globalx2, globalzx;
static int32_t globalx, globaly, globalz;
@ -4354,7 +4362,7 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i
int32_t dapyscale;
int16_t dapskybits;
static const int16_t zeropskyoff[MAXPSKYTILES];
static const int16_t zeropskyoff[MAXPSKYTILES] = { 0 };
const int16_t *dapskyoff;
UNREFERENCED_PARAMETER(dax1);
@ -7569,14 +7577,14 @@ static int32_t loadtables(void)
reciptable[i] = divscale30(2048, i+2048);
for (i=0; i<=512; i++)
sintable[i] = 16384*sin(i*BANG2RAD);
sintable[i] = (int16_t)(16384*sin(i*BANG2RAD));
for (i=513; i<1024; i++)
sintable[i] = sintable[1024-i];
for (i=1024; i<2048; i++)
sintable[i] = -sintable[i-1024];
for (i=0; i<640; i++)
radarang[i] = -64*atan((640-0.5-i)/160)/BANG2RAD;
radarang[i] = (int16_t)(-64*atan((640-0.5-i)/160)/BANG2RAD);
for (i=0; i<640; i++)
radarang[1279-i] = -radarang[i];
@ -7670,8 +7678,8 @@ static int32_t loadpalette(void)
kread(fil,palette,768);
kread(fil,&numshades,2); numshades = B_LITTLE16(numshades);
palookup[0] = Bmalloc(numshades<<8);
transluc = Bmalloc(65536);
palookup[0] = (char *)Bmalloc(numshades<<8);
transluc = (char *)Bmalloc(65536);
if (palookup[0] == NULL || transluc == NULL)
exit(1);
@ -8256,7 +8264,7 @@ int32_t initengine(void)
#if !defined _WIN32 && defined DEBUGGINGAIDS && !defined GEKKO
struct sigaction sigact, oldact;
memset(&sigact, 0, sizeof(sigact));
sigact.sa_sigaction = (void *)sighandler;
sigact.sa_sigaction = (void (*)(int, siginfo_t*, void*))sighandler;
sigact.sa_flags = SA_SIGINFO;
sigaction(SIGFPE, &sigact, &oldact);
#endif
@ -9396,7 +9404,7 @@ static void check_sprite(int32_t i)
{
if ((unsigned)sprite[i].sectnum >= MYMAXSECTORS())
{
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal sector (%d). Map is corrupt!\n",
initprintf_nowarn(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal sector (%d). Map is corrupt!\n",
i, sprite[i].x, sprite[i].y, sprite[i].sectnum);
updatesector(sprite[i].x, sprite[i].y, &sprite[i].sectnum);
@ -9407,14 +9415,14 @@ static void check_sprite(int32_t i)
if ((unsigned)sprite[i].statnum >= MAXSTATUS)
{
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal statnum (%d). Map is corrupt!\n",
initprintf_nowarn(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal statnum (%d). Map is corrupt!\n",
i, sprite[i].x, sprite[i].y, sprite[i].statnum);
sprite[i].statnum = 0;
}
if ((unsigned)sprite[i].picnum >= MAXTILES)
{
initprintf(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal picnum (%d). Map is corrupt!\n",
initprintf_nowarn(OSD_ERROR "Map error: sprite #%d (%d,%d) with illegal picnum (%d). Map is corrupt!\n",
i, sprite[i].x, sprite[i].y, sprite[i].picnum);
sprite[i].picnum = 0;
}
@ -10070,14 +10078,14 @@ int32_t saveboard(const char *filename, const vec3_t *dapos, int16_t daang, int1
{
if ((unsigned)sprite[j].statnum > MAXSTATUS)
{
initprintf("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",
initprintf_nowarn("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",
j,sprite[j].x,sprite[j].y,sprite[j].statnum);
changespritestat(j,0);
}
if ((unsigned)sprite[j].sectnum > MAXSECTORS)
{
initprintf("Map error: sprite #%d(%d,%d) with an illegal sectnum(%d)\n",
initprintf_nowarn("Map error: sprite #%d(%d,%d) with an illegal sectnum(%d)\n",
j,sprite[j].x,sprite[j].y,sprite[j].sectnum);
changespritesect(j,0);
}
@ -10301,7 +10309,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
Bfree(lookups);
j = ydim*4; //Leave room for horizlookup&horizlookup2
lookups = Bmalloc(2*j*sizeof(lookups[0]));
lookups = (int32_t *)Bmalloc(2*j*sizeof(lookups[0]));
if (lookups == NULL)
{
@ -10514,7 +10522,7 @@ int32_t loadpics(const char *filename, int32_t askedsize)
if (filegrp[fil] == 254) // from zip
{
i = kfilelength(fil);
artptrs[tilefilei] = Brealloc(artptrs[tilefilei], i);
artptrs[tilefilei] = (char *)Brealloc(artptrs[tilefilei], i);
klseek(fil, 0, BSEEK_SET);
kread(fil, artptrs[tilefilei], i);
}
@ -13606,7 +13614,7 @@ void makepalookup(int32_t palnum, const char *remapbuf, int8_t r, int8_t g, int8
if (palookup[palnum] == NULL || (palnum!=0 && palookup[palnum] == palookup[0]))
{
//Allocate palookup buffer
palookup[palnum] = Bmalloc(numshades<<8);
palookup[palnum] = (char *)Bmalloc(numshades<<8);
if (palookup[palnum] == NULL)
exit(1);
}
@ -14307,7 +14315,7 @@ void setfirstwall(int16_t sectnum, int16_t newfirstwall)
if ((newfirstwall < startwall) || (newfirstwall >= startwall+danumwalls)) return;
tmpwall = Bmalloc(danumwalls * sizeof(walltype));
tmpwall = (walltype *)Bmalloc(danumwalls * sizeof(walltype));
if (!tmpwall)
{
initprintf("setfirstwall: OUT OF MEMORY!\n");
@ -15937,7 +15945,7 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha
text = (png_textp)png_malloc(png_ptr, 2*png_sizeof(png_text));
text[0].compression = PNG_TEXT_COMPRESSION_NONE;
text[0].key = "Title";
text[0].text = editstatus ? "Mapster32 screenshot" : "EDuke32 screenshot";
text[0].text = (png_charp)(editstatus ? "Mapster32 screenshot" : "EDuke32 screenshot");
text[1].compression = PNG_TEXT_COMPRESSION_NONE;
text[1].key = "Software";
@ -16250,7 +16258,7 @@ void setpolymost2dview(void)
void hash_init(hashtable_t *t)
{
hash_free(t);
t->items=Bcalloc(1, t->size * sizeof(hashitem_t));
t->items=(hashitem_t **)Bcalloc(1, t->size * sizeof(hashitem_t));
}
void hash_free(hashtable_t *t)

View file

@ -17,6 +17,15 @@
# define YAX_MAXDRAWS 8
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern intptr_t asm1, asm2, asm3, asm4;
extern int32_t globalx1, globaly2;
#ifdef __cplusplus
};
#endif
//#define OBSOLETE_RENDMODES
extern uint8_t basepalcount;
@ -34,10 +43,9 @@ extern int32_t globalpal, cosglobalang, singlobalang;
extern int32_t cosviewingrangeglobalang, sinviewingrangeglobalang;
extern int32_t globalvisibility;
extern int32_t xyaspect;
extern intptr_t asm1, asm2, asm3, asm4;
extern int32_t globalshade;
extern int16_t globalpicnum;
extern int32_t globalx1, globaly2;
extern int32_t globalorientation;
extern int16_t editstatus;

View file

@ -294,7 +294,7 @@ bwglSetPixelFormatProcPtr bwglSetPixelFormat;
bwglSwapIntervalEXTProcPtr bwglSwapIntervalEXT;
bwglCreateContextAttribsARBProcPtr bwglCreateContextAttribsARB;
static HANDLE hGLDLL, hGLUDLL;
static HMODULE hGLDLL, hGLUDLL;
#else
#include <dlfcn.h>

View file

@ -125,7 +125,7 @@ static const int32_t pow2long[32] =
0x00010000,0x00020000,0x00040000,0x00080000,
0x00100000,0x00200000,0x00400000,0x00800000,
0x01000000,0x02000000,0x04000000,0x08000000,
0x10000000,0x20000000,0x40000000,0x80000000,
0x10000000,0x20000000,0x40000000,(int32_t)0x80000000,
};
//Hack for peekbits,getbits,suckbits (to prevent lots of duplicate code)

View file

@ -369,7 +369,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *
ma.fpssc = fpssc;
ma.flags = flags;
map = Bmalloc(sizeof(mdanim_t));
map = (mdanim_t *)Bmalloc(sizeof(mdanim_t));
if (!map) return(-4);
Bmemcpy(map, &ma, sizeof(ma));
@ -721,7 +721,7 @@ static int32_t mdloadskin_cached(int32_t fil, const texcacheheader *head, int32_
if (!picc) goto failure; else midbuf = picc;
}
if (dedxtfilter(fil, &pict, pic, midbuf, packbuf, (head->flags&4)==4)) goto failure;
if (dedxtfilter(fil, &pict, (char *)pic, (char *)midbuf, (char *)packbuf, (head->flags&4)==4)) goto failure;
bglCompressedTexImage2DARB(GL_TEXTURE_2D,level,pict.format,pict.xdim,pict.ydim,pict.border,
pict.size,pic);
@ -1156,7 +1156,7 @@ static void mdloadvbos(md3model_t *m)
{
int32_t i;
m->vbos = Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->vbos = (GLuint *)Bmalloc(m->head.numsurfs * sizeof(GLuint));
bglGenBuffersARB(m->head.numsurfs, m->vbos);
i = 0;
@ -1412,9 +1412,9 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
m3->skinmap = sk;
}
m3->indexes = Bmalloc(sizeof(uint16_t) * s->numtris);
m3->vindexes = Bmalloc(sizeof(uint16_t) * s->numtris * 3);
m3->maxdepths = Bmalloc(sizeof(float) * s->numtris);
m3->indexes = (uint16_t *)Bmalloc(sizeof(uint16_t) * s->numtris);
m3->vindexes = (uint16_t *)Bmalloc(sizeof(uint16_t) * s->numtris * 3);
m3->maxdepths = (float *)Bmalloc(sizeof(float) * s->numtris);
if (!m3->indexes || !m3->vindexes || !m3->maxdepths)
QuitOnFatalError("OUT OF MEMORY in md2load!");
@ -1634,9 +1634,9 @@ static md3model_t *md3load(int32_t fil)
}
#endif
m->indexes = Bmalloc(sizeof(uint16_t) * maxtrispersurf);
m->vindexes = Bmalloc(sizeof(uint16_t) * maxtrispersurf * 3);
m->maxdepths = Bmalloc(sizeof(float) * maxtrispersurf);
m->indexes = (uint16_t *)Bmalloc(sizeof(uint16_t) * maxtrispersurf);
m->vindexes = (uint16_t *)Bmalloc(sizeof(uint16_t) * maxtrispersurf * 3);
m->maxdepths = (float *)Bmalloc(sizeof(float) * maxtrispersurf);
if (!m->indexes || !m->vindexes || !m->maxdepths)
QuitOnFatalError("OUT OF MEMORY in md3load!");
@ -1852,9 +1852,9 @@ int md3postload_polymer(md3model_t *m)
initprintf("size %d (%d fr, %d v): md %s surf %d/%d\n", i, m->head.numframes, s->numverts,
m->head.nam, surfi, m->head.numsurfs);
#endif
s->geometry = Bcalloc(m->head.numframes * s->numverts * sizeof(float), 15);
s->geometry = (float *)Bcalloc(m->head.numframes * s->numverts * sizeof(float), 15);
numtris = Bcalloc(s->numverts, sizeof(int));
numtris = (int *)Bcalloc(s->numverts, sizeof(int));
if (!s->geometry || !numtris)
QuitOnFatalError("OUT OF MEMORY in md3postload_polymer!");
@ -3468,8 +3468,8 @@ int32_t mddraw(const spritetype *tspr)
if (r_vbos && (r_vbocount > allocvbos))
{
indexvbos = Brealloc(indexvbos, sizeof(GLuint) * r_vbocount);
vertvbos = Brealloc(vertvbos, sizeof(GLuint) * r_vbocount);
indexvbos = (GLuint *)Brealloc(indexvbos, sizeof(GLuint) * r_vbocount);
vertvbos = (GLuint *)Brealloc(vertvbos, sizeof(GLuint) * r_vbocount);
bglGenBuffersARB(r_vbocount - allocvbos, &(indexvbos[allocvbos]));
bglGenBuffersARB(r_vbocount - allocvbos, &(vertvbos[allocvbos]));

View file

@ -782,9 +782,7 @@ void polymer_uninit(void)
void polymer_setaspect(int32_t ang)
{
float aspect;
float fang = ang;
fang *= atanf((float)viewingrange/65536.0f)/(PI/4);
float fang = (float)ang * atanf((float)viewingrange/65536.0f)/(PI/4);
if (pr_customaspect != 0.0f)
aspect = pr_customaspect;
@ -1171,7 +1169,7 @@ void polymer_editorpick(void)
GLfloat dadepth;
int16_t k, bestk=0;
GLfloat bestwdistsq = 3.4e38, wdistsq;
GLfloat bestwdistsq = (GLfloat)3.4e38, wdistsq;
GLfloat w1[2], w2[2], w21[2], pw1[2], pw2[2];
GLfloat ptonline[2];
GLfloat scrvxz[2];
@ -1574,7 +1572,7 @@ void polymer_texinvalidate(void)
void polymer_definehighpalookup(char basepalnum, char palnum, char *data)
{
prhighpalookups[basepalnum][palnum].data = Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
prhighpalookups[basepalnum][palnum].data = (char *)Bmalloc(PR_HIGHPALOOKUP_DATA_SIZE);
Bmemcpy(prhighpalookups[basepalnum][palnum].data, data, PR_HIGHPALOOKUP_DATA_SIZE);
}
@ -1634,8 +1632,8 @@ static void polymer_displayrooms(int16_t dacursectnum)
mirrorcount = 0;
localsectormasks = Bmalloc(sizeof(int16_t) * numsectors);
localsectormaskcount = Bcalloc(sizeof(int16_t), 1);
localsectormasks = (int16_t *)Bmalloc(sizeof(int16_t) * numsectors);
localsectormaskcount = (int16_t *)Bcalloc(sizeof(int16_t), 1);
cursectormasks = localsectormasks;
cursectormaskcount = localsectormaskcount;
@ -2176,17 +2174,17 @@ static int32_t polymer_initsector(int16_t sectnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Initializing sector %i...\n", sectnum);
sec = &sector[sectnum];
s = Bcalloc(1, sizeof(_prsector));
s = (_prsector *)Bcalloc(1, sizeof(_prsector));
if (s == NULL)
{
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : Bmalloc failed.\n", sectnum);
return (0);
}
s->verts = Bcalloc(sec->wallnum, sizeof(GLdouble) * 3);
s->floor.buffer = Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->verts = (GLdouble *)Bcalloc(sec->wallnum, sizeof(GLdouble) * 3);
s->floor.buffer = (GLfloat *)Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->floor.vertcount = sec->wallnum;
s->ceil.buffer = Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->ceil.buffer = (GLfloat *)Bcalloc(sec->wallnum, sizeof(GLfloat) * 5);
s->ceil.vertcount = sec->wallnum;
if ((s->verts == NULL) || (s->floor.buffer == NULL) || (s->ceil.buffer == NULL))
{
@ -2356,9 +2354,9 @@ static int32_t polymer_updatesector(int16_t sectnum)
heidiff = (int32_t)(curbuffer[(i*5)+1] - curbuffer[1]);
// don't forget the sign, tey could be negative with concave sectors
if (tey >= 0)
tey = (int32_t)sqrt((tey * tey) + (heidiff * heidiff));
tey = (int32_t)sqrt((double)((tey * tey) + (heidiff * heidiff)));
else
tey = -(int32_t)sqrt((tey * tey) + (heidiff * heidiff));
tey = -(int32_t)sqrt((double)((tey * tey) + (heidiff * heidiff)));
}
if (curstat & 4)
@ -2516,8 +2514,8 @@ void PR_CALLBACK polymer_tessvertex(void* vertex, void* sector)
{
if (pr_verbosity >= 2) OSD_Printf("PR : Indice overflow, extending the indices list... !\n");
s->indicescount++;
s->floor.indices = Brealloc(s->floor.indices, s->indicescount * sizeof(GLushort));
s->ceil.indices = Brealloc(s->ceil.indices, s->indicescount * sizeof(GLushort));
s->floor.indices = (GLushort *)Brealloc(s->floor.indices, s->indicescount * sizeof(GLushort));
s->ceil.indices = (GLushort *)Brealloc(s->ceil.indices, s->indicescount * sizeof(GLushort));
}
s->ceil.indices[s->curindice] = (intptr_t)vertex;
s->curindice++;
@ -2541,15 +2539,15 @@ static int32_t polymer_buildfloor(int16_t sectnum)
if (s->floor.indices == NULL)
{
s->indicescount = (max(3, sec->wallnum) - 2) * 3;
s->floor.indices = Bcalloc(s->indicescount, sizeof(GLushort));
s->ceil.indices = Bcalloc(s->indicescount, sizeof(GLushort));
s->floor.indices = (GLushort *)Bcalloc(s->indicescount, sizeof(GLushort));
s->ceil.indices = (GLushort *)Bcalloc(s->indicescount, sizeof(GLushort));
}
s->curindice = 0;
bgluTessCallback(prtess, GLU_TESS_VERTEX_DATA, polymer_tessvertex);
bgluTessCallback(prtess, GLU_TESS_EDGE_FLAG, polymer_tessedgeflag);
bgluTessCallback(prtess, GLU_TESS_ERROR, polymer_tesserror);
bgluTessCallback(prtess, GLU_TESS_VERTEX_DATA, (void (PR_CALLBACK *)(void))polymer_tessvertex);
bgluTessCallback(prtess, GLU_TESS_EDGE_FLAG, (void (PR_CALLBACK *)(void))polymer_tessedgeflag);
bgluTessCallback(prtess, GLU_TESS_ERROR, (void (PR_CALLBACK *)(void))polymer_tesserror);
bgluTessProperty(prtess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE);
@ -2686,7 +2684,7 @@ static int32_t polymer_initwall(int16_t wallnum)
if (pr_verbosity >= 2) OSD_Printf("PR : Initializing wall %i...\n", wallnum);
w = Bcalloc(1, sizeof(_prwall));
w = (_prwall *)Bcalloc(1, sizeof(_prwall));
if (w == NULL)
{
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize wall %i : Bmalloc failed.\n", wallnum);
@ -2694,13 +2692,13 @@ static int32_t polymer_initwall(int16_t wallnum)
}
if (w->mask.buffer == NULL) {
w->mask.buffer = Bmalloc(4 * sizeof(GLfloat) * 5);
w->mask.buffer = (GLfloat *)Bmalloc(4 * sizeof(GLfloat) * 5);
w->mask.vertcount = 4;
}
if (w->bigportal == NULL)
w->bigportal = Bmalloc(4 * sizeof(GLfloat) * 5);
w->bigportal = (GLfloat *)Bmalloc(4 * sizeof(GLfloat) * 5);
if (w->cap == NULL)
w->cap = Bmalloc(4 * sizeof(GLfloat) * 3);
w->cap = (GLfloat *)Bmalloc(4 * sizeof(GLfloat) * 3);
bglGenBuffersARB(1, &w->wall.vbo);
bglGenBuffersARB(1, &w->over.vbo);
@ -2794,7 +2792,7 @@ static void polymer_updatewall(int16_t wallnum)
}
if (w->wall.buffer == NULL) {
w->wall.buffer = Bcalloc(4, sizeof(GLfloat) * 5); // XXX
w->wall.buffer = (GLfloat *)Bcalloc(4, sizeof(GLfloat) * 5); // XXX
w->wall.vertcount = 4;
}
@ -2995,7 +2993,7 @@ static void polymer_updatewall(int16_t wallnum)
if ((overwall) || (wal->cstat & 16) || (wal->cstat & 32))
{
if (w->over.buffer == NULL) {
w->over.buffer = Bmalloc(4 * sizeof(GLfloat) * 5);
w->over.buffer = (GLfloat *)Bmalloc(4 * sizeof(GLfloat) * 5);
w->over.vertcount = 4;
}
@ -3467,7 +3465,7 @@ void polymer_updatesprite(int32_t snum)
{
int32_t curpicnum, xsize, ysize, tilexoff, tileyoff, xoff, yoff, i, j, cs;
spritetype *tspr = tspriteptr[snum];
float xratio, yratio, ang;
float xratio, yratio, ang, f;
float spos[3];
const GLfloat *inbuffer;
uint8_t flipu, flipv;
@ -3485,7 +3483,7 @@ void polymer_updatesprite(int32_t snum)
if (prsprites[tspr->owner] == NULL)
{
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sprite %i : Bmalloc failed.\n", tspr->owner);
if (pr_verbosity >= 1) OSD_Printf_nowarn("PR : Cannot initialize sprite %i : Bmalloc failed.\n", tspr->owner);
return;
}
@ -3523,7 +3521,8 @@ void polymer_updatesprite(int32_t snum)
s->plane.material.diffusemodulation[3] = 0xAA;
}
s->plane.material.diffusemodulation[3] *= (1.0f - spriteext[tspr->owner].alpha);
f = s->plane.material.diffusemodulation[3] * (1.0f - spriteext[tspr->owner].alpha);
s->plane.material.diffusemodulation[3] = (GLubyte)f;
if (searchit == 2)
{
@ -4098,7 +4097,7 @@ static void polymer_drawmdsprite(spritetype *tspr)
color = mdspritematerial.diffusemodulation;
color[0] = color[1] = color[2] =
((float)(numshades-min(max((tspr->shade * shadescale)+m->shadeoff,0),numshades)))/((float)numshades) * 0xFF;
(GLubyte)(((float)(numshades-min(max((tspr->shade * shadescale)+m->shadeoff,0),numshades)))/((float)numshades) * 0xFF);
usinghighpal = (pr_highpalookups &&
prhighpalookups[curbasepal][tspr->pal].map);
@ -4109,9 +4108,14 @@ static void polymer_drawmdsprite(spritetype *tspr)
{
if (!(m->flags&1) || (!(tspr->owner >= MAXSPRITES) && sector[sprite[tspr->owner].sectnum].floorpal!=0))
{
color[0] *= (float)hictinting[tspr->pal].r / 255.0;
color[1] *= (float)hictinting[tspr->pal].g / 255.0;
color[2] *= (float)hictinting[tspr->pal].b / 255.0;
double f;
f = color[0] * (float)hictinting[tspr->pal].r / 255.0;
color[0] = (GLubyte)f;
f = color[1] * (float)hictinting[tspr->pal].g / 255.0;
color[1] = (GLubyte)f;
f = color[2] * (float)hictinting[tspr->pal].b / 255.0;
color[2] = (GLubyte)f;
}
else globalnoeffect=1; //mdloadskin reads this
}
@ -4122,9 +4126,14 @@ static void polymer_drawmdsprite(spritetype *tspr)
hictinting[MAXPALOOKUPS-1].g != 255 ||
hictinting[MAXPALOOKUPS-1].b != 255))
{
color[0] *= hictinting[MAXPALOOKUPS-1].r / 255.0;
color[1] *= hictinting[MAXPALOOKUPS-1].g / 255.0;
color[2] *= hictinting[MAXPALOOKUPS-1].b / 255.0;
double f;
f = color[0] * hictinting[MAXPALOOKUPS-1].r / 255.0;
color[0] = (GLubyte)f;
f = color[1] * hictinting[MAXPALOOKUPS-1].g / 255.0;
color[1] = (GLubyte)f;
f = color[2] * hictinting[MAXPALOOKUPS-1].b / 255.0;
color[2] = (GLubyte)f;
}
if (tspr->cstat & 2)
@ -4136,7 +4145,10 @@ static void polymer_drawmdsprite(spritetype *tspr)
} else
color[3] = 0xFF;
color[3] *= (1.0f - spriteext[tspr->owner].alpha);
{
double f = color[3] * (1.0f - spriteext[tspr->owner].alpha);
color[3] = (GLubyte)f;
}
if (searchit == 2)
{
@ -4373,9 +4385,9 @@ static void polymer_loadmodelvbos(md3model_t* m)
int32_t i;
md3surf_t *s;
m->indices = Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->texcoords = Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->geometry = Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->indices = (GLuint *)Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->texcoords = (GLuint *)Bmalloc(m->head.numsurfs * sizeof(GLuint));
m->geometry = (GLuint *)Bmalloc(m->head.numsurfs * sizeof(GLuint));
bglGenBuffersARB(m->head.numsurfs, m->indices);
bglGenBuffersARB(m->head.numsurfs, m->texcoords);
@ -4481,24 +4493,34 @@ static void polymer_getbuildmaterial(_prmaterial* material, int16_t tile
material->diffusemodulation[0] =
material->diffusemodulation[1] =
material->diffusemodulation[2] =
((float)(numshades-min(max((shade * shadescale),0),numshades)))/((float)numshades) * 0xFF;
(GLubyte)(((float)(numshades-min(max((shade * shadescale),0),numshades)))/((float)numshades) * 0xFF);
if (pth->flags & 2)
{
if (pth->palnum != pal)
{
material->diffusemodulation[0] *= (float)hictinting[pal].r / 255.0;
material->diffusemodulation[1] *= (float)hictinting[pal].g / 255.0;
material->diffusemodulation[2] *= (float)hictinting[pal].b / 255.0;
double f;
f = material->diffusemodulation[0] * (float)hictinting[pal].r / 255.0;
material->diffusemodulation[0] = (GLubyte)f;
f = material->diffusemodulation[1] * (float)hictinting[pal].g / 255.0;
material->diffusemodulation[1] = (GLubyte)f;
f = material->diffusemodulation[2] * (float)hictinting[pal].b / 255.0;
material->diffusemodulation[2] = (GLubyte)f;
}
// fullscreen tint on global palette change... this is used for nightvision and underwater tinting
// if ((hictinting[MAXPALOOKUPS-1].r + hictinting[MAXPALOOKUPS-1].g + hictinting[MAXPALOOKUPS-1].b) != 0x2FD)
if (!usinghighpal && ((uint32_t)hictinting[MAXPALOOKUPS-1].r & 0xFFFFFF00) != 0xFFFFFF00)
{
material->diffusemodulation[0] *= hictinting[MAXPALOOKUPS-1].r / 255.0;
material->diffusemodulation[1] *= hictinting[MAXPALOOKUPS-1].g / 255.0;
material->diffusemodulation[2] *= hictinting[MAXPALOOKUPS-1].b / 255.0;
double f;
f = material->diffusemodulation[0] * hictinting[MAXPALOOKUPS-1].r / 255.0;
material->diffusemodulation[0] = (GLubyte)f;
f = material->diffusemodulation[1] * hictinting[MAXPALOOKUPS-1].g / 255.0;
material->diffusemodulation[1] = (GLubyte)f;
f = material->diffusemodulation[2] * hictinting[MAXPALOOKUPS-1].b / 255.0;
material->diffusemodulation[2] = (GLubyte)f;
}
}
@ -5227,7 +5249,7 @@ out:
}
oldhead = prlights[lighti].planelist;
prlights[lighti].planelist = Bmalloc(sizeof(_prplanelist));
prlights[lighti].planelist = (_prplanelist *)Bmalloc(sizeof(_prplanelist));
prlights[lighti].planelist->n = oldhead;
prlights[lighti].planelist->plane = plane;
@ -5653,7 +5675,7 @@ static void polymer_initrendertargets(int32_t count)
ocount = count;
//////////
prrts = Bcalloc(count, sizeof(_prrt));
prrts = (_prrt *)Bcalloc(count, sizeof(_prrt));
i = 0;
while (i < count)

View file

@ -1544,14 +1544,14 @@ void writexcache(const char *fn, int32_t len, int32_t dameth, char effect, texca
if (alloclen < miplen)
{
void *picc = Brealloc(pic, miplen);
char *picc = (char *)Brealloc(pic, miplen);
if (!picc) goto failure; else pic = picc;
alloclen = miplen;
picc = Brealloc(packbuf, alloclen+400);
picc = (char *)Brealloc(packbuf, alloclen+400);
if (!picc) goto failure; else packbuf = picc;
picc = Brealloc(midbuf, miplen);
picc = (char *)Brealloc(midbuf, miplen);
if (!picc) goto failure; else midbuf = picc;
}
@ -1666,14 +1666,14 @@ static int32_t gloadtile_cached(int32_t fil, const texcacheheader *head, int32_t
if (alloclen < pict.size)
{
void *picc = Brealloc(pic, pict.size);
char *picc = (char *)Brealloc(pic, pict.size);
if (!picc) goto failure; else pic = picc;
alloclen = pict.size;
picc = Brealloc(packbuf, alloclen+16);
picc = (char *)Brealloc(packbuf, alloclen+16);
if (!picc) goto failure; else packbuf = picc;
picc = Brealloc(midbuf, pict.size);
picc = (char *)Brealloc(midbuf, pict.size);
if (!picc) goto failure; else midbuf = picc;
}
@ -1831,13 +1831,13 @@ static int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicre
lastfn = fn; // careful...
if (!lastpic)
{
lastpic = Bmalloc(xsiz*ysiz*sizeof(coltype));
lastpic = (coltype *)Bmalloc(xsiz*ysiz*sizeof(coltype));
lastsize = xsiz*ysiz;
}
else if (lastsize < xsiz*ysiz)
{
Bfree(lastpic);
lastpic = Bmalloc(xsiz*ysiz*sizeof(coltype));
lastpic = (coltype *)Bmalloc(xsiz*ysiz*sizeof(coltype));
}
if (lastpic)
Bmemcpy(lastpic, pic, xsiz*ysiz*sizeof(coltype));
@ -3372,7 +3372,7 @@ static void polymost_drawalls(int32_t bunch)
int32_t i, x, y, z, cz, fz, wallnum, sectnum, nextsectnum;
int16_t dapskybits;
static const int16_t zeropskyoff[MAXPSKYTILES];
static const int16_t zeropskyoff[MAXPSKYTILES] = { 0 };
const int16_t *dapskyoff;
sectnum = thesector[bunchfirst[bunch]]; sec = &sector[sectnum];
@ -6547,7 +6547,7 @@ int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, voi
if (stride == 16) //If DXT3...
{
//alpha_4x4
cptr = midbuf;
cptr = (char *)midbuf;
for (k=0; k<8; k++) *cptr++ = pic[k];
for (j=stride; (unsigned)j<miplen; j+=stride)
for (k=0; k<8; k++) *cptr++ = pic[j+k];
@ -6573,7 +6573,7 @@ int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, voi
}
//rgb0,rgb1
cptr = midbuf;
cptr = (char *)midbuf;
for (k=0; k<=2; k+=2)
for (j=0; (unsigned)j<miplen; j+=stride)
{ *(int16_t *)cptr = hicosub(*(int16_t *)(&pic[offs+j+k])); cptr += 2; }
@ -6598,7 +6598,7 @@ int32_t dxtfilter(int32_t fil, const texcachepicture *pict, const char *pic, voi
Bwrite(fil,writebuf,cleng);
//index_4x4
cptr = midbuf;
cptr = (char *)midbuf;
for (j=0; (unsigned)j<miplen; j+=stride)
{
const char *c2 = &pic[j+offs+4];
@ -6689,7 +6689,7 @@ int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *m
if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1;
}
cptr = midbuf;
cptr = (char *)midbuf;
for (k=0; k<8; k++) pic[k] = *cptr++;
for (j=stride; j<pict->size; j+=stride)
for (k=0; k<8; k++) pic[j+k] = (*cptr++);
@ -6736,7 +6736,7 @@ int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *m
if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1;
}
cptr = midbuf;
cptr = (char *)midbuf;
for (k=0; k<=2; k+=2)
{
for (j=0; j<pict->size; j+=stride)
@ -6787,7 +6787,7 @@ int32_t dedxtfilter(int32_t fil, const texcachepicture *pict, char *pic, void *m
if (qlz_decompress(packbuf,midbuf,state_decompress) == 0) return -1;
}
cptr = midbuf;
cptr = (char *)midbuf;
for (j=0; j<pict->size; j+=stride)
{
pic[j+offs+4] = ((cptr[0]>>0)&3) + (((cptr[1]>>0)&3)<<2) + (((cptr[2]>>0)&3)<<4) + (((cptr[3]>>0)&3)<<6);

View file

@ -341,14 +341,14 @@ void qinterpolatedown16short(intptr_t bufptr, int32_t num, int32_t val, int32_t
void clearbuf(void *d, int32_t c, int32_t a)
{
int32_t *p = d;
int32_t *p = (int32_t *)d;
while ((c--) > 0) *(p++) = a;
}
void copybuf(const void *s, void *d, int32_t c)
{
const int32_t *p = s;
const int32_t *p = (const int32_t *)s;
int32_t *q = (int32_t *)d;
while ((c--) > 0) *(q++) = *(p++);
@ -371,7 +371,7 @@ void clearbufbyte(void *D, int32_t c, int32_t a)
{
// Cringe City
char *p = (char *)D;
int32_t m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l };
int32_t m[4] = { 0xffl,0xff00l,0xff0000l,(int32_t)0xff000000l };
int32_t n[4] = { 0,8,16,24 };
int32_t z=0;
while ((c--) > 0)
@ -383,16 +383,16 @@ void clearbufbyte(void *D, int32_t c, int32_t a)
void copybufbyte(const void *S, void *D, int32_t c)
{
const char *p = S;
char *q = D;
const char *p = (const char *)S;
char *q = (char *)D;
while ((c--) > 0) *(q++) = *(p++);
}
void copybufreverse(const void *S, void *D, int32_t c)
{
const char *p = S;
char *q = D;
const char *p = (const char *)S;
char *q = (char *)D;
while ((c--) > 0) *(q++) = *(p--);
}

View file

@ -527,7 +527,7 @@ int32_t initinput(void)
for (i=0; i<SDLK_LAST; i++)
{
if (!keytranslation[i]) continue;
Bstrncpyz(key_names[ keytranslation[i] ], SDL_GetKeyName(i), sizeof(key_names[i]));
Bstrncpyz(key_names[ keytranslation[i] ], SDL_GetKeyName((SDLKey)i), sizeof(key_names[i]));
}
#else
for (i=0; i<SDL_NUM_SCANCODES; i++)

View file

@ -192,9 +192,9 @@ static void PopulateForm(void)
gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
if (i == mode3d)
{
g_signal_handlers_block_by_func(box3d, on_vmode3dcombo_changed, NULL);
g_signal_handlers_block_by_func(box3d, (gpointer)on_vmode3dcombo_changed, NULL);
gtk_combo_box_set_active_iter(box3d, &iter);
g_signal_handlers_unblock_by_func(box3d, on_vmode3dcombo_changed, NULL);
g_signal_handlers_unblock_by_func(box3d, (gpointer)on_vmode3dcombo_changed, NULL);
}
// only 8-bit modes get used for 2D
@ -204,9 +204,9 @@ static void PopulateForm(void)
gtk_list_store_set(modes2d, &iter, 0,buf, 1,i, -1);
if (i == mode2d)
{
g_signal_handlers_block_by_func(box2d, on_vmode2dcombo_changed, NULL);
g_signal_handlers_block_by_func(box2d, (gpointer)on_vmode2dcombo_changed, NULL);
gtk_combo_box_set_active_iter(box2d, &iter);
g_signal_handlers_unblock_by_func(box2d, on_vmode2dcombo_changed, NULL);
g_signal_handlers_unblock_by_func(box2d, (gpointer)on_vmode2dcombo_changed, NULL);
}
}
@ -254,7 +254,7 @@ static GtkWidget *create_window(void)
// 2D video mode label
stwidgets.vmode2dlabel = gtk_label_new_with_mnemonic("_2D Video mode:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.vmode2dlabel), 0.3, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 6);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dlabel, 0,1, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 6);
// 2D video mode combo
{
@ -268,14 +268,15 @@ static GtkWidget *create_window(void)
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_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 6);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode2dcombo, 1,2, 0,1,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 6);
gtk_widget_add_accelerator(stwidgets.vmode2dcombo, "grab_focus", stwidgets.accel_group,
GDK_2, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// Fullscreen checkbox
stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.fullscreencheck, 2,3, 0,1, GTK_FILL, 0, 4, 6);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.fullscreencheck, 2,3, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 6);
gtk_widget_add_accelerator(stwidgets.fullscreencheck, "grab_focus", stwidgets.accel_group,
GDK_F, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
@ -283,7 +284,7 @@ static GtkWidget *create_window(void)
// 3D video mode label
stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_3D Video mode:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 1,2, GTK_FILL, 0, 4, 6);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 1,2, GTK_FILL, (GtkAttachOptions)0, 4, 6);
// 3D video mode combo
{
@ -297,17 +298,19 @@ static GtkWidget *create_window(void)
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_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 1,2,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0);
gtk_widget_add_accelerator(stwidgets.vmode3dcombo, "grab_focus", stwidgets.accel_group,
GDK_3, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
// Empty horizontal layout
stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,1, 2,3, 0, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,1, 2,3, (GtkAttachOptions)0,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 0, 0);
// Always show config checkbox
stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show configuration on start");
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,2, 3,4, GTK_FILL, 0, 4, 6);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,2, 3,4, GTK_FILL, (GtkAttachOptions)0, 4, 6);
gtk_widget_add_accelerator(stwidgets.alwaysshowcheck, "grab_focus", stwidgets.accel_group,
GDK_A, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
@ -348,7 +351,7 @@ static GtkWidget *create_window(void)
GDK_C, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator(stwidgets.cancelbutton, "clicked", stwidgets.accel_group,
GDK_Escape, 0,
GDK_Escape, (GdkModifierType)0,
GTK_ACCEL_VISIBLE);
stwidgets.cancelbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);
@ -371,7 +374,7 @@ static GtkWidget *create_window(void)
GDK_S, GDK_MOD1_MASK,
GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator(stwidgets.startbutton, "clicked", stwidgets.accel_group,
GDK_Return, 0,
GDK_Return, (GdkModifierType)0,
GTK_ACCEL_VISIBLE);
stwidgets.startbuttonalign = gtk_alignment_new(0.5, 0.5, 0, 0);

View file

@ -8,10 +8,25 @@
#define CINTERFACE
// bug in the dx headers
#define bMAKEDIPROP(prop) ((REFGUID)(prop))
#define bDIPROP_BUFFERSIZE bMAKEDIPROP(1)
#define bDIPROP_DEADZONE bMAKEDIPROP(5)
#if defined (_MSC_VER) || !defined(__cplusplus)
#define bDIPROP_BUFFERSIZE MAKEDIPROP(1)
#define bDIPROP_DEADZONE MAKEDIPROP(5)
#define bDIPROP_SATURATION MAKEDIPROP(6)
#else
#define bMAKEDIPROP(prop) ((REFGUID)(prop))
#define bDIPROP_BUFFERSIZE bMAKEDIPROP(1)
#define bDIPROP_DEADZONE bMAKEDIPROP(5)
#define bDIPROP_SATURATION bMAKEDIPROP(6)
#endif
// wtf, Microsoft?
#if defined (_MSC_VER) && defined(__cplusplus)
# define bREFGUID (REFGUID)
# define bREFIID (REFIID)
#else
# define bREFGUID &
# define bREFIID &
#endif
#include <windows.h>
#include <ddraw.h>
@ -22,6 +37,10 @@
#include <math.h> // pow
#ifdef __cplusplus
#include <algorithm>
#endif
#ifdef _MSC_VER
#include <crtdbg.h>
#endif
@ -59,7 +78,7 @@ static int32_t winlayer_have_ATI = 0;
int32_t _buildargc = 0;
const char **_buildargv = NULL;
static char *argvbuf = NULL;
extern int32_t app_main(int32_t argc, const char *argv[]);
extern int32_t app_main(int32_t argc, const char **argv);
extern void app_crashhandler(void);
// Windows crud
@ -362,9 +381,13 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
#ifndef DEBUGGINGAIDS
if ((nedhandle = LoadLibrary("nedmalloc.dll")))
{
nedpool *(WINAPI *nedcreatepool)(size_t, int);
#ifdef __cplusplus
nedalloc::nedpool_t *(WINAPI *nedcreatepool)(size_t, int);
if ((nedcreatepool = (nedalloc::nedpool_t *(WINAPI *)(size_t, int))GetProcAddress(nedhandle, "nedcreatepool")))
#else
nedpool_t *(WINAPI *nedcreatepool)(size_t, int);
if ((nedcreatepool = (void *)GetProcAddress(nedhandle, "nedcreatepool")))
#endif
nedcreatepool(SYSTEM_POOL_SIZE, -1);
}
#else
@ -964,7 +987,7 @@ void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur)
dipdw.diph.dwHow = DIPH_BYOFFSET;
}
result = IDirectInputDevice7_GetProperty(lpDID, bDIPROP_DEADZONE, &dipdw.diph);
result = IDirectInputDevice7_GetProperty(lpDID, bDIPROP_DEADZONE, (LPDIPROPHEADER)&dipdw.diph);
if (FAILED(result))
{
//ShowDInputErrorBox("Failed getting joystick dead zone", result);
@ -1110,7 +1133,7 @@ static BOOL InitDirectInput(void)
}
}
aDirectInputCreateA = (void *)GetProcAddress(hDInputDLL, "DirectInputCreateA");
aDirectInputCreateA = (HRESULT(WINAPI *)(HINSTANCE, DWORD, LPDIRECTINPUT7A *, LPUNKNOWN))GetProcAddress(hDInputDLL, "DirectInputCreateA");
if (!aDirectInputCreateA) ShowErrorBox("Error fetching DirectInputCreateA()");
result = aDirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &lpDI, NULL);
@ -1133,11 +1156,12 @@ static BOOL InitDirectInput(void)
*devicedef.did = NULL;
// initprintf(" - Creating %s device\n", devicedef.name);
result = IDirectInput7_CreateDeviceEx(lpDI, &guidDevs, &IID_IDirectInputDevice7, (void *)&dev, NULL);
result = IDirectInput7_CreateDeviceEx(lpDI, bREFGUID guidDevs, bREFIID IID_IDirectInputDevice7, (LPVOID *)&dev, NULL);
if (FAILED(result)) { HorribleDInputDeath("Failed creating device", result); }
else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result));
result = IDirectInputDevice7_QueryInterface(dev, &IID_IDirectInputDevice7, (LPVOID *)&dev2);
result = IDirectInputDevice7_QueryInterface(dev, bREFIID IID_IDirectInputDevice7, (LPVOID *)&dev2);
IDirectInputDevice7_Release(dev);
if (FAILED(result)) { HorribleDInputDeath("Failed querying DirectInput7 interface for device", result); }
else if (result != DI_OK) initprintf(" Queried IDirectInputDevice7 interface with warning: %s\n",GetDInputError(result));
@ -1683,7 +1707,7 @@ static void ToggleDesktopComposition(BOOL compEnable)
static HRESULT(WINAPI *aDwmEnableComposition)(UINT);
if (!hDWMApiDLL && (hDWMApiDLL = LoadLibrary("DWMAPI.DLL")))
aDwmEnableComposition = (void *)GetProcAddress(hDWMApiDLL, "DwmEnableComposition");
aDwmEnableComposition = (HRESULT(WINAPI *)(UINT))GetProcAddress(hDWMApiDLL, "DwmEnableComposition");
if (aDwmEnableComposition)
{
@ -2271,7 +2295,7 @@ static int32_t setgammaramp(WORD gt[3][256])
if (!(DDdwCaps2 & DDCAPS2_PRIMARYGAMMA)) return -1;
hr = IDirectDrawSurface_QueryInterface(lpDDSPrimary, &IID_IDirectDrawGammaControl, (LPVOID)&gam);
hr = IDirectDrawSurface_QueryInterface(lpDDSPrimary, bREFIID IID_IDirectDrawGammaControl, (LPVOID *)&gam);
if (hr != DD_OK)
{
// ShowDDrawErrorBox("Error querying gamma control", hr);
@ -2343,7 +2367,7 @@ static int32_t getgammaramp(WORD gt[3][256])
if (!(DDdwCaps2 & DDCAPS2_PRIMARYGAMMA)) return -1;
hr = IDirectDrawSurface_QueryInterface(lpDDSPrimary, &IID_IDirectDrawGammaControl, (LPVOID)&gam);
hr = IDirectDrawSurface_QueryInterface(lpDDSPrimary, bREFIID IID_IDirectDrawGammaControl, (LPVOID *)&gam);
if (hr != DD_OK)
{
ShowDDrawErrorBox("Error querying gamma control", hr);
@ -2403,7 +2427,7 @@ static BOOL InitDirectDraw(void)
}
// get the pointer to DirectDrawEnumerate
aDirectDrawEnumerate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA");
aDirectDrawEnumerate = (HRESULT(WINAPI *)(LPDDENUMCALLBACK, LPVOID))GetProcAddress(hDDrawDLL, "DirectDrawEnumerateA");
if (!aDirectDrawEnumerate)
{
ShowErrorBox("Error fetching DirectDrawEnumerate()");
@ -2416,7 +2440,7 @@ static BOOL InitDirectDraw(void)
aDirectDrawEnumerate(InitDirectDraw_enum, NULL);
// get the pointer to DirectDrawCreate
aDirectDrawCreate = (void *)GetProcAddress(hDDrawDLL, "DirectDrawCreate");
aDirectDrawCreate = (HRESULT(WINAPI *)(GUID *, LPDIRECTDRAW *, IUnknown *))GetProcAddress(hDDrawDLL, "DirectDrawCreate");
if (!aDirectDrawCreate)
{
ShowErrorBox("Error fetching DirectDrawCreate()");
@ -3812,13 +3836,13 @@ static BOOL RegisterWindowClass(void)
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = hInstance;
wcx.hIcon = LoadImage(hInstance, MAKEINTRESOURCE(100), IMAGE_ICON,
wcx.hIcon = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(100), IMAGE_ICON,
GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR);
wcx.hCursor = LoadCursor(NULL, IDC_ARROW);
wcx.hbrBackground = (HBRUSH)COLOR_GRAYTEXT;
wcx.lpszMenuName = NULL;
wcx.lpszClassName = WindowClass;
wcx.hIconSm = LoadImage(hInstance, MAKEINTRESOURCE(100), IMAGE_ICON,
wcx.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(100), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR);
if (!RegisterClassEx(&wcx))
{

View file

@ -104,12 +104,16 @@
<ClInclude Include="build\include\scriptfile.h" />
<ClInclude Include="build\include\sdlayer.h" />
<ClInclude Include="build\include\startwin.editor.h" />
<ClInclude Include="build\include\tracker.hpp" />
<ClInclude Include="build\include\tracker_operator.hpp" />
<ClInclude Include="build\include\tracker_operators.hpp" />
<ClInclude Include="build\include\winlayer.h" />
<ClInclude Include="build\include\msvc\inttypes.h" />
<ClInclude Include="build\include\msvc\stdint.h" />
<ClInclude Include="build\src\engine_priv.h" />
<ClInclude Include="source\actors.h" />
<ClInclude Include="source\anim.h" />
<ClInclude Include="source\animvpx.h" />
<ClInclude Include="source\demo.h" />
<ClInclude Include="source\game.h" />
<ClInclude Include="source\gameexec.h" />
@ -215,9 +219,11 @@
<ClCompile Include="build\src\winlayer.c" />
<ClCompile Include="source\actors.c" />
<ClCompile Include="source\anim.c" />
<ClCompile Include="source\animvpx.c" />
<ClCompile Include="source\astub.c" />
<ClCompile Include="source\config.c" />
<ClCompile Include="source\demo.c" />
<ClCompile Include="source\enet\src\compress.c" />
<ClCompile Include="source\game.c" />
<ClCompile Include="source\gamedef.c" />
<ClCompile Include="source\gameexec.c" />
@ -285,4 +291,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View file

@ -390,6 +390,18 @@
<ClInclude Include="source\input.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="build\include\tracker_operator.hpp">
<Filter>build\headers</Filter>
</ClInclude>
<ClInclude Include="build\include\tracker_operators.hpp">
<Filter>build\headers</Filter>
</ClInclude>
<ClInclude Include="build\include\tracker.hpp">
<Filter>build\headers</Filter>
</ClInclude>
<ClInclude Include="source\animvpx.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="build\src\a-c.c">
@ -677,6 +689,12 @@
<ClCompile Include="source\input.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\animvpx.c">
<Filter>eduke32\source</Filter>
</ClCompile>
<ClCompile Include="source\enet\src\compress.c">
<Filter>enet\source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="Makefile.msvc">
@ -686,4 +704,4 @@
<Filter>build</Filter>
</None>
</ItemGroup>
</Project>
</Project>

View file

@ -1362,10 +1362,10 @@ ACTOR_STATIC void G_MoveFallers(void)
}
else if (T1 == 1)
{
if (s->lotag > 0)
if (s->lotag < INT16_MAX)
{
s->lotag-=3;
if (s->lotag <= 0)
if (s->lotag > INT16_MAX)
{
s->xvel = (32+(krand()&63));
s->zvel = -(1024+(krand()&1023));
@ -1905,7 +1905,7 @@ ACTOR_STATIC void G_MoveStandables(void)
A_PlaySound(PIPEBOMB_EXPLODE,j);
A_PlaySound(GLASS_HEAVYBREAK,j);
if (s->hitag > 0)
if (s->hitag < INT16_MAX)
{
j = headspritestat[STAT_STANDABLE];
while (j >= 0)
@ -1959,10 +1959,10 @@ ACTOR_STATIC void G_MoveStandables(void)
{
if (s->shade == -32)
{
if (s->lotag > 0)
if (s->lotag < INT16_MAX)
{
s->lotag-=3;
if (s->lotag <= 0) s->lotag = -99;
if (s->lotag > INT16_MAX) s->lotag = UINT16_MAX-99;
}
else
s->shade = -33;
@ -2023,7 +2023,7 @@ DETONATE:
if (s->xrepeat)
for (x=0; x<8; x++) RANDOMSCRAP;
if ((t[3] == 1 && s->xrepeat) || s->lotag == -99)
if ((t[3] == 1 && s->xrepeat) || s->lotag == UINT16_MAX-99)
{
int32_t j = A_Spawn(i,EXPLOSION2);
x = s->extra;
@ -2042,7 +2042,7 @@ DETONATE:
if (s->yvel == 1)
{
s->hitag--;
if (s->hitag <= 0)
if (s->hitag == UINT16_MAX)
{
G_OperateSectors(sect,i);
@ -2264,7 +2264,7 @@ CLEAR_THE_BOLT:
goto BOLT;
case TOUCHPLATE__STATIC:
if (t[1] == 1 && s->hitag >= 0) //Move the sector floor
if (t[1] == 1 && s->hitag != UINT16_MAX) //Move the sector floor
{
x = sector[sect].floorz;
@ -2317,7 +2317,7 @@ CLEAR_THE_BOLT:
t[3] = !t[3];
G_OperateMasterSwitches(s->lotag);
G_OperateActivators(s->lotag,p);
if (s->hitag > 0)
if (s->hitag < INT16_MAX)
{
s->hitag--;
if (s->hitag == 0) t[5] = 1;
@ -5541,7 +5541,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
j = s->owner;
if (sprite[j].lotag == (int16_t) 65535)
if (sprite[j].lotag == UINT16_MAX)
KILLIT(i);
q = sc->extra>>3;
@ -6421,7 +6421,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
case SE_10_DOOR_AUTO_CLOSE:
// XXX: 32791, what the hell?
if ((sc->lotag&0xff) == ST_27_STRETCH_BRIDGE || (sc->floorz > sc->ceilingz && (sc->lotag&0xff) != ST_23_SWINGING_DOOR) || sc->lotag == (int16_t) 32791)
if ((sc->lotag&0xff) == ST_27_STRETCH_BRIDGE || (sc->floorz > sc->ceilingz && (sc->lotag&0xff) != ST_23_SWINGING_DOOR) || sc->lotag == 32791)
{
int32_t p;
@ -7760,7 +7760,7 @@ static void G_DoEffectorLights(void) // STATNUM 14
actor[i].lightptr->color[1] = sprite[i].yvel;
actor[i].lightptr->color[2] = sprite[i].zvel;
}
if (!!(CS & 128) != actor[i].lightptr->publicflags.negative) {
if ((int)!!(CS & 128) != actor[i].lightptr->publicflags.negative) {
actor[i].lightptr->publicflags.negative = !!(CS & 128);
}
}
@ -7850,10 +7850,10 @@ static void G_DoEffectorLights(void) // STATNUM 14
actor[i].lightptr->horiz = SH;
actor[i].lightptr->flags.invalidate = 1;
}
if (!(CS & 64) != actor[i].lightptr->publicflags.emitshadow) {
if ((int)!(CS & 64) != actor[i].lightptr->publicflags.emitshadow) {
actor[i].lightptr->publicflags.emitshadow = !(CS & 64);
}
if (!!(CS & 128) != actor[i].lightptr->publicflags.negative) {
if ((int)!!(CS & 128) != actor[i].lightptr->publicflags.negative) {
actor[i].lightptr->publicflags.negative = !!(CS & 128);
}
actor[i].lightptr->tilenum = actor[i].picnum;

View file

@ -172,7 +172,7 @@ typedef struct {
uint32_t flags; // formerly SpriteFlags, ActorType
int16_t cacherange[2]; // formerly SpriteCache
int16_t cacherange; // formerly SpriteCache
// todo: make this a pointer and allocate at runtime
projectile_t defproj;

View file

@ -102,7 +102,7 @@ int32_t animvpx_init_codec(const animvpx_ivf_header_t *info, int32_t inhandle, a
//
codec->inhandle = inhandle;
codec->pic = Bcalloc(info->width*info->height,4);
codec->pic = (uint8_t *)Bcalloc(info->width*info->height,4);
codec->compbuflen = codec->compbufallocsiz = 0;
codec->compbuf = NULL;
@ -173,14 +173,14 @@ static int32_t animvpx_read_frame(int32_t inhandle, uint8_t **bufptr, uint32_t *
if (!*bufptr)
{
*bufptr = Bmalloc(hdr.framesiz);
*bufptr = (uint8_t *)Bmalloc(hdr.framesiz);
if (!*bufptr)
return 2;
*bufallocsizptr = hdr.framesiz;
}
else if (*bufallocsizptr < hdr.framesiz)
{
*bufptr = Brealloc(*bufptr, hdr.framesiz);
*bufptr = (uint8_t *)Brealloc(*bufptr, hdr.framesiz);
if (!*bufptr)
return 2;
*bufallocsizptr = hdr.framesiz;

View file

@ -415,12 +415,12 @@ static void create_compressed_block(int32_t idx, const void *srcdata, uint32_t s
uint32_t j;
// allocate
mapstate->sws[idx] = Bmalloc(4 + size + QADDNSZ);
mapstate->sws[idx] = (char *)Bmalloc(4 + size + QADDNSZ);
if (!mapstate->sws[idx]) { initprintf("OUT OF MEM in undo/redo\n"); osdcmd_quit(NULL); }
// compress & realloc
j = qlz_compress(srcdata, mapstate->sws[idx]+4, size, state_compress);
mapstate->sws[idx] = Brealloc(mapstate->sws[idx], 4 + j);
mapstate->sws[idx] = (char *)Brealloc(mapstate->sws[idx], 4 + j);
if (!mapstate->sws[idx]) { initprintf("COULD not realloc in undo/redo\n"); osdcmd_quit(NULL); }
// write refcount
@ -474,7 +474,7 @@ void create_map_snapshot(void)
map_revision = 1;
mapstate = Bcalloc(1, sizeof(mapundo_t));
mapstate = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
mapstate->revision = map_revision;
mapstate->prev = mapstate->next = NULL;
}
@ -485,7 +485,7 @@ void create_map_snapshot(void)
// now, have no successors
// calloc because not everything may be set in the following:
mapstate->next = Bcalloc(1, sizeof(mapundo_t));
mapstate->next = (mapundo_t *)Bcalloc(1, sizeof(mapundo_t));
mapstate->next->prev = mapstate;
mapstate = mapstate->next;
@ -524,7 +524,7 @@ void create_map_snapshot(void)
if (!try_match_with_prev(2, Numsprites, tempcrc))
{
int32_t i = 0;
spritetype *const tspri = Bmalloc(Numsprites*sizeof(spritetype) + 4);
spritetype *const tspri = (spritetype *)Bmalloc(Numsprites*sizeof(spritetype) + 4);
spritetype *spri = tspri;
if (!tspri) { initprintf("OUT OF MEM in undo/redo (2)\n"); osdcmd_quit(NULL); }
@ -897,7 +897,7 @@ int32_t taglab_load(const char *filename, int32_t flags)
len = kfilelength(fil);
filebuf = Bmalloc(len+1);
filebuf = (char *)Bmalloc(len+1);
if (!filebuf)
{
kclose(fil);
@ -1315,9 +1315,9 @@ const char *ExtGetSectorCaption(int16_t sectnum)
{
Bstrcpy(lo, ExtGetSectorType(sector[sectnum].lotag));
if (qsetmode != 200)
Bsprintf(tempbuf,"%hu,%hu %s", sector[sectnum].hitag, sector[sectnum].lotag, lo);
Bsprintf_nowarn(tempbuf,"%hu,%hu %s", sector[sectnum].hitag, sector[sectnum].lotag, lo);
else
Bsprintf(tempbuf,"%hu %s", sector[sectnum].lotag, lo);
Bsprintf_nowarn(tempbuf,"%hu %s", sector[sectnum].lotag, lo);
}
return(tempbuf);
}
@ -1350,8 +1350,8 @@ const char *ExtGetWallCaption(int16_t wallnum)
int32_t lt = taglab_linktags(0, wallnum);
char histr[TAGLAB_MAX+16], lostr[TAGLAB_MAX+16];
lt &= ~(wall[wallnum].lotag<=0);
lt &= ~((wall[wallnum].hitag<=0)<<1);
lt &= ~(int)(wall[wallnum].lotag<=0);
lt &= ~(int)((wall[wallnum].hitag<=0)<<1);
taglab_handle1(lt&2, wall[wallnum].hitag, histr);
@ -1491,8 +1491,8 @@ const char *ExtGetSpriteCaption(int16_t spritenum)
return tempbuf;
lt = taglab_linktags(1, spritenum);
lt &= ~(sprite[spritenum].lotag<=0);
lt &= ~((sprite[spritenum].hitag<=0)<<1);
lt &= ~(int)(sprite[spritenum].lotag<=0);
lt &= ~(int)((sprite[spritenum].hitag<=0)<<1);
if ((sprite[spritenum].lotag|sprite[spritenum].hitag) == 0)
{
@ -1527,7 +1527,7 @@ const char *ExtGetSpriteCaption(int16_t spritenum)
SpriteName(spritenum,lo);
if (sprite[spritenum].extra != -1)
Bsprintf(tempbuf,"%s,%s,%d %s", histr, lostr, sprite[spritenum].extra, lo);
Bsprintf_nowarn(tempbuf,"%s,%s,%d %s", histr, lostr, sprite[spritenum].extra, lo);
else
Bsprintf(tempbuf,"%s,%s %s", histr, lostr, lo);
}
@ -1754,7 +1754,7 @@ void ExtShowWallData(int16_t wallnum) //F6
if (runi==1 && sprite[i].picnum!=RESPAWN)
continue;
pic = (runi==0) ? sprite[i].picnum : sprite[i].hitag;
pic = (runi==0) ? (int)sprite[i].picnum : (int)sprite[i].hitag;
if (pic<0 || pic>=MAXTILES)
continue;
@ -1948,7 +1948,7 @@ static void ReadHelpFile(const char *name)
return;
}
helppage=Bmalloc(IHELP_INITPAGES * sizeof(helppage_t *));
helppage=(helppage_t **)Bmalloc(IHELP_INITPAGES * sizeof(helppage_t *));
numallocpages=IHELP_INITPAGES;
if (!helppage) goto HELPFILE_ERROR;
@ -1968,7 +1968,7 @@ static void ReadHelpFile(const char *name)
if (Bfeof(fp) || charsread<=0) break;
hp=Bcalloc(1,sizeof(helppage_t) + IHELP_INITLINES*80);
hp=(helppage_t *)Bcalloc(1,sizeof(helppage_t) + IHELP_INITLINES*80);
if (!hp) goto HELPFILE_ERROR;
hp->numlines = IHELP_INITLINES;
@ -1979,7 +1979,7 @@ static void ReadHelpFile(const char *name)
{
if (j >= hp->numlines)
{
hp=Brealloc(hp, sizeof(helppage_t) + 2*hp->numlines*80);
hp=(helppage_t *)Brealloc(hp, sizeof(helppage_t) + 2*hp->numlines*80);
if (!hp) goto HELPFILE_ERROR;
hp->numlines *= 2;
}
@ -2012,13 +2012,13 @@ static void ReadHelpFile(const char *name)
}
while (!newpage(tempbuf) && !Bfeof(fp) && charsread>0);
hp=Brealloc(hp, sizeof(helppage_t) + j*80);
hp=(helppage_t *)Brealloc(hp, sizeof(helppage_t) + j*80);
if (!hp) goto HELPFILE_ERROR;
hp->numlines=j;
if (i >= numallocpages)
{
helppage = Brealloc(helppage, 2*numallocpages*sizeof(helppage_t *));
helppage = (helppage_t **)Brealloc(helppage, 2*numallocpages*sizeof(helppage_t *));
numallocpages *= 2;
if (!helppage) goto HELPFILE_ERROR;
}
@ -2026,7 +2026,7 @@ static void ReadHelpFile(const char *name)
i++;
}
helppage = Brealloc(helppage, i*sizeof(helppage_t *));
helppage =(helppage_t **) Brealloc(helppage, i*sizeof(helppage_t *));
if (!helppage) goto HELPFILE_ERROR;
numhelppages = i;
@ -2335,7 +2335,7 @@ static int32_t sort_sounds(int32_t how)
n = g_numsounds;
src = source = g_sndnum;
dest = Bmalloc(sizeof(int16_t) * n);
dest = (int16_t *)Bmalloc(sizeof(int16_t) * n);
dst = dest;
if (!dest) return -1;
@ -3748,7 +3748,7 @@ static int32_t OnSaveTileGroup(void)
Bfprintf(fp, "tilegroup \"%s\""OURNEWL"{"OURNEWL, name);
Bfprintf(fp, TTAB "hotkey \"%c\""OURNEWL OURNEWL, hotkey);
if (!(s_TileGroups[tile_groups].pIds = Bmalloc(n * sizeof(s_TileGroups[tile_groups].pIds[0]))))
if (!(s_TileGroups[tile_groups].pIds = (int32_t *)Bmalloc(n * sizeof(s_TileGroups[tile_groups].pIds[0]))))
TMPERRMSG_RETURN("Out of memory.");
j = 0;
@ -4269,8 +4269,8 @@ static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,in
if (small)
x1 /= 2;
x1 *= 320.0/xdimgame;
scale /= (max(tilesizx[picnum],tilesizy[picnum])/24.0);
x1 = (int32_t)(x1 * 320.0/xdimgame);
scale = (int32_t)(max(tilesizx[picnum],tilesizy[picnum])/24.0);
setaspect(65536L, (int32_t)divscale16(ydim*320L,xdim*200L));
// +1024: prevents rotatesprite from setting aspect itself
@ -4278,8 +4278,8 @@ static void drawtileinfo(const char *title,int32_t x,int32_t y,int32_t picnum,in
setaspect(oviewingrange, oyxaspect);
}
x *= xdimgame/320.0;
y *= ydimgame/200.0;
x = (int32_t)(x * xdimgame/320.0);
y = (int32_t)(y * ydimgame/200.0);
begindrawing();
printext256(x+2,y+2,0,-1,title,small);
@ -4384,16 +4384,16 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int
switch (bytes)
{
case 1:
getnumber_dochar(num, danum);
getnumber_dochar((char *)num, danum);
break;
case 2:
getnumber_doint16_t(num, danum);
getnumber_doint16_t((int16_t *)num, danum);
break;
case 4:
getnumber_doint32(num, danum);
getnumber_doint32((int32_t *)num, danum);
break;
case 8:
getnumber_doint64(num, danum);
getnumber_doint64((int64_t *)num, danum);
break;
}
}
@ -4405,16 +4405,16 @@ static void getnumberptr256(const char *namestart, void *num, int32_t bytes, int
switch (bytes)
{
case 1:
getnumber_dochar(num, oldnum);
getnumber_dochar((char *)num, oldnum);
break;
case 2:
getnumber_doint16_t(num, oldnum);
getnumber_doint16_t((int16_t *)num, oldnum);
break;
case 4:
getnumber_doint32(num, oldnum);
getnumber_doint32((int32_t *)num, oldnum);
break;
case 8:
getnumber_doint64(num, oldnum);
getnumber_doint64((int64_t *)num, oldnum);
break;
}
}
@ -4489,7 +4489,7 @@ ENDFOR1:
sprite[startspr].xoffset = -(((picanm[t])>>8)&255);
sprite[startspr].yoffset = -(((picanm[t])>>16)&255);
spritenums = Bmalloc(stackallocsize * sizeof(int16_t));
spritenums = (int16_t *)Bmalloc(stackallocsize * sizeof(int16_t));
if (!spritenums) goto ERROR_NOMEMORY;
cursor = insertsprite(sprite[startspr].sectnum,0);
@ -4556,7 +4556,7 @@ ENDFOR1:
ExtCheckKeys();
printmessage256(0,0,"^251Text entry mode.^31 Navigation keys change vars.");
Bsprintf(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d",
Bsprintf_nowarn(buffer, "Hgap=%d, Vgap=%d, SPCgap=%d, Shd=%d, Pal=%d",
hgap, vgap, spcgap[alphidx], sprite[linebegspr].shade, sprite[linebegspr].pal);
printmessage256(0, 9, buffer);
showframe(1);
@ -4624,7 +4624,7 @@ ENDFOR1:
if (numletters >= stackallocsize)
{
stackallocsize *= 2;
spritenums = Brealloc(spritenums, stackallocsize*sizeof(int16_t));
spritenums = (int16_t *)Brealloc(spritenums, stackallocsize*sizeof(int16_t));
if (!spritenums) goto ERROR_NOMEMORY;
}
spritenums[numletters++] = i;
@ -4818,7 +4818,7 @@ static void toggle_cf_flipping(int32_t sectnum, int32_t floorp)
static const int16_t orient[8] = { 360, -360, -180, 180, -270, 270, 90, -90 };
int16_t *stat = &SECTORFLD(sectnum,stat, floorp);
uint16_t *stat = &SECTORFLD(sectnum,stat, floorp);
int32_t i = *stat;
i = (i&0x4)+((i>>4)&3);
@ -4925,9 +4925,9 @@ static void Keys3d(void)
height3 = sector[nextsect].ceilingz - sector[searchsector].ceilingz;
}
Bsprintf(lines[num++],"Panning: %d, %d", wall[w].xpanning, wall[w].ypanning);
Bsprintf(lines[num++],"Repeat: %d, %d", wall[searchwall].xrepeat, wall[searchwall].yrepeat);
Bsprintf(lines[num++],"Overpic: %d", wall[searchwall].overpicnum);
Bsprintf_nowarn(lines[num++],"Panning: %d, %d", wall[w].xpanning, wall[w].ypanning);
Bsprintf_nowarn(lines[num++],"Repeat: %d, %d", wall[searchwall].xrepeat, wall[searchwall].yrepeat);
Bsprintf_nowarn(lines[num++],"Overpic: %d", wall[searchwall].overpicnum);
lines[num++][0]=0;
if (getmessageleng)
@ -4966,7 +4966,7 @@ static void Keys3d(void)
break;
Bsprintf(lines[num++],"^251Sector %d^31 %s, Lotag:%s", searchsector, typestr[searchstat], ExtGetSectorCaption(searchsector));
Bsprintf(lines[num++],"Height: %d, Visibility:%d", height2, sector[searchsector].visibility);
Bsprintf_nowarn(lines[num++],"Height: %d, Visibility:%d", height2, sector[searchsector].visibility);
break;
case SEARCH_SPRITE:
@ -4974,10 +4974,10 @@ static void Keys3d(void)
sprite[searchwall].pal, sprite[searchwall].cstat, sprite[searchwall].lotag,
sprite[searchwall].hitag, sprite[searchwall].extra,0);
Bsprintf(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
Bsprintf(lines[num++], "PosXY: %d,%d%s", sprite[searchwall].x, sprite[searchwall].y,
Bsprintf_nowarn(lines[num++], "Repeat: %d,%d", sprite[searchwall].xrepeat, sprite[searchwall].yrepeat);
Bsprintf_nowarn(lines[num++], "PosXY: %d,%d%s", sprite[searchwall].x, sprite[searchwall].y,
sprite[searchwall].xoffset|sprite[searchwall].yoffset ? " ^251*":"");
Bsprintf(lines[num++], "PosZ: "" %d", sprite[searchwall].z);// prevents tab character
Bsprintf_nowarn(lines[num++], "PosZ: "" %d", sprite[searchwall].z);// prevents tab character
lines[num++][0]=0;
if (getmessageleng)
@ -4991,9 +4991,9 @@ static void Keys3d(void)
if (sprite[searchwall].picnum==SECTOREFFECTOR)
Bsprintf(lines[num++],"^251Sprite %d^31 %s", searchwall, SectorEffectorText(searchwall));
else
Bsprintf(lines[num++],"^251Sprite %d^31 %s", searchwall, names[sprite[searchwall].picnum]);
Bsprintf_nowarn(lines[num++],"^251Sprite %d^31 %s", searchwall, names[sprite[searchwall].picnum]);
}
else Bsprintf(lines[num++],"^251Sprite %d^31, picnum %d", searchwall, sprite[searchwall].picnum);
else Bsprintf_nowarn(lines[num++],"^251Sprite %d^31, picnum %d", searchwall, sprite[searchwall].picnum);
Bsprintf(lines[num++], "Elevation:%d",
getflorzofslope(searchsector, sprite[searchwall].x, sprite[searchwall].y) - sprite[searchwall].z);
@ -5001,8 +5001,8 @@ static void Keys3d(void)
}
}
x = WIND1X*(xdimgame/320.);
y = WIND1Y*(ydimgame/200.);
x = (int32_t)(WIND1X*(xdimgame/320.));
y = (int32_t)(WIND1Y*(ydimgame/200.));
y += (ydimgame>>6)*8;
if (getmessageleng)
@ -5111,7 +5111,7 @@ static void Keys3d(void)
if (AIMING_AT_WALL_OR_MASK)
{
wall[searchwall].cstat &= YAX_NEXTWALLBITS;
message("Wall %d cstat = %d", searchwall, wall[searchwall].cstat);
message_nowarn("Wall %d cstat = %d", searchwall, wall[searchwall].cstat);
}
else if (AIMING_AT_SPRITE)
{
@ -5277,7 +5277,7 @@ static void Keys3d(void)
{
sprite[searchwall].ang += tsign<<(!eitherSHIFT*7);
sprite[searchwall].ang &= 2047;
message("Sprite %d angle: %d", searchwall, sprite[searchwall].ang);
message_nowarn("Sprite %d angle: %d", searchwall, sprite[searchwall].ang);
}
}
@ -5545,9 +5545,9 @@ static void Keys3d(void)
if (eitherCTRL) //CTRL
{
if (tsign==1)
visibility <<= (visibility < 16384);
visibility <<= (int)(visibility < 16384);
else
visibility >>= (visibility > 32);
visibility >>= (int)(visibility > 32);
silentmessage("Global visibility %d", visibility);
}
else
@ -6218,21 +6218,21 @@ static void Keys3d(void)
else if (AIMING_AT_CEILING_OR_FLOOR)
{
sector[searchsector].lotag =
_getnumber256("Sector lotag: ", sector[searchsector].lotag, BTAG_MAX, 0, (void *)ExtGetSectorType);
_getnumber256("Sector lotag: ", sector[searchsector].lotag, BTAG_MAX, 0, (void *(*)(int32_t))ExtGetSectorType);
}
else if (AIMING_AT_SPRITE)
{
if (sprite[searchwall].picnum == SECTOREFFECTOR)
{
sprite[searchwall].lotag =
_getnumber256("Sprite lotag: ", sprite[searchwall].lotag, BTAG_MAX, 0+j, (void *)SectorEffectorTagText);
_getnumber256("Sprite lotag: ", sprite[searchwall].lotag, BTAG_MAX, 0+j, (void *(*)(int32_t))SectorEffectorTagText);
}
else if (sprite[searchwall].picnum == MUSICANDSFX)
{
int16_t oldtag = sprite[searchwall].lotag;
sprite[searchwall].lotag =
_getnumber256("Sprite lotag: ", sprite[searchwall].lotag, BTAG_MAX, 0+j, (void *)MusicAndSFXTagText);
_getnumber256("Sprite lotag: ", sprite[searchwall].lotag, BTAG_MAX, 0+j, (void *(*)(int32_t))MusicAndSFXTagText);
if ((sprite[searchwall].filler&1) && sprite[searchwall].lotag != oldtag)
{
@ -6388,7 +6388,7 @@ static void Keys3d(void)
if (AIMING_AT_CEILING_OR_FLOOR) //Set masked/transluscent ceilings/floors
{
int32_t nexti[4] = { 128, 256, 384, 0 };
int16_t *stat = &AIMED_CEILINGFLOOR(stat);
uint16_t *stat = &AIMED_CEILINGFLOOR(stat);
const char *statmsg[4] = {"normal", "masked", "translucent", "translucent (2)"};
i = (*stat&(128+256))>>7;
@ -7870,7 +7870,7 @@ static void Keys2d(void)
j = 4*(j&1);
Bsprintf(buffer,"Sprite (%d) Lo-tag: ", i);
sprite[i].lotag = _getnumber16(buffer, sprite[i].lotag, BTAG_MAX, 0+j, sprite[i].picnum==SECTOREFFECTOR ?
(void *)SectorEffectorTagText : NULL);
(void *(*)(int32_t))SectorEffectorTagText : NULL);
}
else if (linehighlight >= 0)
{
@ -7894,7 +7894,7 @@ static void Keys2d(void)
{
Bsprintf(buffer,"Sector (%d) Lo-tag: ", tcursectornum);
sector[tcursectornum].lotag =
_getnumber16(buffer, sector[tcursectornum].lotag, BTAG_MAX, 0, (void *)ExtGetSectorType);
_getnumber16(buffer, sector[tcursectornum].lotag, BTAG_MAX, 0, (void *(*)(int32_t))ExtGetSectorType);
}
}
}
@ -8477,7 +8477,7 @@ int32_t ExtPreSaveMap(void)
if (wall[j].point2 < startwall)
startwall = wall[j].point2;
if (sector[i].wallptr != startwall)
initprintf("Warning: set sector %d's wallptr to %d (was %d)\n", i,
initprintf_nowarn("Warning: set sector %d's wallptr to %d (was %d)\n", i,
sector[i].wallptr, startwall);
sector[i].wallptr = startwall;
}
@ -8570,14 +8570,14 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if (argc <= 1)
return;
lengths = Bmalloc(argc*sizeof(int32_t));
lengths = (int32_t *)Bmalloc(argc*sizeof(int32_t));
for (j=1; j<argc; j++)
{
lengths[j] = Bstrlen(argv[j]);
maxlen += lengths[j];
}
testplay_addparam = Bmalloc(maxlen+argc);
testplay_addparam = (char *)Bmalloc(maxlen+argc);
testplay_addparam[0] = 0;
j = 0;
@ -8867,7 +8867,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
if (j > 0)
{
testplay_addparam[j-1] = 0;
testplay_addparam = Brealloc(testplay_addparam, j*sizeof(char));
testplay_addparam = (char *)Brealloc(testplay_addparam, j*sizeof(char));
}
else
{
@ -9015,9 +9015,9 @@ static int32_t osdcmd_testplay_addparam(const osdfuncparm_t *parm)
if (slen > 0)
{
if (!testplay_addparam)
testplay_addparam = Bmalloc(slen+1);
testplay_addparam = (char *)Bmalloc(slen+1);
else
testplay_addparam = Brealloc(testplay_addparam, slen+1);
testplay_addparam = (char *)Brealloc(testplay_addparam, slen+1);
Bmemcpy(testplay_addparam, parm->parms[0], slen);
testplay_addparam[slen] = 0;
@ -9369,7 +9369,7 @@ static int32_t osdcmd_do(const osdfuncparm_t *parm)
ofs = 2*(parm->numparms>0); // true if "do" command
slen = Bstrlen(parm->raw+ofs);
tp = Bmalloc(slen+2);
tp = (char *)Bmalloc(slen+2);
if (!tp) goto OUTOFMEM;
Bmemcpy(tp, parm->raw+ofs, slen);
@ -9893,7 +9893,7 @@ int32_t parsetilegroups(scriptfile *script)
if (scriptfile_getstring(script,&name)) break;
if (scriptfile_getbraces(script,&end)) break;
s_TileGroups[tile_groups].pIds = Bcalloc(MAX_TILE_GROUP_ENTRIES, sizeof(int32_t));
s_TileGroups[tile_groups].pIds = (int32_t *)Bcalloc(MAX_TILE_GROUP_ENTRIES, sizeof(int32_t));
s_TileGroups[tile_groups].szText = Bstrdup(name);
while (script->textptr < end)
@ -9968,7 +9968,7 @@ int32_t parsetilegroups(scriptfile *script)
}
}
s_TileGroups[tile_groups].pIds = Brealloc(s_TileGroups[tile_groups].pIds,
s_TileGroups[tile_groups].pIds = (int32_t *)Brealloc(s_TileGroups[tile_groups].pIds,
s_TileGroups[tile_groups].nIds*sizeof(int32_t));
tile_groups++;
break;
@ -10122,7 +10122,7 @@ static int32_t loadtilegroups(const char *fn)
#if 0
// ---------- Init hardcoded tile group consisting of all named tiles
s_TileGroups[0].szText = Bstrdup("All named");
s_TileGroups[0].pIds = Bmalloc(MAXTILES * sizeof(s_TileGroups[0].pIds[0]));
s_TileGroups[0].pIds = (int32_t *)Bmalloc(MAXTILES * sizeof(s_TileGroups[0].pIds[0]));
if (!s_TileGroups[0].pIds)
return -1;
j = 0;
@ -10282,7 +10282,7 @@ static int32_t parseconsounds(scriptfile *script)
duplicate = 1;
Bfree(g_sounds[sndnum].filename);
}
g_sounds[sndnum].filename = Bcalloc(slen+1,sizeof(uint8_t));
g_sounds[sndnum].filename = (char *)Bcalloc(slen+1,sizeof(uint8_t));
// Hopefully noone does memcpy(..., g_sounds[].filename, BMAX_PATH)
if (!g_sounds[sndnum].filename)
{
@ -10762,7 +10762,7 @@ void ExtPreCheckKeys(void) // just before drawrooms
}
if (check_prlight_colors(i))
copy_prlight_colors(spritelightptr[i], i);
if (!!(CS & 128) != spritelightptr[i]->publicflags.negative)
if ((int)!!(CS & 128) != spritelightptr[i]->publicflags.negative)
{
spritelightptr[i]->publicflags.negative = !!(CS & 128);
}
@ -10816,11 +10816,11 @@ void ExtPreCheckKeys(void) // just before drawrooms
spritelightptr[i]->horiz = SH;
spritelightptr[i]->flags.invalidate = 1;
}
if (!(CS & 64) != spritelightptr[i]->publicflags.emitshadow)
if ((int)!(CS & 64) != spritelightptr[i]->publicflags.emitshadow)
{
spritelightptr[i]->publicflags.emitshadow = !(CS & 64);
}
if (!!(CS & 128) != spritelightptr[i]->publicflags.negative)
if ((int)!!(CS & 128) != spritelightptr[i]->publicflags.negative)
{
spritelightptr[i]->publicflags.negative = !!(CS & 128);
}
@ -11020,7 +11020,7 @@ void ExtAnalyzeSprites(int32_t ourx, int32_t oury, int32_t oura, int32_t smoothr
if (showinvisibility && (tspr->cstat&32768))
{
tspr->pal = 6;
tspr->cstat &= ~32768;
tspr->cstat &= (uint16_t)~32768;
tspr->cstat |= 2+512;
}
@ -11444,6 +11444,7 @@ void ExtCheckKeys(void)
//#define CCHKPREF OSDTEXT_RED "^O"
#define CCHK_CORRECTED OSDTEXT_GREEN " -> "
#ifdef _MSC_VER
#define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \
{ \
bad = max(bad, errlev); \
@ -11453,7 +11454,17 @@ void ExtCheckKeys(void)
if (errlev >= printfromlev) \
OSD_Printf("#%d: " fmt "\n", numcorruptthings, ## __VA_ARGS__); \
} while (0)
#else
#define CORRUPTCHK_PRINT(errlev, what, fmt, ...) do \
{ \
bad = max(bad, errlev); \
if (numcorruptthings>=MAXCORRUPTTHINGS) \
goto too_many_errors; \
corruptthings[numcorruptthings++] = (what); \
if (errlev >= printfromlev) \
OSD_Printf_nowarn("#%d: " fmt "\n", numcorruptthings, ## __VA_ARGS__); \
} while (0)
#endif
#ifdef YAX_ENABLE
static int32_t walls_have_equal_endpoints(int32_t w1, int32_t w2)
{
@ -11728,9 +11739,9 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing)
if (!corruptcheck_noalreadyrefd)
{
seen_nextwalls = Bcalloc((numwalls+7)>>3,1);
seen_nextwalls = (uint8_t *)Bcalloc((numwalls+7)>>3,1);
if (!seen_nextwalls) return 5;
lastnextwallsource = Bmalloc(numwalls*sizeof(lastnextwallsource[0]));
lastnextwallsource = (int16_t *)Bmalloc(numwalls*sizeof(lastnextwallsource[0]));
if (!lastnextwallsource) { Bfree(seen_nextwalls); return 5; }
}
@ -12339,7 +12350,8 @@ static void EditSectorData(int16_t sectnum)
#endif
break;
case 1:
for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning); i < med_dispwidth; i++) med_disptext[i] = ' ';
Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].ceilingxpanning,sector[sectnum].ceilingypanning);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval)
{
Bsprintf(med_edittext,"Sector %d Ceiling X Pan: ",sectnum);
@ -12389,7 +12401,8 @@ static void EditSectorData(int16_t sectnum)
break;
case 1:
for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning); i < med_dispwidth; i++) med_disptext[i] = ' ';
Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",sector[sectnum].floorxpanning,sector[sectnum].floorypanning);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval)
{
Bsprintf(med_edittext,"Sector %d Floor X Pan: ",sectnum);
@ -12478,7 +12491,8 @@ static void EditWallData(int16_t wallnum)
sizeof(wall[wallnum].pal), M32_MAXPALOOKUPS, 0);
break;
case 3:
for (i=Bsprintf(med_disptext,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat); i < med_dispwidth; i++) med_disptext[i] = ' ';
Bsprintf_nowarn_return(i, med_disptext,"(X,Y)repeat: %d, %d",wall[wallnum].xrepeat,wall[wallnum].yrepeat);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval)
{
Bsprintf(med_edittext,"Wall %d X Repeat: ",wallnum);
@ -12490,7 +12504,8 @@ static void EditWallData(int16_t wallnum)
}
break;
case 4:
for (i=Bsprintf(med_disptext,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning); i < med_dispwidth; i++) med_disptext[i] = ' ';
Bsprintf_nowarn_return(i, med_disptext,"(X,Y)pan: %d, %d",wall[wallnum].xpanning,wall[wallnum].ypanning);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval)
{
Bsprintf(med_edittext,"Wall %d X Pan: ",wallnum);
@ -12669,7 +12684,8 @@ static void EditSpriteData(int16_t spritenum)
break;
case 3:
{
for (i=Bsprintf(med_disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat); i < med_dispwidth; i++) med_disptext[i] = ' ';
Bsprintf_nowarn_return(i, med_disptext,"(X,Y)repeat: %d, %d",sprite[spritenum].xrepeat,sprite[spritenum].yrepeat);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval)
{
Bsprintf(med_edittext,"Sprite %d X Repeat: ",spritenum);
@ -12683,7 +12699,8 @@ static void EditSpriteData(int16_t spritenum)
break;
case 4:
{
for (i=Bsprintf(med_disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset); i < med_dispwidth; i++) med_disptext[i] = ' ';
Bsprintf_nowarn_return(i, med_disptext,"(X,Y)offset: %d, %d",sprite[spritenum].xoffset,sprite[spritenum].yoffset);
for (; i < med_dispwidth; i++) med_disptext[i] = ' ';
if (med_editval)
{
Bsprintf(med_edittext,"Sprite %d X Offset: ",spritenum);
@ -13125,7 +13142,7 @@ static void FuncMenu(void)
{
char *statename = statesinfo[funcMenuStatenum[(col-1)*8 + row]].name;
int32_t snlen = Bstrlen(statename);
char *tmpscript = Bmalloc(1+5+1+snlen+1);
char *tmpscript = (char *)Bmalloc(1+5+1+snlen+1);
if (!tmpscript)
break;

View file

@ -146,7 +146,7 @@ void G_AddGroup(const char *buffer)
{
char buf[BMAX_PATH];
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
struct strllist *s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
Bstrcpy(buf, buffer);
@ -167,7 +167,7 @@ void G_AddGroup(const char *buffer)
void G_AddPath(const char *buffer)
{
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
struct strllist *s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
s->str = Bstrdup(buffer);
if (CommandPaths)
@ -311,7 +311,7 @@ void G_DoAutoload(const char *dirname)
// returns a buffer of size BMAX_PATH
char *dup_filename(const char *fn)
{
char *buf = Bmalloc(BMAX_PATH);
char *buf = (char *)Bmalloc(BMAX_PATH);
return Bstrncpyz(buf, fn, BMAX_PATH);
}

View file

@ -603,7 +603,7 @@ int32_t CONFIG_ReadSetup(void)
// #ifdef _WIN32
if (g_noSetup == 0 && g_modDir[0] == '/')
{
struct stat st;
struct Bstat st;
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
if (Bstat(g_modDir, &st))
@ -792,7 +792,7 @@ void CONFIG_WriteSetup(uint32_t flags)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,FALSE,FALSE); // JBF 20031206
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr[0]);
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",g_grpNamePtr);
// XXX: should be "if compiled without startup GUI"
#if !defined __linux || defined HAVE_GTK2

View file

@ -728,7 +728,7 @@ nextdemo_nomenu:
if (Demo_IsProfiling())
{
int32_t t = gethitickms();
int32_t t = (int32_t)gethitickms();
G_DoMoveThings();
Demo_GToc(t);
}

View file

@ -128,7 +128,7 @@ enet_symbol_rescale (ENetSymbol * symbol)
if((encodeLow ^ (encodeLow + encodeRange)) >= ENET_RANGE_CODER_TOP) \
{ \
if(encodeRange >= ENET_RANGE_CODER_BOTTOM) break; \
encodeRange = -encodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \
encodeRange = -(signed)encodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \
} \
ENET_RANGE_CODER_OUTPUT (encodeLow >> 24); \
encodeRange <<= 8; \
@ -360,7 +360,7 @@ enet_range_coder_compress (void * context, const ENetBuffer * inBuffers, size_t
if((decodeLow ^ (decodeLow + decodeRange)) >= ENET_RANGE_CODER_TOP) \
{ \
if(decodeRange >= ENET_RANGE_CODER_BOTTOM) break; \
decodeRange = -decodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \
decodeRange = -(signed)decodeLow & (ENET_RANGE_CODER_BOTTOM - 1); \
} \
decodeCode <<= 8; \
if (inData < inEnd) \

View file

@ -430,7 +430,7 @@ enet_peer_ping (ENetPeer * peer)
void
enet_peer_ping_interval (ENetPeer * peer, enet_uint32 pingInterval)
{
peer -> pingInterval = pingInterval ? pingInterval : ENET_PEER_PING_INTERVAL;
peer -> pingInterval = pingInterval ? pingInterval : (enet_uint32)ENET_PEER_PING_INTERVAL;
}
/** Sets the timeout parameters for a peer.
@ -453,9 +453,9 @@ enet_peer_ping_interval (ENetPeer * peer, enet_uint32 pingInterval)
void
enet_peer_timeout (ENetPeer * peer, enet_uint32 timeoutLimit, enet_uint32 timeoutMinimum, enet_uint32 timeoutMaximum)
{
peer -> timeoutLimit = timeoutLimit ? timeoutLimit : ENET_PEER_TIMEOUT_LIMIT;
peer -> timeoutMinimum = timeoutMinimum ? timeoutMinimum : ENET_PEER_TIMEOUT_MINIMUM;
peer -> timeoutMaximum = timeoutMaximum ? timeoutMaximum : ENET_PEER_TIMEOUT_MAXIMUM;
peer -> timeoutLimit = timeoutLimit ? timeoutLimit : (enet_uint32)ENET_PEER_TIMEOUT_LIMIT;
peer -> timeoutMinimum = timeoutMinimum ? timeoutMinimum : (enet_uint32)ENET_PEER_TIMEOUT_MINIMUM;
peer -> timeoutMaximum = timeoutMaximum ? timeoutMaximum : (enet_uint32)ENET_PEER_TIMEOUT_MAXIMUM;
}
/** Force an immediate disconnection from a peer.

View file

@ -61,6 +61,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h"
#include "common_game.h"
#include "input.h"
#include "compat.h"
#ifdef LUNATIC
# include "lunatic_game.h"
@ -1725,7 +1726,7 @@ static void G_PrintCoords(int32_t snum)
Bsprintf(tempbuf,"OG= %d SBRIDGE=%d SBS=%d",ps->on_ground, ps->spritebridge, ps->sbs);
printext256(x,y+27,31,-1,tempbuf,0);
if (sectnum >= 0)
Bsprintf(tempbuf,"SECT= %d (LO=%d EX=%d)",sectnum,sector[sectnum].lotag,sector[sectnum].extra);
Bsprintf_nowarn(tempbuf,"SECT= %d (LO=%d EX=%d)",sectnum,sector[sectnum].lotag,sector[sectnum].extra);
else
Bsprintf(tempbuf,"SECT= %d", sectnum);
printext256(x,y+36,31,-1,tempbuf,0);
@ -3584,8 +3585,8 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
// If the view is rotated (not 0 or 180 degrees modulo 360 degrees),
// we render onto a square tile and display a portion of that
// rotated on-screen later on.
const int32_t viewtilexsiz = ((tang&1023) ? tiltcx : tiltcy)>>!ud.detail;
const int32_t viewtileysiz = tiltcx>>!ud.detail;
const int32_t viewtilexsiz = ((tang&1023) ? tiltcx : tiltcy)>>(int)!ud.detail;
const int32_t viewtileysiz = tiltcx>>(int)!ud.detail;
walock[TILE_TILT] = 255;
if (waloff[TILE_TILT] == 0)
@ -3597,8 +3598,8 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
if ((tang&1023) == 512)
{
//Block off unscreen section of 90ø tilted screen
j = ((tiltcx-(60*tiltcs))>>!ud.detail);
for (i=((60*tiltcs)>>!ud.detail)-1; i>=0; i--)
j = ((tiltcx-(60*tiltcs))>>(int)!ud.detail);
for (i=((60*tiltcs)>>(int)!ud.detail)-1; i>=0; i--)
{
startumost[i] = 1;
startumost[i+j] = 1;
@ -3802,7 +3803,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
// NOTE: maybe need to move this to the engine...
begindrawing();
{
palette_t *const frame = Bcalloc(xdim*ydim, 4);
palette_t *const frame = (palette_t *const)Bcalloc(xdim*ydim, 4);
char *const pic = (char *)waloff[TILE_SAVESHOT];
int32_t x, y;
@ -3907,12 +3908,13 @@ static void G_DumpDebugInfo(void)
}
OSD_Printf("\n");
}
for (x=0; x<MAXSTATUS; x++)
{
j = headspritestat[x];
while (j >= 0)
{
OSD_Printf("Sprite %d (%d,%d,%d) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum);
OSD_Printf_nowarn("Sprite %d (%d,%d,%d) (picnum: %d)\n",j,sprite[j].x,sprite[j].y,sprite[j].z,sprite[j].picnum);
for (i=0; i<g_gameVarCount; i++)
{
if (aGameVars[i].dwFlags & (GAMEVAR_PERACTOR))
@ -3969,7 +3971,7 @@ int32_t A_InsertSprite(int32_t whatsect,int32_t s_x,int32_t s_y,int32_t s_z,int3
if (i < 0)
{
G_DumpDebugInfo();
OSD_Printf("Failed spawning pic %d spr from pic %d spr %d at x:%d,y:%d,z:%d,sect:%d\n",
OSD_Printf_nowarn("Failed spawning pic %d spr from pic %d spr %d at x:%d,y:%d,z:%d,sect:%d\n",
s_pn,sprite[s_ow].picnum,s_ow,s_x,s_y,s_z,whatsect);
G_GameExit("Too many sprites spawned.");
}
@ -4984,7 +4986,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
if (sp->hitag && sp->picnum == WATERBUBBLEMAKER)
{
// JBF 20030913: Pisses off X_Move(), eg. in bobsp2
OSD_Printf(OSD_ERROR "WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n",
OSD_Printf_nowarn(OSD_ERROR "WARNING: WATERBUBBLEMAKER %d @ %d,%d with hitag!=0. Applying fixup.\n",
i,sp->x,sp->y);
sp->hitag = 0;
}
@ -5590,7 +5592,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
else
{
// XXX: we should return to the menu for this and similar failures
Bsprintf(tempbuf, "SE 17 (warp elevator) setup failed: sprite %d at (%d, %d)",
Bsprintf_nowarn(tempbuf, "SE 17 (warp elevator) setup failed: sprite %d at (%d, %d)",
i, sprite[i].x, sprite[i].y);
G_GameExit(tempbuf);
}
@ -5795,7 +5797,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
}
if (j == -1)
{
OSD_Printf(OSD_ERROR "Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y);
OSD_Printf_nowarn(OSD_ERROR "Found lonely Sector Effector (lotag 0) at (%d,%d)\n",sp->x,sp->y);
changespritestat(i, STAT_ACTOR);
if (apScriptGameEvent[EVENT_SPAWN])
{
@ -5818,7 +5820,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
tempwallptr++;
if (tempwallptr > 2047)
{
Bsprintf(tempbuf,"Too many moving sectors at (%d,%d).\n",wall[s].x,wall[s].y);
Bsprintf_nowarn(tempbuf,"Too many moving sectors at (%d,%d).\n",wall[s].x,wall[s].y);
G_GameExit(tempbuf);
}
}
@ -5831,7 +5833,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
startwall = sector[sect].wallptr;
endwall = startwall+sector[sect].wallnum;
if (sector[sect].hitag == -1)
if (sector[sect].hitag == UINT16_MAX)
sp->extra = 0;
else sp->extra = 1;
@ -5876,7 +5878,7 @@ int32_t A_Spawn(int32_t j, int32_t pn)
#endif
if (j == 0)
{
Bsprintf(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y);
Bsprintf_nowarn(tempbuf,"Subway found no zero'd sectors with locators\nat (%d,%d).\n",sp->x,sp->y);
G_GameExit(tempbuf);
}
@ -7672,7 +7674,7 @@ void G_HandleLocalKeys(void)
if (KB_KeyPressed(sc_kpad_6))
{
KB_ClearKeyDown(sc_kpad_6);
j = (15<<ALT_IS_PRESSED)<<(2*SHIFTS_IS_PRESSED);
j = (15<<(int)ALT_IS_PRESSED)<<(2*(int)SHIFTS_IS_PRESSED);
g_demo_goalCnt = g_demo_paused ? g_demo_cnt+1 : g_demo_cnt+REALGAMETICSPERSEC*j;
g_demo_rewind = 0;
@ -7684,7 +7686,7 @@ void G_HandleLocalKeys(void)
else if (KB_KeyPressed(sc_kpad_4))
{
KB_ClearKeyDown(sc_kpad_4);
j = (15<<ALT_IS_PRESSED)<<(2*SHIFTS_IS_PRESSED);
j = (15<<(int)ALT_IS_PRESSED)<<(2*(int)SHIFTS_IS_PRESSED);
g_demo_goalCnt = g_demo_paused ? g_demo_cnt-1 : g_demo_cnt-REALGAMETICSPERSEC*j;
g_demo_rewind = 1;
@ -8424,7 +8426,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
}
if (!preload)
anim_hi_sounds[animnum] = Bcalloc(allocsz, 2*sizeof(anim_hi_sounds[0]));
anim_hi_sounds[animnum] = (uint16_t *)Bcalloc(allocsz, 2*sizeof(anim_hi_sounds[0]));
while (script->textptr < animsoundsend)
{
int32_t framenum, soundnum;
@ -8485,7 +8487,7 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
newptr = Brealloc(anim_hi_sounds[animnum], allocsz*2*sizeof(anim_hi_sounds[0]));
if (!newptr) break;
anim_hi_sounds[animnum] = newptr;
anim_hi_sounds[animnum] = (uint16_t *)newptr;
}
bad=0;
@ -8968,7 +8970,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
break;
case 'd':
{
char *colon = Bstrchr(c, ':');
char * colon = (char *)Bstrchr(c, ':');
int32_t framespertic=-1, numrepeats=1;
c++;
@ -9511,8 +9513,8 @@ static void G_CompileScripts(void)
char *newlabel;
int32_t *newlabelcode;
newlabel = Bmalloc(g_numLabels<<6);
newlabelcode = Bmalloc(g_numLabels*sizeof(int32_t));
newlabel = (char *)Bmalloc(g_numLabels<<6);
newlabelcode = (int32_t *)Bmalloc(g_numLabels*sizeof(int32_t));
if (!newlabel || !newlabelcode)
G_GameExit("Error: out of memory retaining labels\n");
@ -9949,7 +9951,13 @@ int32_t app_main(int32_t argc, const char **argv)
wm_setapptitle(tempbuf);
//initprintf("sizeof(mapstate_t)=%d\n", (int32_t)sizeof(mapstate_t));
initprintf(HEAD2 " %s\n", s_buildRev);
initprintf(HEAD2 " %s %s\n", s_buildRev,
#ifdef __cplusplus
"C++ build"
#else
""
#endif
);
initprintf("Compiled %s\n", __DATE__" "__TIME__);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
@ -10397,7 +10405,7 @@ int32_t app_main(int32_t argc, const char **argv)
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (CONTROL_Startup(1, &GetTime, TICRATE))
if (CONTROL_Startup(controltype_keyboardandmouse, &GetTime, TICRATE))
{
ERRprintf("There was an error initializing the CONTROL system.\n");
uninitengine();

View file

@ -1206,7 +1206,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
char *scriptptrs;
char *newbitptr;
scriptptrs = Bcalloc(1, g_scriptSize * sizeof(uint8_t));
scriptptrs = (char *)Bcalloc(1, g_scriptSize * sizeof(uint8_t));
for (i=g_scriptSize-1; i>=0; i--)
{
@ -1231,7 +1231,7 @@ static int32_t C_SetScriptSize(int32_t newsize)
initprintf("Resizing code buffer to %d*%d bytes\n",newsize, (int32_t)sizeof(intptr_t));
newscript = (intptr_t *)Brealloc(script, newsize * sizeof(intptr_t));
newbitptr = Bcalloc(1,(((newsize+7)>>3)+1) * sizeof(uint8_t));
newbitptr = (char *)Bcalloc(1,(((newsize+7)>>3)+1) * sizeof(uint8_t));
if (newscript == NULL || newbitptr == NULL)
{
@ -2504,9 +2504,9 @@ static int32_t C_ParseCommand(int32_t loop)
tempbuf[j+1] = '\0';
if (MapInfo[(k*MAXLEVELS)+i].musicfn == NULL)
MapInfo[(k*MAXLEVELS)+i].musicfn = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
MapInfo[(k*MAXLEVELS)+i].musicfn = (char *)Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[(k*MAXLEVELS)+i].musicfn))
MapInfo[(k*MAXLEVELS)+i].musicfn = Brealloc(MapInfo[(k*MAXLEVELS)+i].musicfn,(Bstrlen(tempbuf)+1));
MapInfo[(k*MAXLEVELS)+i].musicfn = (char *)Brealloc(MapInfo[(k*MAXLEVELS)+i].musicfn,(Bstrlen(tempbuf)+1));
Bstrcpy(MapInfo[(k*MAXLEVELS)+i].musicfn,tempbuf);
@ -4147,7 +4147,6 @@ static int32_t C_ParseCommand(int32_t loop)
g_tile[*g_scriptPtr].flags |= SPRITE_NOPAL;
break;
case CON_PRECACHE:
g_tile[*g_scriptPtr].flags |= SPRITE_CACHE;
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
i = *g_scriptPtr;
@ -4156,16 +4155,13 @@ static int32_t C_ParseCommand(int32_t loop)
C_ReportError(ERROR_EXCEEDSMAXTILES);
g_numCompilerErrors++;
}
g_tile[j].cacherange[0] = i;
g_tile[j].cacherange = i;
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
i = *g_scriptPtr;
if ((unsigned)i >= MAXTILES)
{
C_ReportError(ERROR_EXCEEDSMAXTILES);
g_numCompilerErrors++;
}
g_tile[j].cacherange[1] = i;
if (*g_scriptPtr)
g_tile[j].flags |= SPRITE_CACHE;
break;
}
continue;
@ -5101,7 +5097,7 @@ repeatcase:
if (Bstrcmp(setupfilename,SETUPFILENAME) == 0) // not set to something else via -cfg
{
char temp[BMAX_PATH];
struct stat st;
struct Bstat st;
int32_t fullscreen = ud.config.ScreenMode;
int32_t xdim = ud.config.ScreenWidth, ydim = ud.config.ScreenHeight, bpp = ud.config.ScreenBPP;
int32_t usemouse = ud.config.UseMouse, usejoy = ud.config.UseJoystick;
@ -5243,9 +5239,9 @@ repeatcase:
Bcorrectfilename(tempbuf,0);
if (MapInfo[j *MAXLEVELS+k].filename == NULL)
MapInfo[j *MAXLEVELS+k].filename = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
MapInfo[j *MAXLEVELS+k].filename = (char *)Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[j*MAXLEVELS+k].filename))
MapInfo[j *MAXLEVELS+k].filename = Brealloc(MapInfo[j*MAXLEVELS+k].filename,(Bstrlen(tempbuf)+1));
MapInfo[j *MAXLEVELS+k].filename = (char *)Brealloc(MapInfo[j*MAXLEVELS+k].filename,(Bstrlen(tempbuf)+1));
Bstrcpy(MapInfo[j*MAXLEVELS+k].filename,tempbuf);
@ -5284,9 +5280,9 @@ repeatcase:
tempbuf[i] = '\0';
if (MapInfo[j*MAXLEVELS+k].name == NULL)
MapInfo[j*MAXLEVELS+k].name = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
MapInfo[j*MAXLEVELS+k].name = (char *)Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[j*MAXLEVELS+k].name))
MapInfo[j *MAXLEVELS+k].name = Brealloc(MapInfo[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1));
MapInfo[j *MAXLEVELS+k].name = (char *)Brealloc(MapInfo[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1));
/* initprintf("level name string len: %d\n",Bstrlen(tempbuf)); */
@ -5312,7 +5308,7 @@ repeatcase:
}
if (ScriptQuotes[k] == NULL)
ScriptQuotes[k] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuotes[k] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
if (!ScriptQuotes[k])
{
@ -5332,7 +5328,7 @@ repeatcase:
if (tw == CON_REDEFINEQUOTE)
{
if (ScriptQuoteRedefinitions[g_numQuoteRedefinitions] == NULL)
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
if (!ScriptQuoteRedefinitions[g_numQuoteRedefinitions])
{
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = NULL;
@ -5431,7 +5427,7 @@ repeatcase:
C_SkipComments();
if (g_sounds[k].filename == NULL)
g_sounds[k].filename = Bcalloc(BMAX_PATH,sizeof(uint8_t));
g_sounds[k].filename = (char *)Bcalloc(BMAX_PATH,sizeof(uint8_t));
if (!g_sounds[k].filename)
{
Bsprintf(tempbuf,"Failed allocating %" PRIdPTR " byte buffer.",sizeof(uint8_t) * BMAX_PATH);
@ -5816,8 +5812,9 @@ static void C_InitProjectiles(void)
defaultprojectile_t DefaultProjectile =
{
1, -1, 2048, 0, 0, SMALLSMOKE, -1, -1, 600, BULLETHOLE, -1, 0, 0, 448, g_numFreezeBounces, PIPEBOMB_BOUNCE, 1,
100, -1, -1, -1, -1, -1, -96, 18, 18, 0, 1, 32, {0,0,0,0,0,0},
1, -1, 2048, 0, 0, (int16_t)SMALLSMOKE, -1, -1, 600, (int16_t)BULLETHOLE, -1, 0, 0, 448,
(int16_t)g_numFreezeBounces, (int16_t)PIPEBOMB_BOUNCE, 1, 100, -1, -1, -1, -1, -1, -96, 18, 18,
0, 1, 32, {0,0,0,0,0,0},
};
// this will only happen if I forget to update this function...
@ -6045,7 +6042,7 @@ void C_Compile(const char *filenam)
for (i=127; i>=0; i--)
if (ScriptQuotes[i] == NULL)
ScriptQuotes[i] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuotes[i] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
for (i=MAXQUOTELEN-7; i>=0; i--)
if (Bstrncmp(&ScriptQuotes[13][i],"SPACE",5) == 0)
@ -6127,7 +6124,7 @@ void C_Compile(const char *filenam)
{
if (ScriptQuotes[i+OBITQUOTEINDEX] == NULL)
{
ScriptQuotes[i+OBITQUOTEINDEX] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuotes[i+OBITQUOTEINDEX] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
Bstrcpy(ScriptQuotes[i+OBITQUOTEINDEX],PlayerObituaries[i]);
}
}
@ -6137,7 +6134,7 @@ void C_Compile(const char *filenam)
{
if (ScriptQuotes[i+SUICIDEQUOTEINDEX] == NULL)
{
ScriptQuotes[i+SUICIDEQUOTEINDEX] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
ScriptQuotes[i+SUICIDEQUOTEINDEX] = (char *)Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
Bstrcpy(ScriptQuotes[i+SUICIDEQUOTEINDEX],PlayerSelfObituaries[i]);
}
}

View file

@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdlib.h>
#include <math.h> // sqrt
#include "compat.h"
#include "duke3d.h"
#include "gamedef.h"
#include "gameexec.h"
@ -87,7 +89,7 @@ void VM_ScriptInfo(void)
}
if (vm.g_i)
initprintf("current actor: %d (%d)\n",vm.g_i,vm.g_sp->picnum);
initprintf_nowarn("current actor: %d (%d)\n",vm.g_i,vm.g_sp->picnum);
initprintf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw);
}
@ -442,7 +444,7 @@ GAMEEXEC_STATIC void VM_AlterAng(int32_t a)
{
vm.g_t[1] = 0;
OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum);
OSD_Printf_nowarn(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum);
return;
}
@ -591,7 +593,7 @@ dead:
if ((unsigned)vm.g_t[1] >= (unsigned)g_scriptSize-1)
{
vm.g_t[1] = 0;
OSD_Printf(OSD_ERROR "clearing bad moveptr for actor %d (%d)\n", vm.g_i, vm.g_sp->picnum);
OSD_Printf_nowarn(OSD_ERROR "clearing bad moveptr for actor %d (%d)\n", vm.g_i, vm.g_sp->picnum);
return;
}
@ -3306,7 +3308,7 @@ nullquote:
case CON_SAVEMAPSTATE:
if (MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate == NULL)
MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate = Bcalloc(1,sizeof(mapstate_t));
MapInfo[ud.volume_number *MAXLEVELS+ud.level_number].savedstate = (mapstate_t *)Bcalloc(1,sizeof(mapstate_t));
G_SaveMapState(MapInfo[ud.volume_number*MAXLEVELS+ud.level_number].savedstate);
insptr++;
continue;
@ -4165,7 +4167,8 @@ nullquote:
if (j<0 || j >= g_gameArrayCount || index >= aGameArrays[j].size || index < 0)
{
OSD_Printf(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",j,vm.g_i,sprite[vm.g_i].picnum,vm.g_p);
OSD_Printf_nowarn(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",
j,vm.g_i,sprite[vm.g_i].picnum,vm.g_p);
continue;
}
aGameArrays[j].plValues[index]=value;
@ -4199,7 +4202,7 @@ nullquote:
{
/*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n",
aGameArrays[j].szLabel, aGameArrays[j].size, asize / GAR_ELTSZ);*/
aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, asize);
aGameArrays[j].plValues = (intptr_t *)Brealloc(aGameArrays[j].plValues, asize);
aGameArrays[j].size = asize / GAR_ELTSZ;
kread(fil, aGameArrays[j].plValues, asize);
}
@ -4250,7 +4253,7 @@ nullquote:
if (asize > 0)
{
/*OSD_Printf(OSDTEXT_GREEN "CON_RESIZEARRAY: resizing array %s from %d to %d\n", aGameArrays[j].szLabel, aGameArrays[j].size, asize);*/
aGameArrays[j].plValues=Brealloc(aGameArrays[j].plValues, GAR_ELTSZ * asize);
aGameArrays[j].plValues = (intptr_t *)Brealloc(aGameArrays[j].plValues, GAR_ELTSZ * asize);
aGameArrays[j].size = asize;
}
continue;
@ -4978,7 +4981,8 @@ nullquote:
if (vm.g_sp->yvel) G_OperateRespawns(vm.g_sp->yvel);
break;
default:
if (vm.g_sp->hitag >= 0) G_OperateRespawns(vm.g_sp->hitag);
// if (vm.g_sp->hitag >= 0)
G_OperateRespawns(vm.g_sp->hitag);
break;
}
continue;
@ -5309,13 +5313,13 @@ void G_SaveMapState(mapstate_t *save)
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
{
if (!save->vars[i])
save->vars[i] = Bcalloc(MAXPLAYERS,sizeof(intptr_t));
save->vars[i] = (intptr_t *)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
Bmemcpy(&save->vars[i][0],&aGameVars[i].val.plValues[0],sizeof(intptr_t) * MAXPLAYERS);
}
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
{
if (!save->vars[i])
save->vars[i] = Bcalloc(MAXSPRITES,sizeof(intptr_t));
save->vars[i] = (intptr_t *)Bcalloc(MAXSPRITES,sizeof(intptr_t));
Bmemcpy(&save->vars[i][0],&aGameVars[i].val.plValues[0],sizeof(intptr_t) * MAXSPRITES);
}
else save->vars[i] = (intptr_t *)aGameVars[i].val.lValue;

View file

@ -151,7 +151,7 @@ int32_t VM_OnEvent(int32_t iEventID,int32_t iActor,int32_t iPlayer,int32_t lDist
void VM_ScriptInfo(void);
#define CON_ERRPRINTF(Text, ...) do { \
OSD_Printf("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
} while (0)
OSD_Printf_nowarn("Line %d, %s: " Text, g_errorLineNum, keyw[g_tw], ## __VA_ARGS__); \
} while (0)
#endif
#endif

View file

@ -127,18 +127,18 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
for (i=0; i<g_gameVarCount; i++)
{
if (kdfread(&(aGameVars[i]),sizeof(gamevar_t),1,fil) != 1) goto corrupt;
aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(uint8_t));
aGameVars[i].szLabel = (char *)Bcalloc(MAXVARLABEL,sizeof(uint8_t));
if (kdfread(aGameVars[i].szLabel,sizeof(uint8_t) * MAXVARLABEL, 1, fil) != 1) goto corrupt;
hash_add(&h_gamevars, aGameVars[i].szLabel,i, 1);
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
{
aGameVars[i].val.plValues=Bcalloc(MAXPLAYERS,sizeof(intptr_t));
aGameVars[i].val.plValues = (intptr_t*)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
if (kdfread(aGameVars[i].val.plValues,sizeof(intptr_t) * MAXPLAYERS, 1, fil) != 1) goto corrupt;
}
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
{
aGameVars[i].val.plValues=Bcalloc(MAXSPRITES,sizeof(intptr_t));
aGameVars[i].val.plValues = (intptr_t*)Bcalloc(MAXSPRITES,sizeof(intptr_t));
if (kdfread(&aGameVars[i].val.plValues[0],sizeof(intptr_t), MAXSPRITES, fil) != MAXSPRITES) goto corrupt;
}
}
@ -155,11 +155,11 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
for (i=0; i<g_gameArrayCount; i++)
{
if (kdfread(&(aGameArrays[i]),sizeof(gamearray_t),1,fil) != 1) goto corrupt;
aGameArrays[i].szLabel=Bcalloc(MAXARRAYLABEL,sizeof(uint8_t));
aGameArrays[i].szLabel = (char *)Bcalloc(MAXARRAYLABEL,sizeof(uint8_t));
if (kdfread(aGameArrays[i].szLabel,sizeof(uint8_t) * MAXARRAYLABEL, 1, fil) != 1) goto corrupt;
hash_add(&h_arrays, aGameArrays[i].szLabel, i, 1);
aGameArrays[i].plValues=Bcalloc(aGameArrays[i].size, GAR_ELTSZ);
aGameArrays[i].plValues = (intptr_t *)Bcalloc(aGameArrays[i].size, GAR_ELTSZ);
if (kdfread(aGameArrays[i].plValues, GAR_ELTSZ * aGameArrays[i].size, 1, fil) < 1) goto corrupt;
}
@ -178,7 +178,7 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
if (savedstate[i])
{
if (MapInfo[i].savedstate == NULL)
MapInfo[i].savedstate = Bcalloc(1,sizeof(mapstate_t));
MapInfo[i].savedstate = (mapstate_t *)Bcalloc(1,sizeof(mapstate_t));
if (kdfread(MapInfo[i].savedstate,sizeof(mapstate_t),1,fil) != sizeof(mapstate_t)) goto corrupt;
for (j=0; j<g_gameVarCount; j++)
{
@ -186,13 +186,13 @@ int32_t Gv_ReadSave(int32_t fil, int32_t newbehav)
if (aGameVars[j].dwFlags & GAMEVAR_PERPLAYER)
{
// if (!MapInfo[i].savedstate->vars[j])
MapInfo[i].savedstate->vars[j] = Bcalloc(MAXPLAYERS,sizeof(intptr_t));
MapInfo[i].savedstate->vars[j] = (intptr_t *)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t) * MAXPLAYERS, 1, fil) != 1) goto corrupt;
}
else if (aGameVars[j].dwFlags & GAMEVAR_PERACTOR)
{
// if (!MapInfo[i].savedstate->vars[j])
MapInfo[i].savedstate->vars[j] = Bcalloc(MAXSPRITES,sizeof(intptr_t));
MapInfo[i].savedstate->vars[j] = (intptr_t *)Bcalloc(MAXSPRITES,sizeof(intptr_t));
if (kdfread(&MapInfo[i].savedstate->vars[j][0],sizeof(intptr_t), MAXSPRITES, fil) != MAXSPRITES) goto corrupt;
}
}
@ -478,7 +478,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if ((aGameVars[i].dwFlags & GAMEVAR_SYSTEM) == 0)
{
if (aGameVars[i].szLabel == NULL)
aGameVars[i].szLabel=Bcalloc(MAXVARLABEL,sizeof(uint8_t));
aGameVars[i].szLabel = (char *)Bcalloc(MAXVARLABEL,sizeof(uint8_t));
if (aGameVars[i].szLabel != pszLabel)
Bstrcpy(aGameVars[i].szLabel,pszLabel);
aGameVars[i].dwFlags=dwFlags;
@ -505,14 +505,14 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if (aGameVars[i].dwFlags & GAMEVAR_PERPLAYER)
{
if (!aGameVars[i].val.plValues)
aGameVars[i].val.plValues=Bcalloc(MAXPLAYERS,sizeof(intptr_t));
aGameVars[i].val.plValues = (intptr_t *)Bcalloc(MAXPLAYERS,sizeof(intptr_t));
for (j=MAXPLAYERS-1; j>=0; j--)
aGameVars[i].val.plValues[j]=lValue;
}
else if (aGameVars[i].dwFlags & GAMEVAR_PERACTOR)
{
if (!aGameVars[i].val.plValues)
aGameVars[i].val.plValues=Bcalloc(MAXSPRITES,sizeof(intptr_t));
aGameVars[i].val.plValues = (intptr_t *)Bcalloc(MAXSPRITES,sizeof(intptr_t));
for (j=MAXSPRITES-1; j>=0; j--)
aGameVars[i].val.plValues[j]=lValue;
}

View file

@ -33,15 +33,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct grpfile grpfiles[NUMGRPFILES] =
{
{ "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D (South Korean Censored)", 0xAA4F6A40, 26385383, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D: Atomic Edition", 0xFD3DCFF1, 44356548, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D: Atomic Edition (Censored)", 0xF514A6AC, 44348015, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D Shareware", 0x983AD923, 11035779, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D Mac Shareware", 0xC5F71561, 10444391, GAMEFLAG_DUKE, NULL },
{ "NAM", 0x75C1F07B, 43448927, GAMEFLAG_NAM, NULL },
{ "Napalm", 0x3DE1589A, 44365728, GAMEFLAG_NAM|GAMEFLAG_NAPALM, NULL },
{ "WWII GI", 0x907B82BF, 77939508, GAMEFLAG_WW2GI|GAMEFLAG_NAM, NULL },
{ "Duke Nukem 3D", (int32_t)0xBBC9CE44, 26524524, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D (South Korean Censored)", (int32_t)0xAA4F6A40, 26385383, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D: Atomic Edition", (int32_t)0xFD3DCFF1, 44356548, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D: Plutonium Pak", (int32_t)0xF514A6AC, 44348015, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D Shareware", (int32_t)0x983AD923, 11035779, GAMEFLAG_DUKE, NULL },
{ "Duke Nukem 3D Mac Shareware", (int32_t)0xC5F71561, 10444391, GAMEFLAG_DUKE, NULL },
{ "NAM", (int32_t)0x75C1F07B, 43448927, GAMEFLAG_NAM, NULL },
{ "Napalm", (int32_t)0x3DE1589A, 44365728, GAMEFLAG_NAM|GAMEFLAG_NAPALM, NULL },
{ "WWII GI", (int32_t)0x907B82BF, 77939508, GAMEFLAG_WW2GI|GAMEFLAG_NAM, NULL },
};
struct grpfile *foundgrps = NULL;
@ -75,7 +75,7 @@ static int32_t LoadGroupsCache(void)
if (scriptfile_getnumber(script, &fmtime)) break; // modification time
if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum
fg = Bcalloc(1, sizeof(struct grpcache));
fg = (struct grpcache *)Bcalloc(1, sizeof(struct grpcache));
fg->next = grpcache;
grpcache = fg;
@ -109,7 +109,7 @@ int32_t ScanGroups(void)
char *fn;
struct Bstat st;
#define BUFFER_SIZE (1024 * 1024 * 8)
uint8_t *buf = Bmalloc(BUFFER_SIZE);
uint8_t *buf = (uint8_t *)Bmalloc(BUFFER_SIZE);
if (!buf)
{
@ -165,7 +165,7 @@ int32_t ScanGroups(void)
fh = openfrompath(sidx->name, BO_RDONLY|BO_BINARY, BS_IREAD);
if (fh < 0) continue;
if (fstat(fh, &st)) continue;
if (Bfstat(fh, &st)) continue;
initprintf(" Checksumming %s...", sidx->name);
crc32init((uint32_t *)&crcval);

View file

@ -23,7 +23,7 @@
void ClearBuffer_DW( void *ptr, unsigned data, int32_t length )
{
unsigned *ptrdw = ptr;
unsigned *ptrdw = (unsigned *)ptr;
while (length--) {
*(ptrdw++) = data;
}

View file

@ -259,7 +259,7 @@ void ANIM_LoadAnim(char * buffer)
{
uint16_t i;
anim = Brealloc(anim, sizeof(anim_t));
anim = (anim_t *)Brealloc(anim, sizeof(anim_t));
anim->curlpnum = 0xffff;
anim->currentframe = -1;

View file

@ -122,7 +122,7 @@ void SCRIPT_FreeSection(ScriptSectionType * section)
#define AllocSection(s) \
{ \
(s) = Bmalloc(sizeof(ScriptSectionType)); \
(s) = (ScriptSectionType *)Bmalloc(sizeof(ScriptSectionType)); \
(s)->name = NULL; \
(s)->entries = NULL; \
(s)->lastline = NULL; \
@ -131,7 +131,7 @@ void SCRIPT_FreeSection(ScriptSectionType * section)
}
#define AllocEntry(e) \
{ \
(e) = Bmalloc(sizeof(ScriptEntryType)); \
(e) = (ScriptEntryType *)Bmalloc(sizeof(ScriptEntryType)); \
(e)->name = NULL; \
(e)->value = NULL; \
(e)->nextentry = (e); \
@ -827,7 +827,7 @@ void SCRIPT_PutString
if (*q == '\r' || *q == '\n' || *q == '\t' || *q == '\\' || *q == '"') len+=2;
else if (*q >= ' ') len++;
}
p = raw = Bmalloc(len);
p = raw = (char *)Bmalloc(len);
*(p++) = '"';
for (q=string; *q; q++)
{
@ -868,7 +868,7 @@ void SCRIPT_PutDoubleString
if (*q == '\r' || *q == '\n' || *q == '\t' || *q == '\\' || *q == '"') len+=2;
else if (*q >= ' ') len++;
}
p = raw = Bmalloc(len);
p = raw = (char *)Bmalloc(len);
*(p++) = '"';
for (q=string1; *q; q++)
{

View file

@ -787,9 +787,9 @@ static int32_t C_CopyLabel(void)
{
if (g_numLabels >= label_allocsize)
{
label = Brealloc(label, 2*label_allocsize*MAXLABELLEN*sizeof(char));
labelval = Brealloc(labelval, 2*label_allocsize*sizeof(labelval[0]));
labeltype = Brealloc(labeltype, 2*label_allocsize*sizeof(labeltype[0]));
label = (char *)Brealloc(label, 2*label_allocsize*MAXLABELLEN*sizeof(char));
labelval = (int32_t *)Brealloc(labelval, 2*label_allocsize*sizeof(labelval[0]));
labeltype = (uint8_t *)Brealloc(labeltype, 2*label_allocsize*sizeof(labeltype[0]));
if (label==NULL || labelval==NULL || labeltype==NULL)
{
@ -1025,7 +1025,7 @@ static void C_GetNextVarType(int32_t type)
if (i>=constants_allocsize)
{
constants_allocsize *= 2;
constants = Brealloc(constants, constants_allocsize * sizeof(constants[0]));
constants = (int32_t *)Brealloc(constants, constants_allocsize * sizeof(constants[0]));
if (!constants)
{
initprintf("C_GetNextVarType(): ERROR: out of memory!\n");
@ -1826,7 +1826,7 @@ static int32_t C_ParseCommand(void)
if (g_stateCount >= statesinfo_allocsize)
{
statesinfo_allocsize *= 2;
statesinfo = Brealloc(statesinfo, statesinfo_allocsize * sizeof(statesinfo[0]));
statesinfo = (statesinfo_t *)Brealloc(statesinfo, statesinfo_allocsize * sizeof(statesinfo[0]));
if (!statesinfo)
{
initprintf("C_ParseCommand(): ERROR: out of memory!\n");
@ -3220,7 +3220,7 @@ repeatcase:
}
if (ScriptQuotes[k] == NULL)
ScriptQuotes[k] = Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
ScriptQuotes[k] = (char *)Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
if (!ScriptQuotes[k])
{
@ -3238,7 +3238,7 @@ repeatcase:
if (tw == CON_REDEFINEQUOTE)
{
if (ScriptQuoteRedefinitions[g_numQuoteRedefinitions] == NULL)
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
ScriptQuoteRedefinitions[g_numQuoteRedefinitions] = (char *)Bcalloc(MAXQUOTELEN, sizeof(uint8_t));
if (!ScriptQuoteRedefinitions[g_numQuoteRedefinitions])
{
Bsprintf(tempbuf,"Failed allocating %d byte quote text buffer.", MAXQUOTELEN);
@ -3680,13 +3680,13 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
if (firstime)
{
label = Bmalloc(label_allocsize * MAXLABELLEN * sizeof(char));
labelval = Bmalloc(label_allocsize * sizeof(int32_t));
labeltype = Bmalloc(label_allocsize * sizeof(uint8_t));
label = (char *)Bmalloc(label_allocsize * MAXLABELLEN * sizeof(char));
labelval = (int32_t *)Bmalloc(label_allocsize * sizeof(int32_t));
labeltype = (uint8_t *)Bmalloc(label_allocsize * sizeof(uint8_t));
constants = Bmalloc(constants_allocsize * sizeof(int32_t));
constants = (int32_t *)Bmalloc(constants_allocsize * sizeof(int32_t));
statesinfo = Bmalloc(statesinfo_allocsize * sizeof(statesinfo_t));
statesinfo = (statesinfo_t *)Bmalloc(statesinfo_allocsize * sizeof(statesinfo_t));
for (i=0; i<MAXEVENTS; i++)
{
@ -3699,7 +3699,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
Gv_Init();
C_AddDefaultDefinitions();
script = Bcalloc(g_scriptSize, sizeof(instype));
script = (instype *)Bcalloc(g_scriptSize, sizeof(instype));
// initprintf("script: %d\n",script);
if (!script || !label || !labelval || !labeltype || !constants)
{
@ -3719,7 +3719,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
if (isfilename)
{
fs = Bstrlen(filenameortext);
mptr = Bmalloc(fs+1+4);
mptr = (char *)Bmalloc(fs+1+4);
if (!mptr)
{
initprintf("C_Compile(): ERROR: out of memory!\n");
@ -3810,13 +3810,13 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
{
if (aGameVars[i].val.plValues)
{
aGameVars[i].val.plValues = Brealloc(aGameVars[i].val.plValues, (1+MAXEVENTS+g_stateCount)*sizeof(int32_t));
aGameVars[i].val.plValues = (int32_t *)Brealloc(aGameVars[i].val.plValues, (1+MAXEVENTS+g_stateCount)*sizeof(int32_t));
for (j=ostateCount; j<g_stateCount; j++)
aGameVars[i].val.plValues[1+MAXEVENTS+j] = aGameVars[i].lDefault;
}
else
{
aGameVars[i].val.plValues = Bmalloc((1+MAXEVENTS+g_stateCount)*sizeof(int32_t));
aGameVars[i].val.plValues = (int32_t *)Bmalloc((1+MAXEVENTS+g_stateCount)*sizeof(int32_t));
for (j=0; j<(1+MAXEVENTS+g_stateCount); j++)
aGameVars[i].val.plValues[j] = aGameVars[i].lDefault;
}
@ -4006,7 +4006,7 @@ void C_PrintErrorPosition()
return;
{
char *buf = Bmalloc(nchars+1);
char *buf = (char *)Bmalloc(nchars+1);
Bmemcpy(buf, b, nchars);
buf[nchars]=0;

View file

@ -1183,7 +1183,7 @@ skip_check:
int32_t o_g_st=vm.g_st, arsize = aGameArrays[aridx].size;
instype *end=insptr;
int32_t sectcnt, numsects=0;
int16_t *sectlist = aGameArrays[aridx].vals; // actually an int32_t array
int16_t *sectlist = (int16_t *)aGameArrays[aridx].vals; // actually an int32_t array
int32_t *sectlist32 = (int32_t *)sectlist;
int32_t j, startwall, endwall, ns;
static uint8_t sectbitmap[MAXSECTORS>>3];

View file

@ -118,12 +118,12 @@ int32_t Gv_NewArray(const char *pszLabel, void *arrayptr, intptr_t asize, uint32
i = g_gameArrayCount;
if (aGameArrays[i].szLabel == NULL)
aGameArrays[i].szLabel = Bcalloc(MAXARRAYLABEL, sizeof(char));
aGameArrays[i].szLabel = (char *)Bcalloc(MAXARRAYLABEL, sizeof(char));
if (aGameArrays[i].szLabel != pszLabel)
Bstrcpy(aGameArrays[i].szLabel, pszLabel);
if (!(dwFlags & GAMEARRAY_TYPE_MASK))
aGameArrays[i].vals = Bcalloc(asize, sizeof(int32_t));
aGameArrays[i].vals = (int32_t *)Bcalloc(asize, sizeof(int32_t));
else
aGameArrays[i].vals = arrayptr;
@ -181,7 +181,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if ((aGameVars[i].dwFlags & GAMEVAR_SYSTEM) == 0)
{
if (aGameVars[i].szLabel == NULL)
aGameVars[i].szLabel = Bcalloc(MAXVARLABEL, sizeof(uint8_t));
aGameVars[i].szLabel = (char *)Bcalloc(MAXVARLABEL, sizeof(uint8_t));
if (aGameVars[i].szLabel != pszLabel)
Bstrcpy(aGameVars[i].szLabel,pszLabel);
aGameVars[i].dwFlags = dwFlags;
@ -208,7 +208,7 @@ int32_t Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if (aGameVars[i].dwFlags & GAMEVAR_PERBLOCK)
{
if (!aGameVars[i].val.plValues)
aGameVars[i].val.plValues = Bcalloc(1+MAXEVENTS+g_stateCount, sizeof(int32_t));
aGameVars[i].val.plValues = (int32_t *)Bcalloc(1+MAXEVENTS+g_stateCount, sizeof(int32_t));
for (j=0; j<1+MAXEVENTS+g_stateCount; j++)
aGameVars[i].val.plValues[j] = lValue;
}

View file

@ -32,7 +32,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#define NUMOPTIONS 9
//char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
uint8_t default_buildkeys[NUMBUILDKEYS] =
char default_buildkeys[NUMBUILDKEYS] =
{
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x47,0x49,

View file

@ -661,7 +661,7 @@ static void M_DrawBackground(void)
}
static void M_DrawTopBar(char *caption)
static void M_DrawTopBar(const char *caption)
{
rotatesprite_fs(160<<16,19<<16,65536L,0,MENUBAR,16,0,10);
menutext(160,24,0,0,caption);
@ -2669,7 +2669,7 @@ cheat_for_port_credits2:
#ifdef POLYMER
else
{
float ratios[] = { 0.0, 1.33, 1.66, 1.78, 1.85, 2.35 };
double ratios[] = { 0.0, 1.33, 1.66, 1.78, 1.85, 2.35 };
int32_t j = (sizeof(ratios)/sizeof(ratios[0]));

View file

@ -1243,7 +1243,7 @@ int32_t MIDI_PlaySong
}
_MIDI_TrackMemSize = _MIDI_NumTracks * sizeof(track);
_MIDI_TrackPtr = Bmalloc(_MIDI_TrackMemSize);
_MIDI_TrackPtr = (track *)Bmalloc(_MIDI_TrackMemSize);
if (_MIDI_TrackPtr == NULL)
{
return(MIDI_NoMemory);

View file

@ -45,7 +45,7 @@ uint32_t g_netMapRevision = 0;
ENetHost *g_netServer = NULL;
ENetHost *g_netClient = NULL;
ENetPeer *g_netClientPeer = NULL;
int32_t g_netPort = 23513;
enet_uint16 g_netPort = 23513;
int32_t g_netDisconnect = 0;
char g_netPassword[32];
int32_t g_netPlayersWaiting = 0;
@ -71,14 +71,14 @@ static void alloc_multimapstate(int32_t i)
{
if (g_multiMapState[i] == NULL)
{
g_multiMapState[i] = Bcalloc(1, sizeof(netmapstate_t));
g_multiMapState[i] = (netmapstate_t *)Bcalloc(1, sizeof(netmapstate_t));
if (g_multiMapState[i] == NULL)
G_GameExit("OUT OF MEMORY in alloc_multimapstate");
}
if (g_pendingMapState[i] == NULL)
{
g_pendingMapState[i] = Bcalloc(1, sizeof(netmapstate_t));
g_pendingMapState[i] = (netmapstate_t *)Bcalloc(1, sizeof(netmapstate_t));
if (g_pendingMapState[i] == NULL)
G_GameExit("OUT OF MEMORY in alloc_multimapstate");
}

View file

@ -135,7 +135,7 @@ extern ENetPeer *g_netClientPeer;
extern char g_netPassword[32];
extern int32_t g_netDisconnect;
extern int32_t g_netPlayersWaiting;
extern int32_t g_netPort;
extern enet_uint16 g_netPort;
extern int32_t g_networkMode;
extern int32_t lastsectupdate[MAXSECTORS];
extern int32_t lastupdate[MAXSPRITES];

View file

@ -88,8 +88,8 @@ static void G_CacheSpriteNum(int32_t i)
maxc = 1;
if (A_CheckSpriteTileFlags(PN, SPRITE_CACHE) && g_tile[PN].cacherange[1])
for (j = g_tile[PN].cacherange[0]; j <= g_tile[PN].cacherange[1]; j++)
if (g_tile[PN].cacherange >= PN)
for (j = PN; j <= g_tile[PN].cacherange; j++)
tloadtile(j,1);
switch (DYNAMICTILEMAP(PN))
@ -227,8 +227,8 @@ static void G_PrecacheSprites(void)
if (g_tile[i].flags & SPRITE_PROJECTILE)
tloadtile(i,1);
if (A_CheckSpriteTileFlags(i, SPRITE_CACHE) && g_tile[i].cacherange[1])
for (j = g_tile[i].cacherange[0]; j <= g_tile[i].cacherange[1]; j++)
if (A_CheckSpriteTileFlags(i, SPRITE_CACHE))
for (j = i; j <= g_tile[i].cacherange; j++)
tloadtile(j,1);
}
tloadtile(BOTTOMSTATUSBAR,1);
@ -1139,7 +1139,7 @@ static inline void prelevel(char g)
continue;
}
if (sector[i].lotag == -1)
if (sector[i].lotag == UINT16_MAX)
{
g_player[0].ps->exitx = wall[sector[i].wallptr].x;
g_player[0].ps->exity = wall[sector[i].wallptr].y;
@ -1154,7 +1154,7 @@ static inline void prelevel(char g)
A_ResetVars(i);
A_LoadActor(i);
VM_OnEvent(EVENT_LOADACTOR, i, -1, -1, 0);
if (sprite[i].lotag == -1 && (sprite[i].cstat&16))
if (sprite[i].lotag == UINT16_MAX && (sprite[i].cstat&16))
{
g_player[0].ps->exitx = SX;
g_player[0].ps->exity = SY;
@ -1799,7 +1799,7 @@ static void realloc_and_copy_musicfn(int32_t level_number, const char *levnamebu
char **musicfn = altp ? &MapInfo[level_number].alt_musicfn : &MapInfo[level_number].musicfn;
int32_t dastrlen = Bstrlen(levnamebuf);
*musicfn = Brealloc(*musicfn, dastrlen+1);
*musicfn = (char *)Brealloc(*musicfn, dastrlen+1);
Bstrcpy(*musicfn, levnamebuf);
}
@ -1902,7 +1902,7 @@ int32_t G_EnterLevel(int32_t g)
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{
if (MapInfo[mii].filename == NULL)
MapInfo[mii].filename = Bcalloc(BMAX_PATH, sizeof(uint8_t));
MapInfo[mii].filename = (char *)Bcalloc(BMAX_PATH, sizeof(uint8_t));
if (MapInfo[mii].name == NULL)
MapInfo[mii].name = Bstrdup("User Map");
}

View file

@ -110,7 +110,7 @@ int32_t RTS_AddFile(const char *filename)
//
// Fill in lumpinfo
//
lump_p = Brealloc(rts_lumpinfo, (rts_numlumps + header.numlumps)*sizeof(lumpinfo_t));
lump_p = (lumpinfo_t *)Brealloc(rts_lumpinfo, (rts_numlumps + header.numlumps)*sizeof(lumpinfo_t));
if (!lump_p)
{
kclose(handle);
@ -163,7 +163,7 @@ void RTS_Init(const char *filename)
// set up caching
//
length = (rts_numlumps) * sizeof(*rts_lumpcache);
rts_lumpcache = Bmalloc(length);
rts_lumpcache = (void **)Bmalloc(length);
memset(rts_lumpcache,0,length);
RTS_Started = TRUE;
}

View file

@ -41,7 +41,7 @@ uint8_t g_oldverSavegame[10];
void G_Util_PtrToIdx(void *ptr, int32_t count, const void *base, int32_t mode)
{
int32_t i;
intptr_t *iptr = ptr;
intptr_t *iptr = (intptr_t *)ptr;
intptr_t ibase = (intptr_t)base;
int32_t back_p = mode&P2I_BACK_BIT;
int32_t onlynon0_p = mode&P2I_ONLYNON0_BIT;
@ -485,7 +485,7 @@ static uint8_t *writespecdata(const dataspec_t *spec, FILE *fil, uint8_t *dump)
if (sp->flags&DS_STRING)
{
fwrite(sp->ptr, Bstrlen(sp->ptr), 1, fil); // not null-terminated!
fwrite(sp->ptr, Bstrlen((const char *)sp->ptr), 1, fil); // not null-terminated!
continue;
}
@ -537,7 +537,7 @@ static int32_t readspecdata(const dataspec_t *spec, int32_t fil, uint8_t **dumpv
if (sp->flags&(DS_STRING|DS_CMP)) // DS_STRING and DS_CMP is for static data only
{
if (sp->flags&(DS_STRING))
i = Bstrlen(sp->ptr);
i = Bstrlen((const char *)sp->ptr);
else
i = sp->size*sp->cnt;
@ -559,7 +559,7 @@ static int32_t readspecdata(const dataspec_t *spec, int32_t fil, uint8_t **dumpv
if (fil>=0)
{
mem = (dump && (sp->flags&DS_NOCHK)==0) ? dump : ptr;
mem = (dump && (sp->flags&DS_NOCHK)==0) ? dump : (uint8_t *)ptr;
if ((sp->flags&DS_CNTMASK)==0 && sp->size*cnt<=savegame_comprthres)
{
@ -627,7 +627,7 @@ static void docmpsd(const void *ptr, void *dump, uint32_t size, uint32_t cnt, ui
{ \
if (*p!=*op) \
{ \
*op = *p; \
*op = *p; \
VAL(Idxbits, retdiff) = i; \
retdiff += BYTES(Idxbits); \
VAL(Datbits, retdiff) = *p; \
@ -642,15 +642,15 @@ static void docmpsd(const void *ptr, void *dump, uint32_t size, uint32_t cnt, ui
#define CPDATA(Datbits) do \
{ \
const UINT(Datbits) *p=ptr; \
UINT(Datbits) *op=dump; \
uint32_t i, nelts=(size*cnt)/BYTES(Datbits); \
if (nelts>65536) \
CPELTS(32,Datbits); \
else if (nelts>256) \
CPELTS(16,Datbits); \
else \
CPELTS(8,Datbits); \
const UINT(Datbits) *p=(UINT(Datbits) *)ptr; \
UINT(Datbits) *op=(UINT(Datbits) *)dump; \
uint32_t i, nelts=(size*cnt)/BYTES(Datbits); \
if (nelts>65536) \
CPELTS(32,Datbits); \
else if (nelts>256) \
CPELTS(16,Datbits); \
else \
CPELTS(8,Datbits); \
} while (0)
if (size==8)
@ -685,7 +685,7 @@ static void cmpspecdata(const dataspec_t *spec, uint8_t **dumpvar, uint8_t **dif
void *ptr;
uint8_t *dump=*dumpvar, *diff=*diffvar, *tmptr;
const dataspec_t *sp=spec;
int32_t cnt, eltnum=0, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen(spec->ptr);
int32_t cnt, eltnum=0, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen((const char *)spec->ptr);
Bmemcpy(diff, spec->ptr, l);
diff+=l;
@ -728,7 +728,7 @@ static int32_t applydiff(const dataspec_t *spec, uint8_t **dumpvar, uint8_t **di
{
uint8_t *dumptr=*dumpvar, *diffptr=*diffvar;
const dataspec_t *sp=spec;
int32_t cnt, eltnum=-1, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen(spec->ptr);
int32_t cnt, eltnum=-1, nbytes=(getnumvar(spec)+7)>>3, l=Bstrlen((const char *)spec->ptr);
if (Bmemcmp(diffptr, spec->ptr, l)) // check STRING magic (sync check)
return 1;
@ -882,7 +882,7 @@ static uint8_t savegame_restdata[SVARDATALEN];
static const dataspec_t svgm_udnetw[] =
{
{ DS_STRING, "blK:udnt", 0, 1 },
{ DS_STRING, (void *)"blK:udnt", 0, 1 },
{ 0, &ud.multimode, sizeof(ud.multimode), 1 },
{ 0, &g_numPlayerSprites, sizeof(g_numPlayerSprites), 1 },
{ 0, &g_playerSpawnPoints, sizeof(g_playerSpawnPoints), 1 },
@ -925,7 +925,7 @@ static const dataspec_t svgm_udnetw[] =
static const dataspec_t svgm_secwsp[] =
{
{ DS_STRING, "blK:swsp", 0, 1 },
{ DS_STRING, (void *)"blK:swsp", 0, 1 },
{ DS_NOCHK, &numwalls, sizeof(numwalls), 1 },
{ DS_MAINAR|DS_CNT(numwalls), &wall, sizeof(walltype), (intptr_t)&numwalls },
{ DS_NOCHK, &numsectors, sizeof(numsectors), 1 },
@ -969,7 +969,7 @@ static const dataspec_t svgm_secwsp[] =
static const dataspec_t svgm_script[] =
{
{ DS_STRING, "blK:scri", 0, 1 },
{ DS_STRING, (void *)"blK:scri", 0, 1 },
{ DS_NOCHK, &g_scriptSize, sizeof(g_scriptSize), 1 },
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)&sv_calcbitptrsize, 0, 1 },
{ DS_DYNAMIC|DS_CNT(savegame_bitptrsize)|DS_NOCHK, &bitptr, sizeof(bitptr[0]), (intptr_t)&savegame_bitptrsize },
@ -990,7 +990,7 @@ static const dataspec_t svgm_script[] =
static const dataspec_t svgm_anmisc[] =
{
{ DS_STRING, "blK:anms", 0, 1 },
{ DS_STRING, (void *)"blK:anms", 0, 1 },
{ 0, &g_animateCount, sizeof(g_animateCount), 1 },
{ 0, &animatesect[0], sizeof(animatesect[0]), MAXANIMATES },
{ 0, &animategoal[0], sizeof(animategoal[0]), MAXANIMATES },
@ -1031,7 +1031,7 @@ static const dataspec_t svgm_anmisc[] =
{ 0, savegame_restdata, 1, sizeof(savegame_restdata) }, // sz/cnt swapped for kdfread
{ DS_LOADFN, (void *)&sv_restload, 0, 1 },
{ DS_STRING, "savegame_end", 0, 1 },
{ DS_STRING, (void *)"savegame_end", 0, 1 },
{ DS_END, 0, 0, 0 }
};
@ -1062,7 +1062,7 @@ static void sv_makevarspec()
for (i=0; i<g_gameVarCount; i++)
numsavedvars += (aGameVars[i].dwFlags&SV_SKIPMASK) ? 0 : 1;
svgm_vars = Bmalloc((numsavedvars+g_gameArrayCount+2)*sizeof(dataspec_t));
svgm_vars = (dataspec_t *)Bmalloc((numsavedvars+g_gameArrayCount+2)*sizeof(dataspec_t));
svgm_vars[0].flags = DS_STRING;
svgm_vars[0].ptr = magic;
@ -1111,11 +1111,11 @@ static int32_t doallocsnap(int32_t allocinit)
{
sv_freemem();
svsnapshot = Bmalloc(svsnapsiz);
svsnapshot = (uint8_t *)Bmalloc(svsnapsiz);
if (allocinit)
svinitsnap = Bmalloc(svsnapsiz);
svinitsnap = (uint8_t *)Bmalloc(svsnapsiz);
svdiffsiz = svsnapsiz; // theoretically it's less than could be needed in the worst case, but practically it's overkill
svdiff = Bmalloc(svdiffsiz);
svdiff = (uint8_t *)Bmalloc(svdiffsiz);
if (svsnapshot==NULL || (allocinit && svinitsnap==NULL) || svdiff==NULL)
{
sv_freemem();
@ -1499,7 +1499,7 @@ static void sv_prescriptload_once()
{
if (script)
Bfree(script);
script = Bmalloc(g_scriptSize * sizeof(script[0]));
script = (intptr_t *)Bmalloc(g_scriptSize * sizeof(script[0]));
}
static void sv_postscript_once()
{
@ -1551,7 +1551,7 @@ static void sv_postanimateptr()
static void sv_prequote()
{
if (!savegame_quotes)
savegame_quotes = Bcalloc(MAXQUOTES, MAXQUOTELEN);
savegame_quotes = (char (*)[MAXQUOTELEN])Bcalloc(MAXQUOTES, MAXQUOTELEN);
}
static void sv_quotesave()
{
@ -1572,7 +1572,7 @@ static void sv_quoteload()
if (savegame_quotedef[i>>3]&(1<<(i&7)))
{
if (!ScriptQuotes[i])
ScriptQuotes[i] = Bcalloc(1, MAXQUOTELEN);
ScriptQuotes[i] = (char *)Bcalloc(1, MAXQUOTELEN);
Bmemcpy(ScriptQuotes[i], savegame_quotes[i], MAXQUOTELEN);
}
}
@ -1580,7 +1580,7 @@ static void sv_quoteload()
static void sv_prequoteredef()
{
// "+1" needed for dfwrite which doesn't handle the src==NULL && cnt==0 case
savegame_quoteredefs = Bcalloc(g_numQuoteRedefinitions+1, MAXQUOTELEN);
savegame_quoteredefs = (char (*)[MAXQUOTELEN])Bcalloc(g_numQuoteRedefinitions+1, MAXQUOTELEN);
}
static void sv_quoteredefsave()
{
@ -1595,7 +1595,7 @@ static void sv_quoteredefload()
for (i=0; i<g_numQuoteRedefinitions; i++)
{
if (!ScriptQuoteRedefinitions[i])
ScriptQuoteRedefinitions[i] = Bcalloc(1,MAXQUOTELEN);
ScriptQuoteRedefinitions[i] = (char *)Bcalloc(1,MAXQUOTELEN);
Bmemcpy(ScriptQuoteRedefinitions[i], savegame_quoteredefs[i], MAXQUOTELEN);
}
}

View file

@ -3031,7 +3031,7 @@ void P_CheckSectors(int32_t snum)
P_DoQuote(QUOTE_FOUND_SECRET,p);
p->secret_rooms++;
return;
case -1:
case UINT16_MAX:
for (TRAVERSE_CONNECT(i))
g_player[i].ps->gm = MODE_EOL;
sector[p->cursectnum].lotag = 0;
@ -3049,7 +3049,7 @@ void P_CheckSectors(int32_t snum)
ud.m_level_number = ud.level_number;
}
return;
case -2:
case UINT16_MAX-1:
sector[p->cursectnum].lotag = 0;
p->timebeforeexit = GAMETICSPERSEC*8;
p->customexitsound = sector[p->cursectnum].hitag;

View file

@ -354,9 +354,9 @@ static void PopulateForm(unsigned char pgs)
gtk_list_store_set(modes3d, &iter, 0,buf, 1,i, -1);
if (i == mode3d)
{
g_signal_handlers_block_by_func(stwidgets.vmode3dcombo, on_vmode3dcombo_changed, NULL);
g_signal_handlers_block_by_func(stwidgets.vmode3dcombo, (gpointer)on_vmode3dcombo_changed, NULL);
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(stwidgets.vmode3dcombo), &iter);
g_signal_handlers_unblock_by_func(stwidgets.vmode3dcombo, on_vmode3dcombo_changed, NULL);
g_signal_handlers_unblock_by_func(stwidgets.vmode3dcombo, (gpointer)on_vmode3dcombo_changed, NULL);
}
}
}
@ -461,9 +461,9 @@ static void PopulateForm(unsigned char pgs)
if (!Bstrcasecmp(fg->name, settings.selectedgrp))
{
GtkTreeSelection *sel = gtk_tree_view_get_selection(gamelist);
g_signal_handlers_block_by_func(sel, on_gamelist_selection_changed, NULL);
g_signal_handlers_block_by_func(sel, (gpointer)on_gamelist_selection_changed, NULL);
gtk_tree_selection_select_iter(sel, &iter);
g_signal_handlers_unblock_by_func(sel, on_gamelist_selection_changed, NULL);
g_signal_handlers_unblock_by_func(sel, (gpointer)on_gamelist_selection_changed, NULL);
}
}
}
@ -524,9 +524,9 @@ static GtkWidget *create_window(void)
stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0);
#ifdef POLYMER
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 0);
#else
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 7);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 7);
#endif
// 3D video mode combo
@ -543,17 +543,18 @@ static GtkWidget *create_window(void)
}
#ifdef POLYMER
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0);
#else
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 7);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, (GtkAttachOptions)0, 4, 7);
#endif
// Fullscreen checkbox
stwidgets.displayvlayout = gtk_vbox_new(TRUE, 0);
#ifdef POLYMER
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, 0, 4, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 0);
#else
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, 0, 4, 7);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, (GtkAttachOptions)0, 4, 7);
#endif
stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
@ -568,7 +569,7 @@ static GtkWidget *create_window(void)
// Input devices LabelText
stwidgets.inputdevlabel = gtk_label_new_with_mnemonic("_Input devices:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.inputdevlabel), 0.3, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevlabel, 0,1, 1,2, GTK_FILL, 0, 4, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevlabel, 0,1, 1,2, GTK_FILL, (GtkAttachOptions)0, 4, 0);
// Input devices combo
{
@ -582,12 +583,13 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, "text", 0, NULL);
}
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevcombo, 1,2, 1,2,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 0);
// Custom mod LabelText
stwidgets.custommodlabel = gtk_label_new_with_mnemonic("Custom _game:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.custommodlabel), 0.3, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodlabel, 0,1, 2,3, GTK_FILL, 0, 4, 7);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodlabel, 0,1, 2,3, GTK_FILL, (GtkAttachOptions)0, 4, 7);
// Custom mod combo
{
@ -601,19 +603,21 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, "text", 0, NULL);
}
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodcombo, 1,2, 2,3, GTK_EXPAND | GTK_FILL, 0, 4, 7);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodcombo, 1,2, 2,3,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)0, 4, 7);
// Empty horizontal layout
stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,3, 3,4, 0, GTK_EXPAND | GTK_FILL, 4, 0);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,3, 3,4, (GtkAttachOptions)0,
(GtkAttachOptions)(GTK_EXPAND | GTK_FILL), 4, 0);
// Autoload checkbox
stwidgets.autoloadcheck = gtk_check_button_new_with_mnemonic("_Enable \"autoload\" folder");
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.autoloadcheck, 0,3, 4,5, GTK_FILL, 0, 2, 2);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.autoloadcheck, 0,3, 4,5, GTK_FILL, (GtkAttachOptions)0, 2, 2);
// Always show config checkbox
stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show this window at startup");
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,3, 5,6, GTK_FILL, 0, 2, 2);
gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,3, 5,6, GTK_FILL, (GtkAttachOptions)0, 2, 2);
// Configuration tab
stwidgets.configtab = gtk_label_new("Configuration");

View file

@ -135,7 +135,7 @@
typedef signed int ssize_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned __int32 uint32_t;
typedef ULONGLONG uint64_t;
#else
/* mingw32, lcc and watcom provide a proper header */