diff --git a/polymer/build/Makefile.msvc b/polymer/build/Makefile.msvc index 77393ed98..41dd6258e 100644 --- a/polymer/build/Makefile.msvc +++ b/polymer/build/Makefile.msvc @@ -31,12 +31,12 @@ TARGETOPTS=/DNOASM !ifdef DEBUG # debugging options -flags_cl=/Ot /Zi /MTd +flags_cl=/Ot /Zi flags_link=/DEBUG !else # release options #flags_cl=/Ox -flags_cl= /O2 /Ox /MT +flags_cl= /O2 /Ox flags_link=/RELEASE !endif @@ -44,7 +44,7 @@ CC=cl AS=ml RC=rc LINK=link /opt:nowin98 /opt:ref /nologo -CFLAGS=$(CFLAGS) /nologo /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" +CFLAGS=$(CFLAGS) /nologo /MD /J $(flags_cl) $(TARGETOPTS) /I$(INC) /I$(DXROOT)\include /I$(MSSDKROOT)\include" /I$(PLATFORMSDK)\include" ASFLAGS=/nologo /coff EXESUFFIX=.exe diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index d6e94d138..c0b56cfe9 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -174,8 +174,8 @@ static float fogresult, fogcol[4]; // making this a macro should speed things up at the expense of code size #define fogcalc(shade, vis, pal) \ { \ - fogresult = (float)gvisibility*(vis+16+(shade<0?(-(shade)*(shade))*0.125f:((shade)*(shade))*0.125f)); \ - if (vis > 239) fogresult = (float)gvisibility*((vis-240+(shade<0?(-(shade)*(shade))*0.125f:((shade)*(shade))*0.125f))/(klabs(vis-256))); \ + fogresult = (float)gvisibility*(vis+16+(shade<0?(-shade*shade)*0.125f:(shade*shade)*0.125f)); \ + if (vis > 239) fogresult = (float)gvisibility*((vis-240+(shade<0?(-shade*shade)*0.125f:(shade*shade)*0.125f))/(klabs(vis-256))); \ fogresult = min(max(fogresult, 0.01f),10.f); \ fogcol[0] = (float)palookupfog[pal].r / 63.f; \ fogcol[1] = (float)palookupfog[pal].g / 63.f; \ @@ -3379,7 +3379,7 @@ static void polymost_drawalls(int bunch) #ifdef USE_OPENGL if (!nofog) { - fogcalc(sec->ceilingshade,sec->visibility,sec->floorpal); + fogcalc(sec->ceilingshade,sec->visibility,sec->ceilingpal); bglFogf(GL_FOG_DENSITY,fogresult); bglFogfv(GL_FOG_COLOR,fogcol); } @@ -3401,7 +3401,7 @@ static void polymost_drawalls(int bunch) */ if (!nofog) { - fogcalc(sec->ceilingshade,sec->visibility,sec->floorpal); + fogcalc(sec->ceilingshade,sec->visibility,sec->ceilingpal); bglFogf(GL_FOG_DENSITY,fogresult * 0.005); bglFogfv(GL_FOG_COLOR,fogcol); } @@ -4377,7 +4377,6 @@ void polymost_drawsprite(int snum) method = 1+4; if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } - #ifdef USE_OPENGL if (r_depthpeeling) { @@ -4386,6 +4385,7 @@ void polymost_drawsprite(int snum) if (!(((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && peelcompiling) return; // discard opaque sprite when composing the depth peels } + if (!nofog && rendmode >= 3) { fogcalc(globalshade,sector[tspr->sectnum].visibility,sector[tspr->sectnum].floorpal); diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index ef1318238..9fb40a51e 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -161,6 +161,8 @@ void wm_setapptitle(char *name) int main(int argc, char *argv[]) { int r; + char *argp; + FILE *fp; buildkeytranslationtable(); @@ -172,6 +174,25 @@ int main(int argc, char *argv[]) _buildargc = argc; _buildargv = (const char**)argv; + // pipe standard outputs to files + if ((argp = Bgetenv("BUILD_LOGSTDOUT")) != NULL) + if (!Bstrcasecmp(argp, "TRUE")) + { + fp = freopen("stdout.txt", "w", stdout); + if (!fp) + { + fp = fopen("stdout.txt", "w"); + } + if (fp) setvbuf(fp, 0, _IONBF, 0); + *stdout = *fp; + *stderr = *fp; + } + +#if defined(USE_OPENGL) && defined(POLYMOST) + if ((argp = Bgetenv("BUILD_NOFOG")) != NULL) + nofog = Batol(argp); +#endif + baselayer_init(); r = app_main(_buildargc, _buildargv); diff --git a/polymer/build/src/startgtk.editor.c b/polymer/build/src/startgtk.editor.c index c69656aad..55f796b52 100755 --- a/polymer/build/src/startgtk.editor.c +++ b/polymer/build/src/startgtk.editor.c @@ -589,7 +589,7 @@ int startwin_idle(void *s) int startwin_run(void) { - if (!gtkenabled) return 0; + if (!gtkenabled) return 1; if (!startwin) return 1; SetPage(TAB_CONFIG); diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 3b4cd9da4..40ba00840 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -34,7 +34,7 @@ inline void updateinterpolations(void) //Stick at beginning of domovethings for (;i>=0;i--) oldipos[i] = *curipos[i]; } -void setinterpolation(int *posptr) +void setinterpolation(intptr_t *posptr) { int i=numinterpolations-1; @@ -46,7 +46,7 @@ void setinterpolation(int *posptr) numinterpolations++; } -void stopinterpolation(int *posptr) +void stopinterpolation(intptr_t *posptr) { int i=numinterpolations-1; @@ -537,9 +537,9 @@ int movesprite(int spritenum, int xchange, int ychange, int zchange, unsigned in inline int ssp(int i,unsigned int cliptype) //The set sprite function { return (movesprite(i, - (sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, - (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14,sprite[i].zvel, - cliptype)==0); + (sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, + (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14,sprite[i].zvel, + cliptype)==0); } #undef deletesprite diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 72f91283d..3a7581298 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -184,6 +184,14 @@ void CONFIG_SetDefaults(void) int32 i,f; ud.config.scripthandle = -1; + ud.config.ScreenWidth = 1024; + ud.config.ScreenHeight = 768; + ud.config.ScreenMode = 0; +#if defined(POLYMOST) && defined(USE_OPENGL) + ud.config.ScreenBPP = 32; +#else + ud.config.ScreenBPP = 8; +#endif ud.config.useprecache = 1; ud.config.ForceSetup = 1; ud.config.AmbienceToggle = 1; diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 31ff6cf6b..a2029ee73 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -27,8 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define HEAD "EDuke32"VERSION" (shareware)" #define HEAD2 "EDuke32"VERSION -#include "compat.h" - #ifdef __cplusplus extern "C" { #endif @@ -692,9 +690,9 @@ extern int everyothertime; extern int mymaxlag, otherminlag, bufferjitter; extern int numinterpolations, startofdynamicinterpolations; -extern int oldipos[MAXINTERPOLATIONS]; -extern int bakipos[MAXINTERPOLATIONS]; -extern int *curipos[MAXINTERPOLATIONS]; +extern intptr_t oldipos[MAXINTERPOLATIONS]; +extern intptr_t bakipos[MAXINTERPOLATIONS]; +extern intptr_t *curipos[MAXINTERPOLATIONS]; extern short numclouds,clouds[128],cloudx[128],cloudy[128]; extern int cloudtotalclock,totalmemory; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index c97a8d0d1..b24d12748 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -150,98 +150,98 @@ extern void computergetinput(int snum, input *syn); keydef keynames[]= { - {"COMMA", sc_Comma}, - {"PERIOD", sc_Period}, - {"ENTER", sc_Enter}, - {"ESCAPE", sc_Escape}, - {"SPACE", sc_Space}, - {"BACKSPACE", sc_BackSpace}, - {"TAB", sc_Tab}, - {"LEFTALT", sc_LeftAlt}, - {"LEFTCONTROL", sc_LeftControl}, - {"CAPSLOCK", sc_CapsLock}, - {"LEFTSHIFT", sc_LeftShift}, - {"RIGHTSHIFT", sc_RightShift}, - {"F1", sc_F1}, - {"F2", sc_F2}, - {"F3", sc_F3}, - {"F4", sc_F4}, - {"F5", sc_F5}, - {"F6", sc_F6}, - {"F7", sc_F7}, - {"F8", sc_F8}, - {"F9", sc_F9}, - {"F10", sc_F10}, - {"F11", sc_F11}, - {"F12", sc_F12}, - {"KPAD_STAR", sc_Kpad_Star}, - {"PAUSE", sc_Pause}, - {"SCROLLLOCK", sc_ScrollLock}, - {"NUMLOCK", sc_NumLock}, - {"SLASH", sc_Slash}, - {"SEMICOLON", sc_SemiColon}, - {"QUOTE", sc_Quote}, - {"TILDE", sc_Tilde}, - {"BACKSLASH", sc_BackSlash}, + {"COMMA", sc_Comma}, + {"PERIOD", sc_Period}, + {"ENTER", sc_Enter}, + {"ESCAPE", sc_Escape}, + {"SPACE", sc_Space}, + {"BACKSPACE", sc_BackSpace}, + {"TAB", sc_Tab}, + {"LEFTALT", sc_LeftAlt}, + {"LEFTCONTROL", sc_LeftControl}, + {"CAPSLOCK", sc_CapsLock}, + {"LEFTSHIFT", sc_LeftShift}, + {"RIGHTSHIFT", sc_RightShift}, + {"F1", sc_F1}, + {"F2", sc_F2}, + {"F3", sc_F3}, + {"F4", sc_F4}, + {"F5", sc_F5}, + {"F6", sc_F6}, + {"F7", sc_F7}, + {"F8", sc_F8}, + {"F9", sc_F9}, + {"F10", sc_F10}, + {"F11", sc_F11}, + {"F12", sc_F12}, + {"KPAD_STAR", sc_Kpad_Star}, + {"PAUSE", sc_Pause}, + {"SCROLLLOCK", sc_ScrollLock}, + {"NUMLOCK", sc_NumLock}, + {"SLASH", sc_Slash}, + {"SEMICOLON", sc_SemiColon}, + {"QUOTE", sc_Quote}, + {"TILDE", sc_Tilde}, + {"BACKSLASH", sc_BackSlash}, - {"OPENBRACKET", sc_OpenBracket}, - {"CLOSEBRACKET",sc_CloseBracket}, + {"OPENBRACKET", sc_OpenBracket}, + {"CLOSEBRACKET",sc_CloseBracket}, - {"1", sc_1}, - {"2", sc_2}, - {"3", sc_3}, - {"4", sc_4}, - {"5", sc_5}, - {"6", sc_6}, - {"7", sc_7}, - {"8", sc_8}, - {"9", sc_9}, - {"0", sc_0}, - {"MINUS", sc_Minus}, - {"EQUALS", sc_Equals}, - {"PLUS", sc_Plus}, + {"1", sc_1}, + {"2", sc_2}, + {"3", sc_3}, + {"4", sc_4}, + {"5", sc_5}, + {"6", sc_6}, + {"7", sc_7}, + {"8", sc_8}, + {"9", sc_9}, + {"0", sc_0}, + {"MINUS", sc_Minus}, + {"EQUALS", sc_Equals}, + {"PLUS", sc_Plus}, - {"KPAD_1", sc_kpad_1}, - {"KPAD_2", sc_kpad_2}, - {"KPAD_3", sc_kpad_3}, - {"KPAD_4", sc_kpad_4}, - {"KPAD_5", sc_kpad_5}, - {"KPAD_6", sc_kpad_6}, - {"KPAD_7", sc_kpad_7}, - {"KPAD_8", sc_kpad_8}, - {"KPAD_9", sc_kpad_9}, - {"KPAD_0", sc_kpad_0}, - {"KPAD_MINUS", sc_kpad_Minus}, - {"KPAD_PLUS", sc_kpad_Plus}, - {"KPAD_PERIOD", sc_kpad_Period}, + {"KPAD_1", sc_kpad_1}, + {"KPAD_2", sc_kpad_2}, + {"KPAD_3", sc_kpad_3}, + {"KPAD_4", sc_kpad_4}, + {"KPAD_5", sc_kpad_5}, + {"KPAD_6", sc_kpad_6}, + {"KPAD_7", sc_kpad_7}, + {"KPAD_8", sc_kpad_8}, + {"KPAD_9", sc_kpad_9}, + {"KPAD_0", sc_kpad_0}, + {"KPAD_MINUS", sc_kpad_Minus}, + {"KPAD_PLUS", sc_kpad_Plus}, + {"KPAD_PERIOD", sc_kpad_Period}, - {"A", sc_A}, - {"B", sc_B}, - {"C", sc_C}, - {"D", sc_D}, - {"E", sc_E}, - {"F", sc_F}, - {"G", sc_G}, - {"H", sc_H}, - {"I", sc_I}, - {"J", sc_J}, - {"K", sc_K}, - {"L", sc_L}, - {"M", sc_M}, - {"N", sc_N}, - {"O", sc_O}, - {"P", sc_P}, - {"Q", sc_Q}, - {"R", sc_R}, - {"S", sc_S}, - {"T", sc_T}, - {"U", sc_U}, - {"V", sc_V}, - {"W", sc_W}, - {"X", sc_X}, - {"Y", sc_Y}, - {"Z", sc_Z}, - {0,0} + {"A", sc_A}, + {"B", sc_B}, + {"C", sc_C}, + {"D", sc_D}, + {"E", sc_E}, + {"F", sc_F}, + {"G", sc_G}, + {"H", sc_H}, + {"I", sc_I}, + {"J", sc_J}, + {"K", sc_K}, + {"L", sc_L}, + {"M", sc_M}, + {"N", sc_N}, + {"O", sc_O}, + {"P", sc_P}, + {"Q", sc_Q}, + {"R", sc_R}, + {"S", sc_S}, + {"T", sc_T}, + {"U", sc_U}, + {"V", sc_V}, + {"W", sc_W}, + {"X", sc_X}, + {"Y", sc_Y}, + {"Z", sc_Z}, + {0,0} }; keybind boundkeys[MAXBOUNDKEYS]; @@ -1224,8 +1224,8 @@ void faketimerhandler(void) packbuf[j++] = (char)nsyn[0].horz; packbuf[k] |= 128; } - k++; - packbuf[k] = 0; +// k++; + packbuf[++k] = 0; if ((nsyn[0].extbits^osyn[0].extbits)&0x000000ff) packbuf[j++] = (nsyn[0].extbits&255), packbuf[k] |= 1; if ((nsyn[0].extbits^osyn[0].extbits)&0x0000ff00) packbuf[j++] = ((nsyn[0].extbits>>8)&255), packbuf[k] |= 2; if ((nsyn[0].extbits^osyn[0].extbits)&0x00ff0000) packbuf[j++] = ((nsyn[0].extbits>>16)&255), packbuf[k] |= 4; @@ -4003,7 +4003,7 @@ void displayrooms(int snum,int smoothratio) } #ifdef POLYMOST - if (ud.overhead_on == 2 || ud.show_help || (p->cursectnum == -1 && rendmode != 4)) + if (ud.overhead_on == 2 || ud.show_help || (p->cursectnum == -1 && rendmode < 3)) #else if (ud.overhead_on == 2 || ud.show_help || p->cursectnum == -1) #endif @@ -4018,7 +4018,7 @@ void displayrooms(int snum,int smoothratio) ud.camerasect = p->cursectnum; #ifdef POLYMOST - if (rendmode != 4) + if (rendmode < 3) #endif if (ud.camerasect < 0 || ud.camerasect >= MAXSECTORS) return; @@ -6731,8 +6731,8 @@ void animatesprites(int x,int y,int a,int smoothratio) tsprite[spritesortcnt].statnum = 99; -/* tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3); - if (t->yrepeat < 4) t->yrepeat = 4; */ + /* tsprite[spritesortcnt].yrepeat = (t->yrepeat>>3); + if (t->yrepeat < 4) t->yrepeat = 4; */ tsprite[spritesortcnt].shade = t->shade; tsprite[spritesortcnt].cstat = 0; @@ -7798,12 +7798,12 @@ static void nonsharedkeys(void) int i,ch; int j; - for(i=0;i<256;i++) - if (*boundkeys[i].name&&KB_KeyPressed(i)) - { - load_script(boundkeys[i].name); - KB_ClearKeyDown(i); - } + for (i=0;i<256;i++) + if (*boundkeys[i].name&&KB_KeyPressed(i)) + { + load_script(boundkeys[i].name); + KB_ClearKeyDown(i); + } if (ud.recstat == 2) { ControlInfo noshareinfo; diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index ea8a3adaa..e21d00283 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -41,7 +41,7 @@ intptr_t *casescriptptr=NULL; // the pointer to the start of the case table static int casecount = 0; static int checking_switch = 0, current_event = -1; static int labelsonly = 0, nokeywordcheck = 0, dynamicremap = 0; -static int num_braces = 0; // init to some sensible defaults +static int num_braces = 0; int redefined_quote_count = 0; @@ -1377,8 +1377,10 @@ static void transvartype(int type) if (!(error || warning) && g_ScriptDebug) initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",compilefile,line_number,atol(textptr)); *scriptptr++=MAXGAMEVARS; - if (tolower(textptr[1])=='x')sscanf(textptr+2,"%x",scriptptr);else - *scriptptr=atol(textptr); + if (tolower(textptr[1])=='x') + sscanf(textptr+2,"%x",scriptptr); + else + *scriptptr=atol(textptr); scriptptr++; getlabel(); return; @@ -1552,8 +1554,9 @@ static int transnum(int type) } if (!(error || warning) && g_ScriptDebug > 1) initprintf("%s:%d: debug: accepted constant %d.\n",compilefile,line_number,atol(textptr)); - if (tolower(textptr[1])=='x')sscanf(textptr+2,"%x",scriptptr);else - *scriptptr = atol(textptr); + if (tolower(textptr[1])=='x')sscanf(textptr+2,"%x",scriptptr); + else + *scriptptr = atol(textptr); scriptptr++; textptr += l; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 11ec270c7..32b69b65b 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -31,7 +31,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "osd.h" int g_i,g_p; -static intptr_t g_x,*g_t; +static int g_x; +static intptr_t *g_t; static spritetype *g_sp; static int killit_flag; @@ -129,55 +130,45 @@ static void DoUserDef(int iSet, int lLabelID, int lVar2) // if(iSet) // { // ud.user_name[MAXPLAYERS][32] = lValue; + // return; // } - // return; } - // { - // SetGameVarID(lVar2, ud.user_name[MAXPLAYERS][32], g_i, g_p); - // } + // SetGameVarID(lVar2, ud.user_name[MAXPLAYERS][32], g_i, g_p); // return; // case USERDEFS_RIDECULE: // if(iSet) // { // ud.ridecule = lValue; + // return; // } - // return; } - // { - // SetGameVarID(lVar2, ud.ridecule, g_i, g_p); - // } + // SetGameVarID(lVar2, ud.ridecule, g_i, g_p); // return; // case USERDEFS_SAVEGAME: // if(iSet) // { // ud.savegame = lValue; + // return; // } - // return; } - // { - // SetGameVarID(lVar2, ud.savegame, g_i, g_p); - // } + // SetGameVarID(lVar2, ud.savegame, g_i, g_p); // return; // case USERDEFS_PWLOCKOUT: // if(iSet) // { // ud.pwlockout = lValue; + // return; // } - // return; } - // { - // SetGameVarID(lVar2, ud.pwlockout, g_i, g_p); - // } + // SetGameVarID(lVar2, ud.pwlockout, g_i, g_p); // return; // case USERDEFS_RTSNAME: // if(iSet) // { // ud.rtsname = lValue; + // return; // } - // return; } - // { - // SetGameVarID(lVar2, ud.rtsname, g_i, g_p); - // } + // SetGameVarID(lVar2, ud.rtsname, g_i, g_p); // return; case USERDEFS_OVERHEAD_ON: @@ -469,11 +460,9 @@ static void DoUserDef(int iSet, int lLabelID, int lVar2) // if(iSet) // { // ud.wchoice = lValue; + // return; // } - // return; } - // { - // SetGameVarID(lVar2, ud.wchoice, g_i, g_p); - // } + // SetGameVarID(lVar2, ud.wchoice, g_i, g_p); // return; case USERDEFS_PLAYERAI: @@ -5069,24 +5058,31 @@ static int parse(void) j=GetGameVarID(*insptr++, g_i, g_p); if (i