Use C versions of divscale##() instead of asm to work around an overflow with drawmapview(), get rid of leftover custom 'int64' type in favor of int64_t, other minor fixes

git-svn-id: https://svn.eduke32.com/eduke32@1492 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2009-09-09 07:19:14 +00:00
parent 4e4e2f16d8
commit fe6e27e819
15 changed files with 116 additions and 62 deletions

View file

@ -89,13 +89,9 @@
#if defined(_MSC_VER) #if defined(_MSC_VER)
# define inline __inline # define inline __inline
# define int64 __int64
# define uint64 unsigned __int64
# define longlong(x) x##i64 # define longlong(x) x##i64
#else #else
# define longlong(x) x##ll # define longlong(x) x##ll
typedef long long int int64;
typedef unsigned long long uint64;
#endif #endif
#ifndef NULL #ifndef NULL
@ -198,7 +194,7 @@ extern "C" {
#elif defined B_ENDIAN_C_INLINE #elif defined B_ENDIAN_C_INLINE
static inline uint16_t B_SWAP16(uint16_t s) { return (s>>8)|(s<<8); } static inline uint16_t B_SWAP16(uint16_t s) { return (s>>8)|(s<<8); }
static inline uint32_t B_SWAP32(uint32_t l) { return ((l>>8)&0xff00)|((l&0xff00)<<8)|(l<<24)|(l>>24); } static inline uint32_t B_SWAP32(uint32_t l) { return ((l>>8)&0xff00)|((l&0xff00)<<8)|(l<<24)|(l>>24); }
static inline uint64 B_SWAP64(uint64 l) { return (l>>56)|((l>>40)&0xff00)|((l>>24)&0xff0000)|((l>>8)&0xff000000)|((l&255)<<56)|((l&0xff00)<<40)|((l&0xff0000)<<24)|((l&0xff000000)<<8); } static inline uint64_t B_SWAP64(uint64_t l) { return (l>>56)|((l>>40)&0xff00)|((l>>24)&0xff0000)|((l>>8)&0xff000000)|((l&255)<<56)|((l&0xff00)<<40)|((l&0xff0000)<<24)|((l&0xff000000)<<8); }
#endif #endif
#if defined(USE_MSC_PRAGMAS) #if defined(USE_MSC_PRAGMAS)

View file

@ -289,7 +289,7 @@ typedef struct s_pranimatespritesinfo {
} _pranimatespritesinfo; } _pranimatespritesinfo;
// MEMORY POOL // MEMORY POOL
#define POLYMER_POOL_SIZE 33554432 #define POLYMER_POOL_SIZE 67108864
extern nedpool* polymer_pool; extern nedpool* polymer_pool;
// EXTERNAL FUNCTIONS // EXTERNAL FUNCTIONS

View file

@ -9,8 +9,39 @@
extern "C" { extern "C" {
#endif #endif
#include <limits.h>
extern int32_t dmval; extern int32_t dmval;
// break the C version of divscale out from the others
// because asm version overflows in drawmapview()
#define qw(x) ((int64_t)(x)) // quadword cast
#define dw(x) ((int32_t)(x)) // doubleword cast
#define by(x) ((uint8_t)(x)) // byte cast
#define _scaler(a) \
static inline int32_t divscale##a(int32_t eax, int32_t ebx) \
{ \
return dw((qw(eax) << a) / qw(ebx)); \
} \
_scaler(1) _scaler(2) _scaler(3) _scaler(4)
_scaler(5) _scaler(6) _scaler(7) _scaler(8)
_scaler(9) _scaler(10) _scaler(11) _scaler(12)
_scaler(13) _scaler(14) _scaler(15) _scaler(16)
_scaler(17) _scaler(18) _scaler(19) _scaler(20)
_scaler(21) _scaler(22) _scaler(23) _scaler(24)
_scaler(25) _scaler(26) _scaler(27) _scaler(28)
_scaler(29) _scaler(30) _scaler(31) _scaler(32)
static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw((qw(eax) << by(ecx)) / qw(ebx)); }
#undef qw
#undef dw
#undef by
#undef _scaler
#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) #if defined(__GNUC__) && defined(__i386__) && !defined(NOASM)
// //
@ -740,6 +771,7 @@ void copybufreverse(void *S, void *D, int32_t c);
: "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \ : "a" (__a), "d" (__d), "b" (__b), "c" (__c), "S" (__S), "D" (__D) : "cc"); \
__d; }) __d; })
#if 0
#define divscale(a,b,c) \ #define divscale(a,b,c) \
({ int32_t __a=(a), __b=(b), __c=(c); \ ({ int32_t __a=(a), __b=(b), __c=(c); \
__asm__ __volatile__ ("movl %%eax, %%edx; shll %%cl, %%eax; negb %%cl; sarl %%cl, %%edx; idivl %%ebx" \ __asm__ __volatile__ ("movl %%eax, %%edx; shll %%cl, %%eax; negb %%cl; sarl %%cl, %%edx; idivl %%ebx" \
@ -905,7 +937,7 @@ void copybufreverse(void *S, void *D, int32_t c);
__asm__ __volatile__ ("xorl %%eax, %%eax; idivl %%ebx" \ __asm__ __volatile__ ("xorl %%eax, %%eax; idivl %%ebx" \
: "=a" (__r), "=d" (__d) : "d" (__d), "b" (__b) : "cc"); \ : "=a" (__r), "=d" (__d) : "d" (__d), "b" (__b) : "cc"); \
__r; }) __r; })
#endif
#define readpixel(D) \ #define readpixel(D) \
({ void *__D=(D); int32_t __a; \ ({ void *__D=(D); int32_t __a; \
__asm__ __volatile__ ("movb (%%edi), %%al" \ __asm__ __volatile__ ("movb (%%edi), %%al" \
@ -1252,7 +1284,7 @@ static __inline int32_t boundmulscale(int32_t a, int32_t b, int32_t c)
skipboundit: skipboundit:
} }
} }
#if 0
static __inline int32_t divscale(int32_t a, int32_t b, int32_t c) static __inline int32_t divscale(int32_t a, int32_t b, int32_t c)
{ {
_asm { _asm {
@ -1324,7 +1356,7 @@ static __inline int32_t divscale32(int32_t d, int32_t b)
idiv b idiv b
} }
} }
#endif
static __inline char readpixel(void *d) static __inline char readpixel(void *d)
{ {
_asm { _asm {
@ -1780,7 +1812,7 @@ static __inline void swapchar2(void *a, void *b, int32_t s)
// Generic C // Generic C
// //
#define qw(x) ((int64)(x)) // quadword cast #define qw(x) ((int64_t)(x)) // quadword cast
#define dw(x) ((int32_t)(x)) // doubleword cast #define dw(x) ((int32_t)(x)) // doubleword cast
#define wo(x) ((int16_t)(x)) // word cast #define wo(x) ((int16_t)(x)) // word cast
#define by(x) ((uint8_t)(x)) // byte cast #define by(x) ((uint8_t)(x)) // byte cast
@ -1791,11 +1823,6 @@ static inline int32_t mulscale##a(int32_t eax, int32_t edx) \
return dw((qw(eax) * qw(edx)) >> a); \ return dw((qw(eax) * qw(edx)) >> a); \
} \ } \
\ \
static inline int32_t divscale##a(int32_t eax, int32_t ebx) \
{ \
return dw((qw(eax) << a) / qw(ebx)); \
} \
\
static inline int32_t dmulscale##a(int32_t eax, int32_t edx, int32_t esi, int32_t edi) \ static inline int32_t dmulscale##a(int32_t eax, int32_t edx, int32_t esi, int32_t edi) \
{ \ { \
return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> a); \ return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> a); \
@ -1819,7 +1846,7 @@ static inline void swapchar(void* a, void* b) { char t = *((char*)b); *((char*)
static inline void swapchar2(void* a, void* b, int32_t s) { swapchar(a,b); swapchar((char*)a+1,(char*)b+s); } static inline void swapchar2(void* a, void* b, int32_t s) { swapchar(a,b); swapchar((char*)a+1,(char*)b+s); }
static inline void swapshort(void* a, void* b) { int16_t t = *((int16_t*)b); *((int16_t*)b) = *((int16_t*)a); *((int16_t*)a) = t; } static inline void swapshort(void* a, void* b) { int16_t t = *((int16_t*)b); *((int16_t*)b) = *((int16_t*)a); *((int16_t*)a) = t; }
static inline void swaplong(void* a, void* b) { int32_t t = *((int32_t*)b); *((int32_t*)b) = *((int32_t*)a); *((int32_t*)a) = t; } static inline void swaplong(void* a, void* b) { int32_t t = *((int32_t*)b); *((int32_t*)b) = *((int32_t*)a); *((int32_t*)a) = t; }
static inline void swap64bit(void* a, void* b) { int64 t = *((int64*)b); *((int64*)b) = *((int64*)a); *((int64*)a) = t; } static inline void swap64bit(void* a, void* b) { int64_t t = *((int64_t*)b); *((int64_t*)b) = *((int64_t*)a); *((int64_t*)a) = t; }
static inline char readpixel(void* s) { return (*((char*)(s))); } static inline char readpixel(void* s) { return (*((char*)(s))); }
static inline void drawpixel(void* s, char a) { *((char*)(s)) = a; } static inline void drawpixel(void* s, char a) { *((char*)(s)) = a; }
@ -1844,15 +1871,14 @@ static inline int32_t kmax(int32_t a, int32_t b) { if ((int32_t)a < (int32_t)b)
static inline int32_t sqr(int32_t eax) { return (eax) * (eax); } static inline int32_t sqr(int32_t eax) { return (eax) * (eax); }
static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * qw(edx)) / qw(ecx)); } static inline int32_t scale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * qw(edx)) / qw(ecx)); }
static inline int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * qw(edx)) >> by(ecx)); } static inline int32_t mulscale(int32_t eax, int32_t edx, int32_t ecx) { return dw((qw(eax) * qw(edx)) >> by(ecx)); }
static inline int32_t divscale(int32_t eax, int32_t ebx, int32_t ecx) { return dw((qw(eax) << by(ecx)) / qw(ebx)); }
static inline int32_t dmulscale(int32_t eax, int32_t edx, int32_t esi, int32_t edi, int32_t ecx) { return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> by(ecx)); } static inline int32_t dmulscale(int32_t eax, int32_t edx, int32_t esi, int32_t edi, int32_t ecx) { return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> by(ecx)); }
static inline int32_t boundmulscale(int32_t a, int32_t d, int32_t c) static inline int32_t boundmulscale(int32_t a, int32_t d, int32_t c)
{ // courtesy of Ken { // courtesy of Ken
int64 p; int64_t p;
p = (((int64)a)*((int64)d))>>c; p = (((int64_t)a)*((int64_t)d))>>c;
if (p >= longlong(2147483647)) p = longlong(2147483647); if (p >= INT_MAX) p = INT_MAX;
if (p < longlong(-2147483648)) p = longlong(-2147483648); if (p < INT_MIN) p = INT_MIN;
return((int32_t)p); return((int32_t)p);
} }

View file

@ -1391,7 +1391,7 @@ void overheadeditor(void)
if (graphicsmode == 2) if (graphicsmode == 2)
totalclocklock = totalclock; totalclocklock = totalclock;
drawmapview(pos.x, pos.y + scale((57344/zoom), ydim, 200), zoom, 1536); drawmapview(pos.x, pos.y + scale((65536/zoom), ydim, 200), zoom, 1536);
yxaspect = i; yxaspect = i;
xyaspect = ii; xyaspect = ii;
} }
@ -6402,7 +6402,7 @@ void printmessage256(int32_t x, int32_t y, char *name)
void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny) void getclosestpointonwall(int32_t x, int32_t y, int32_t dawall, int32_t *nx, int32_t *ny)
{ {
walltype *wal; walltype *wal;
int64 i, j, dx, dy; int64_t i, j, dx, dy;
wal = &wall[dawall]; wal = &wall[dawall];
dx = wall[wal->point2].x-wal->x; dx = wall[wal->point2].x-wal->x;

View file

@ -793,7 +793,7 @@ uint32_t Bgetsysmemsize(void)
#endif #endif
scphyspages = sysconf(_SC_PHYS_PAGES); scphyspages = sysconf(_SC_PHYS_PAGES);
if (scpagesiz >= 0 && scphyspages >= 0) if (scpagesiz >= 0 && scphyspages >= 0)
siz = (uint32_t)min(longlong(0x7fffffff), (int64)scpagesiz * (int64)scphyspages); siz = (uint32_t)min(longlong(0x7fffffff), (int64_t)scpagesiz * (int64_t)scphyspages);
//initprintf("Bgetsysmemsize(): %d pages of %d bytes, %d bytes of system memory\n", //initprintf("Bgetsysmemsize(): %d pages of %d bytes, %d bytes of system memory\n",
// scphyspages, scpagesiz, siz); // scphyspages, scpagesiz, siz);

View file

@ -6346,8 +6346,9 @@ void drawmapview(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
cx1 = (windowx1<<12); cy1 = (windowy1<<12); cx1 = (windowx1<<12); cy1 = (windowy1<<12);
cx2 = ((windowx2+1)<<12)-1; cy2 = ((windowy2+1)<<12)-1; cx2 = ((windowx2+1)<<12)-1; cy2 = ((windowy2+1)<<12)-1;
if (zoome == 2048) zoome = 2047; // FIXME
zoome <<= 8; zoome <<= 8;
bakgxvect = divscale28(sintable[(1536-ang)&2047],zoome); bakgxvect = divscale28(sintable[(1536-ang)&2047],zoome);
bakgyvect = divscale28(sintable[(2048-ang)&2047],zoome); bakgyvect = divscale28(sintable[(2048-ang)&2047],zoome);
xvect = mulscale8(sintable[(2048-ang)&2047],zoome); xvect = mulscale8(sintable[(2048-ang)&2047],zoome);
@ -10884,7 +10885,7 @@ void clear2dscreen(void)
// //
void draw2dgrid(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16_t gride) void draw2dgrid(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int16_t gride)
{ {
int64 i, xp1, yp1, xp2=0, yp2, tempy; int64_t i, xp1, yp1, xp2=0, yp2, tempy;
UNREFERENCED_PARAMETER(ange); UNREFERENCED_PARAMETER(ange);
@ -10972,7 +10973,7 @@ void draw2dscreen(int32_t posxe, int32_t posye, int16_t ange, int32_t zoome, int
faketimerhandler(); faketimerhandler();
for (i=numwalls-1,wal=&wall[i]; i>=0; i--,wal--) for (i=numwalls-1,wal=&wall[i]; i>=0; i--,wal--)
{ {
int64 dist,dx,dy; int64_t dist,dx,dy;
if (editstatus == 0) if (editstatus == 0)
{ {
if ((show2dwall[i>>3]&pow2char[i&7]) == 0) continue; if ((show2dwall[i>>3]&pow2char[i&7]) == 0) continue;

View file

@ -1951,7 +1951,7 @@ static const char * GetDInputError(HRESULT code)
// TIMER // TIMER
//================================================================================================= //=================================================================================================
static int64 timerfreq=0; static int64_t timerfreq=0;
static int32_t timerlastsample=0; static int32_t timerlastsample=0;
int32_t timerticspersec=0; int32_t timerticspersec=0;
static void (*usertimercallback)(void) = NULL; static void (*usertimercallback)(void) = NULL;
@ -1977,7 +1977,7 @@ void (*installusertimercallback(void (*callback)(void)))(void)
// //
int32_t inittimer(int32_t tickspersecond) int32_t inittimer(int32_t tickspersecond)
{ {
int64 t; int64_t t;
if (timerfreq) return 0; // already installed if (timerfreq) return 0; // already installed
@ -2017,7 +2017,7 @@ void uninittimer(void)
// //
inline void sampletimer(void) inline void sampletimer(void)
{ {
int64 i; int64_t i;
int32_t n; int32_t n;
if (!timerfreq) return; if (!timerfreq) return;
@ -2039,7 +2039,7 @@ inline void sampletimer(void)
// //
uint32_t getticks(void) uint32_t getticks(void)
{ {
int64 i; int64_t i;
if (timerfreq == 0) return 0; if (timerfreq == 0) return 0;
QueryPerformanceCounter((LARGE_INTEGER*)&i); QueryPerformanceCounter((LARGE_INTEGER*)&i);
return (uint32_t)(i*longlong(1000)/timerfreq); return (uint32_t)(i*longlong(1000)/timerfreq);

View file

@ -3832,9 +3832,9 @@ static inline void getnumber_doint32(int32_t *ptr, int32_t num)
*ptr = (int32_t) num; *ptr = (int32_t) num;
} }
static inline void getnumber_doint64(int64 *ptr, int32_t num) static inline void getnumber_doint64(int64_t *ptr, int32_t num)
{ {
*ptr = (int64) num; *ptr = (int64_t) num;
} }
void getnumberptr256(char *namestart, void *num, int32_t bytes, int32_t maxnumber, char sign, void *(func)(int32_t)) void getnumberptr256(char *namestart, void *num, int32_t bytes, int32_t maxnumber, char sign, void *(func)(int32_t))
@ -3854,7 +3854,7 @@ void getnumberptr256(char *namestart, void *num, int32_t bytes, int32_t maxnumbe
danum = *(int32_t *)num; danum = *(int32_t *)num;
break; break;
case 8: case 8:
danum = *(int64 *)num; danum = *(int64_t *)num;
break; break;
} }
@ -3987,10 +3987,10 @@ static void DoSpriteOrnament(int32_t i)
} }
} }
int64 ldistsqr(spritetype *s1,spritetype *s2) int64_t ldistsqr(spritetype *s1,spritetype *s2)
{ {
return (((int64)(s2->x - s1->x))*((int64)(s2->x - s1->x)) + return (((int64_t)(s2->x - s1->x))*((int64_t)(s2->x - s1->x)) +
((int64)(s2->y - s1->y))*((int64)(s2->y - s1->y))); ((int64_t)(s2->y - s1->y))*((int64_t)(s2->y - s1->y)));
} }
void rendertext(int16_t startspr) void rendertext(int16_t startspr)
@ -4574,7 +4574,7 @@ static void Keys3d(void)
keystatus[KEYSC_F5] = 0; keystatus[KEYSC_F5] = 0;
} }
if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_BS]) // ' del if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_DELETE]) // ' del
{ {
keystatus[KEYSC_BS] = 0; keystatus[KEYSC_BS] = 0;
switch (searchstat) switch (searchstat)
@ -10252,11 +10252,11 @@ void ExtAnalyzeSprites(void)
case TANK : case TANK :
case RECON : case RECON :
if (frames==0) frames = 10; if (frames==0) frames = 10;
case ROTATEGUN :
case CAMERA1: case CAMERA1:
case APLAYER : case APLAYER :
if (frames==0) frames=1; if (frames==0) frames=1;
case GREENSLIME : case GREENSLIME :
case EGG :
case PIGCOPSTAYPUT : case PIGCOPSTAYPUT :
case LIZMANSTAYPUT: case LIZMANSTAYPUT:
case LIZTROOPSTAYPUT : case LIZTROOPSTAYPUT :

View file

@ -27,6 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "osd.h" #include "osd.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#endif
int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files int32_t g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
@ -60,7 +66,7 @@ intptr_t *aplWeaponSpawnTime[MAX_WEAPONS]; // the frame at which to spawn a
intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn intptr_t *aplWeaponSpawn[MAX_WEAPONS]; // the item to spawn
intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst' intptr_t *aplWeaponShotsPerBurst[MAX_WEAPONS]; // number of shots per 'burst' (one ammo per 'burst'
intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like intptr_t *aplWeaponWorksLike[MAX_WEAPONS]; // What original the weapon works like
intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when initialy firing. zero for no sound intptr_t *aplWeaponInitialSound[MAX_WEAPONS]; // Sound made when weapon starts firing. zero for no sound
intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic) intptr_t *aplWeaponFireSound[MAX_WEAPONS]; // Sound made when firing (each time for automatic)
intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time intptr_t *aplWeaponSound2Time[MAX_WEAPONS]; // Alternate sound time
intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID intptr_t *aplWeaponSound2Sound[MAX_WEAPONS]; // Alternate sound sound ID
@ -3616,7 +3622,6 @@ static int32_t C_ParseCommand(void)
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: error: variable `%s' is not per-actor.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); initprintf("%s:%d: error: variable `%s' is not per-actor.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
return 0; return 0;
} }
break; break;
} }
@ -3628,7 +3633,6 @@ static int32_t C_ParseCommand(void)
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: error: variable `%s' is not per-player.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); initprintf("%s:%d: error: variable `%s' is not per-player.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
return 0; return 0;
} }
break; break;
} }
@ -6009,19 +6013,44 @@ void C_Compile(const char *filenam)
{ {
extern int32_t numgroupfiles; extern int32_t numgroupfiles;
if (g_loadFromGroupOnly == 1) if (g_loadFromGroupOnly == 1 || numgroupfiles == 0)
{ {
Bsprintf(tempbuf,"'%s' missing CON files, reinstall Duke Nukem 3D.",duke3dgrp); #ifdef WIN32
} Bsprintf(tempbuf,"Duke Nukem 3D game data was not found. A valid copy of '%s' or other compatible data is needed to run EDuke32.\n\n"
else if (numgroupfiles == 0) "You can find '%s' in the \"DN3DINST\" or \"ATOMINST\" directory on your Duke Nukem 3D installation CD.\n\n"
{ "If you don't already own a copy of Duke, you can get Duke Nukem 3D: Atomic Edition for only $5.99 through our partnership with GOG.com.\n\nGet Duke now?",
Bsprintf(tempbuf,"Duke Nukem 3D game data was not found. A copy of '%s' or other compatible data is needed to run EDuke32.\n" duke3dgrp,duke3dgrp);
if (wm_ynbox("EDuke32",tempbuf))
{
SHELLEXECUTEINFOA sinfo;
char *p = "http://www.gog.com/en/gamecard/duke_nukem_3d_atomic_edition/pp/6c1e671f9af5b46d9c1a52067bdf0e53685674f7";
Bmemset(&sinfo, 0, sizeof(sinfo));
sinfo.cbSize = sizeof(sinfo);
sinfo.fMask = SEE_MASK_CLASSNAME;
sinfo.lpVerb = "open";
sinfo.lpFile = p;
sinfo.nShow = SW_SHOWNORMAL;
sinfo.lpClass = "http";
if (!ShellExecuteExA(&sinfo))
initprintf("gog: error launching browser!\n");
}
G_GameExit("");
#else
Bsprintf(tempbuf,"Duke Nukem 3D game data was not found. A valid copy of '%s' or other compatible data is needed to run EDuke32.\n"
"You can find '%s' in the \"DN3DINST\" or \"ATOMINST\" directory on your Duke Nukem 3D installation CD-ROM.\n\n" "You can find '%s' in the \"DN3DINST\" or \"ATOMINST\" directory on your Duke Nukem 3D installation CD-ROM.\n\n"
"EDuke32 will now close.", "EDuke32 will now close.",
duke3dgrp,duke3dgrp); duke3dgrp,duke3dgrp);
G_GameExit(tempbuf);
#endif
}
else
{
Bsprintf(tempbuf,"CON file `%s' missing.", filenam);
G_GameExit(tempbuf);
} }
else Bsprintf(tempbuf,"CON file `%s' missing.", filenam);
G_GameExit(tempbuf);
//g_loadFromGroupOnly = 1; //g_loadFromGroupOnly = 1;
return; //Not there return; //Not there
@ -6211,11 +6240,13 @@ void C_Compile(const char *filenam)
"^02%s^02 mutilated %s", "^02%s^02 mutilated %s",
"^02%s^02 murdered %s", "^02%s^02 murdered %s",
"^02%s^02 neutered %s", "^02%s^02 neutered %s",
"^02%s^02 punted %s",
"^02%s^02 reamed %s", "^02%s^02 reamed %s",
"^02%s^02 ripped %s^02 a new orifice", "^02%s^02 ripped %s^02 a new orifice",
"^02%s^02 rocked %s", "^02%s^02 rocked %s",
"^02%s^02 sent %s^02 to hell", "^02%s^02 sent %s^02 to hell",
"^02%s^02 shredded %s", "^02%s^02 shredded %s",
"^02%s^02 slashed %s",
"^02%s^02 slaughtered %s", "^02%s^02 slaughtered %s",
"^02%s^02 sliced %s", "^02%s^02 sliced %s",
"^02%s^02 smacked %s around", "^02%s^02 smacked %s around",

View file

@ -2377,7 +2377,7 @@ nullquote:
{ {
OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q); OSD_Printf(CON_ERROR "null quote %d\n",g_errorLineNum,keyw[g_tw],q);
if (tw == CON_GAMETEXTZ) if (tw == CON_GAMETEXTZ)
insptr++; Gv_GetVarX(*insptr++);
continue; continue;
} }
if (tw == CON_GAMETEXTZ) if (tw == CON_GAMETEXTZ)

View file

@ -108,10 +108,10 @@ extern "C" {
#define NORMALAXISSCALE (65536) #define NORMALAXISSCALE (65536)
#define BUTTONSET(x,value) (CONTROL_ButtonState |= ((uint64)value<<((uint64)(x)))) #define BUTTONSET(x,value) (CONTROL_ButtonState |= ((uint64_t)value<<((uint64_t)(x))))
#define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64)1<<((uint64)(x)))) #define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1<<((uint64_t)(x))))
#define BUTTONHELDSET(x,value) (CONTROL_ButtonHeldState |= (uint64)(value<<((uint64)(x)))) #define BUTTONHELDSET(x,value) (CONTROL_ButtonHeldState |= (uint64_t)(value<<((uint64_t)(x))))
#define LIMITCONTROL(x)\ #define LIMITCONTROL(x)\
{\ {\

View file

@ -23,8 +23,8 @@ int32_t CONTROL_JoyPresent = FALSE;
int32_t CONTROL_JoystickEnabled = FALSE; int32_t CONTROL_JoystickEnabled = FALSE;
int32_t CONTROL_MousePresent = FALSE; int32_t CONTROL_MousePresent = FALSE;
int32_t CONTROL_MouseEnabled = FALSE; int32_t CONTROL_MouseEnabled = FALSE;
uint64 CONTROL_ButtonState = 0; uint64_t CONTROL_ButtonState = 0;
uint64 CONTROL_ButtonHeldState = 0; uint64_t CONTROL_ButtonHeldState = 0;
// static int32_t CONTROL_UserInputDelay = -1; // static int32_t CONTROL_UserInputDelay = -1;
float CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY; float CONTROL_MouseSensitivity = DEFAULTMOUSESENSITIVITY;

View file

@ -46,8 +46,8 @@ extern "C" {
#define MAXGAMEBUTTONS 64 #define MAXGAMEBUTTONS 64
#define BUTTON(x) ((CONTROL_ButtonState>> ((uint64)(x)) ) & 1) #define BUTTON(x) ((CONTROL_ButtonState>> ((uint64_t)(x)) ) & 1)
#define BUTTONHELD(x) ((CONTROL_ButtonHeldState>> ((uint64)(x)) ) & 1) #define BUTTONHELD(x) ((CONTROL_ButtonHeldState>> ((uint64_t)(x)) ) & 1)
#define BUTTONJUSTPRESSED(x) \ #define BUTTONJUSTPRESSED(x) \
( BUTTON( x ) && !BUTTONHELD( x ) ) ( BUTTON( x ) && !BUTTONHELD( x ) )
@ -136,8 +136,8 @@ extern int32_t CONTROL_MousePresent;
extern int32_t CONTROL_JoyPresent; extern int32_t CONTROL_JoyPresent;
extern int32_t CONTROL_MouseEnabled; extern int32_t CONTROL_MouseEnabled;
extern int32_t CONTROL_JoystickEnabled; extern int32_t CONTROL_JoystickEnabled;
extern uint64 CONTROL_ButtonState; extern uint64_t CONTROL_ButtonState;
extern uint64 CONTROL_ButtonHeldState; extern uint64_t CONTROL_ButtonHeldState;
//*************************************************************************** //***************************************************************************

View file

@ -849,7 +849,7 @@ int32_t S_CheckSoundPlaying(int32_t i, int32_t num)
if (i == -1) if (i == -1)
{ {
if (g_soundlocks[num] == 200) if (g_soundlocks[num] >= 200)
return 1; return 1;
return 0; return 0;
} }

View file

@ -500,7 +500,7 @@ int32_t S_CheckSoundPlaying(int32_t i, int32_t num)
{ {
if (i == -1) if (i == -1)
{ {
if (g_sounds[num].lock == 200) if (g_sounds[num].lock >= 200)
return 1; return 1;
return 0; return 0;
} }