diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 3dc222123..a26e79740 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -164,7 +164,7 @@ EDITOROBJS=$(OBJ)/astub.$o ifeq ($(PLATFORM),LINUX) OURCFLAGS += -fno-pic NASMFLAGS += -f elf - LIBS += -lvorbisfile -lvorbis -logg + LIBS += -lvorbisfile -lvorbis -logg -lprofiler USE_OPENAL = 0 endif diff --git a/polymer/eduke32/build/Makefile b/polymer/eduke32/build/Makefile index e91927b9c..fd1f3e406 100644 --- a/polymer/eduke32/build/Makefile +++ b/polymer/eduke32/build/Makefile @@ -139,7 +139,7 @@ EDITOROBJS=$(OBJ)/build.$o \ ifeq ($(PLATFORM),LINUX) ASFLAGS+= -f elf - LIBS+= -lm + LIBS+= -lm -lprofiler endif ifeq ($(PLATFORM),DARWIN) ENGINEOBJS += $(OBJ)/StartupWinController.editor.$o \ diff --git a/polymer/eduke32/build/src/defs.c b/polymer/eduke32/build/src/defs.c index 6df0c8e5d..c3d72553c 100644 --- a/polymer/eduke32/build/src/defs.c +++ b/polymer/eduke32/build/src/defs.c @@ -72,6 +72,7 @@ enum T_SETUPTILE,T_SETUPTILERANGE, T_ANIMTILERANGE, T_CACHESIZE, + T_IMPORTTILE, T_MUSIC,T_ID,T_SOUND, T_REDPAL,T_BLUEPAL,T_BROWNPAL,T_GREYPAL,T_GREENPAL,T_SPECPAL }; @@ -126,6 +127,7 @@ static tokenlist basetokens[] = { "setuptilerange", T_SETUPTILERANGE }, { "animtilerange", T_ANIMTILERANGE }, { "cachesize", T_CACHESIZE }, + { "importtile", T_IMPORTTILE }, }; static tokenlist modeltokens[] = @@ -589,6 +591,49 @@ static int defsparser(scriptfile *script) picanm[tile1]=(spd<<24)+(type<<6)+tile2-tile1; break; } + case T_IMPORTTILE: + { + int tile, xsiz, ysiz, j; + extern char faketile[MAXTILES]; + extern char *faketiledata[MAXTILES]; + int *picptr = NULL; + int bpl; + char *fn; + palette_t *col; + extern int getclosestcol(int r, int g, int b); + int i; + + if (scriptfile_getsymbol(script,&tile)) break; + if (scriptfile_getstring(script,&fn)) break; + + kpzload(fn, (intptr_t *)&picptr, &bpl, &xsiz, &ysiz); + + initprintf("got bpl %d xsiz %d ysiz %d\n",bpl,xsiz,ysiz); + + faketiledata[tile] = Bmalloc(xsiz*ysiz); + + for (i=0;i<(xsiz*ysiz);i++) + { + col = (palette_t *)&picptr[i]; + faketiledata[tile][i] = getclosestcol(col->b>>2,col->g>>2,col->r>>2); +// initprintf(" %d %d %d %d\n",col->r,col->g,col->b,col->f); + } + + if (xsiz > 0 && ysiz > 0) + { + tilesizx[tile] = xsiz; + tilesizy[tile] = ysiz; + faketile[tile] = 2; + picanm[tile] = 0; + + j = 15; while ((j > 1) && (pow2long[j] > xsiz)) j--; + picsiz[tile] = ((char)j); + j = 15; while ((j > 1) && (pow2long[j] > ysiz)) j--; + picsiz[tile] += ((char)(j<<4)); + } + + break; + } case T_DUMMYTILE: { int tile, xsiz, ysiz, j; diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 188b1137c..ca8a052b8 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -8047,6 +8047,7 @@ int loadpics(char *filename, int askedsize) // char cachedebug = 0; char faketile[MAXTILES]; +char *faketiledata[MAXTILES]; int h_xsize[MAXTILES], h_ysize[MAXTILES]; signed char h_xoffs[MAXTILES], h_yoffs[MAXTILES]; @@ -8093,7 +8094,14 @@ void loadtile(short tilenume) faketimerhandler(); artfilplc = tilefileoffs[tilenume]+dasiz; } - else { Bmemset((char *)waloff[tilenume],0,dasiz); faketimerhandler(); } + else + { + if (faketile[tilenume] == 1 || (faketile[tilenume] == 2 && faketiledata[tilenume] == NULL)) + Bmemset((char *)waloff[tilenume],0,dasiz); + else if (faketile[tilenume] == 2) + Bmemcpy((char *)waloff[tilenume],faketiledata[tilenume],dasiz); + faketimerhandler(); + } } void checktile(short tilenume) diff --git a/polymer/eduke32/eduke32.vcproj b/polymer/eduke32/eduke32.vcproj index 8a465becd..602479d37 100644 --- a/polymer/eduke32/eduke32.vcproj +++ b/polymer/eduke32/eduke32.vcproj @@ -516,6 +516,10 @@ RelativePath=".\source\keys.h" > + + @@ -556,10 +560,6 @@ RelativePath=".\source\startwin.game.h" > - - sectnum)) x = 0; + if (G_CheckForSpaceFloor(s->sectnum)) + x = 0; else { if (G_CheckForSpaceCeiling(s->sectnum)) - x = SpriteGravity/6; + x = g_spriteGravity/6; else - x = SpriteGravity; + x = g_spriteGravity; } if (s->z < (sector[sect].floorz-FOURSLEIGHT)) @@ -2389,7 +2390,7 @@ static void G_MoveWeapons(void) if (ActorExtra[i].projectile.workslike & PROJECTILE_SPIT) if (s->zvel < 6144) - s->zvel += SpriteGravity-112; + s->zvel += g_spriteGravity-112; k = s->xvel; ll = s->zvel; @@ -2878,7 +2879,7 @@ static void G_MoveWeapons(void) } } else if (s->picnum == SPIT) if (s->zvel < 6144) - s->zvel += SpriteGravity-112; + s->zvel += g_spriteGravity-112; if (j != 0) { @@ -4944,11 +4945,11 @@ static void G_MoveMisc(void) // STATNUM 5 if (sector[sect].lotag == 2) { if (s->zvel < 64) - s->zvel += (SpriteGravity>>5)+(krand()&7); + s->zvel += (g_spriteGravity>>5)+(krand()&7); } else if (s->zvel < 144) - s->zvel += (SpriteGravity>>5)+(krand()&7); + s->zvel += (g_spriteGravity>>5)+(krand()&7); } A_SetSprite(i,CLIPMASK0); @@ -5039,7 +5040,7 @@ static void G_MoveMisc(void) // STATNUM 5 s->zvel += 48; else s->zvel = 1024; } - else s->zvel += SpriteGravity-50; + else s->zvel += g_spriteGravity-50; } s->x += (s->xvel*sintable[(s->ang+512)&2047])>>14; @@ -5195,7 +5196,7 @@ static void G_MoveMisc(void) // STATNUM 5 t[0]++; t[0] &= 3; } - if (s->zvel < 128) s->zvel += (SpriteGravity/13); // 8 + if (s->zvel < 128) s->zvel += (g_spriteGravity/13); // 8 else s->zvel -= 64; if (s->xvel > 0) s->xvel -= 4; @@ -5210,7 +5211,7 @@ static void G_MoveMisc(void) // STATNUM 5 t[0]++; t[0] &= 3; } - if (s->zvel < 512) s->zvel += (SpriteGravity/3); // 52; + if (s->zvel < 512) s->zvel += (g_spriteGravity/3); // 52; if (s->xvel > 0) s->xvel --; // else KILLIT(i); @@ -5284,7 +5285,7 @@ static void G_MoveMisc(void) // STATNUM 5 else t[0]++; } } - if (s->zvel < 4096) s->zvel += SpriteGravity-50; + if (s->zvel < 4096) s->zvel += g_spriteGravity-50; s->x += (s->xvel*sintable[(s->ang+512)&2047])>>14; s->y += (s->xvel*sintable[s->ang&2047])>>14; s->z += s->zvel; diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index f48da52e3..1723d4dfc 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define APPNAME "EDuke32" #define VERSION " 1.5.0devel" // this is checked against http://eduke32.com/VERSION -extern char *s_builddate; +extern const char *s_buildDate; #define HEAD2 APPNAME VERSION #ifdef __cplusplus @@ -55,7 +55,7 @@ extern "C" { #include "function.h" -#include "swmacros.h" +#include "macros.h" #define HORIZ_MIN -99 #define HORIZ_MAX 299 @@ -426,72 +426,72 @@ extern int fricxv,fricyv; // of this struct into the same order so we can just memcpy it and get rid of the // mywhatever type globals -typedef struct { - int zoom,exitx,exity; - int posx, posy, posz, horiz, ohoriz, ohorizoff, invdisptime; - int bobposx,bobposy,oposx,oposy,oposz,pyoff,opyoff; - int posxv,posyv,poszv,last_pissed_time,truefz,truecz; - int player_par,visibility; - int bobcounter,weapon_sway; - int pals_time,randomflamex,crack_time; - - unsigned int interface_toggle_flag; - - int max_secret_rooms,secret_rooms,max_actors_killed,actors_killed; - int runspeed, movement_lock, team; - int max_player_health, max_shield_amount, max_ammo_amount[MAX_WEAPONS]; - - int scream_voice; - - int loogiex[64],loogiey[64],numloogs,loogcnt; - - char *palette; - - short sbs, sound_pitch; - - short ang,oang,angvel,cursectnum,look_ang,last_extra,subweapon; - short ammo_amount[MAX_WEAPONS],wackedbyactor,frag,fraggedself; - - short curr_weapon, last_weapon, tipincs, horizoff, wantweaponfire; - short holoduke_amount,newowner,hurt_delay,hbomb_hold_delay; - short jumping_counter,airleft,knee_incs,access_incs; - short fta,ftq,access_wallnum,access_spritenum; - short kickback_pic,got_access,weapon_ang,firstaid_amount; - short somethingonplayer,on_crane,i,one_parallax_sectnum; - short over_shoulder_on,random_club_frame,fist_incs; - short one_eighty_count,cheat_phase; - short dummyplayersprite,extra_extra8,quick_kick,last_quick_kick; - short heat_amount,actorsqu,timebeforeexit,customexitsound; - - short weaprecs[16],weapreccnt; - - - short orotscrnang,rotscrnang,dead_flag,show_empty_weapon; // JBF 20031220: added orotscrnang - short scuba_amount,jetpack_amount,steroids_amount,shield_amount; - short holoduke_on,pycount,weapon_pos,frag_ps; - short transporter_hold,last_full_weapon,footprintshade,boot_amount; - - char aim_mode,auto_aim,weaponswitch; - - char gm,on_warping_sector,footprintcount; - char hbomb_on,jumping_toggle,rapid_fire_hold,on_ground; - char inven_icon,buttonpalette; - - char jetpack_on,spritebridge,lastrandomspot; - char scuba_on,footprintpal,heat_on; - - char holster_weapon,falling_counter; - char gotweapon[MAX_WEAPONS],refresh_inventory; - - char toggle_key_flag,knuckle_incs; // ,select_dir; - char walking_snd_toggle, palookup, hard_landing; - char /*fire_flag,*/pals[3]; - char return_to_center, reloading, name[32]; +typedef struct { + int zoom, exitx, exity; + int posx, posy, posz, horiz, ohoriz, ohorizoff, invdisptime; + int bobposx, bobposy, oposx, oposy, oposz, pyoff, opyoff; + int posxv, posyv, poszv, last_pissed_time, truefz, truecz; + int player_par, visibility; + int bobcounter, weapon_sway; + int pals_time, randomflamex, crack_time; + + unsigned int interface_toggle_flag; + + int max_secret_rooms, secret_rooms, max_actors_killed, actors_killed; + int runspeed, movement_lock, team; + int max_player_health, max_shield_amount, max_ammo_amount[MAX_WEAPONS]; + + int scream_voice; + + int loogiex[64], loogiey[64], numloogs, loogcnt; + + char *palette; + + short sbs, sound_pitch; + + short ang, oang, angvel, cursectnum, look_ang, last_extra, subweapon; + short ammo_amount[MAX_WEAPONS], wackedbyactor, frag, fraggedself; + + short curr_weapon, last_weapon, tipincs, horizoff, wantweaponfire; + short holoduke_amount, newowner, hurt_delay, hbomb_hold_delay; + short jumping_counter, airleft, knee_incs, access_incs; + short fta, ftq, access_wallnum, access_spritenum; + short kickback_pic, got_access, weapon_ang, firstaid_amount; + short somethingonplayer, on_crane, i, one_parallax_sectnum; + short over_shoulder_on, random_club_frame, fist_incs; + short one_eighty_count, cheat_phase; + short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick; + short heat_amount, actorsqu, timebeforeexit, customexitsound; + + short weaprecs[16], weapreccnt; + + + short orotscrnang, rotscrnang, dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang + short scuba_amount, jetpack_amount, steroids_amount, shield_amount; + short holoduke_on, pycount, weapon_pos, frag_ps; + short transporter_hold, last_full_weapon, footprintshade, boot_amount; + + char aim_mode, auto_aim, weaponswitch; + + char gm, on_warping_sector, footprintcount; + char hbomb_on, jumping_toggle, rapid_fire_hold, on_ground; + char inven_icon, buttonpalette; + + char jetpack_on, spritebridge, lastrandomspot; + char scuba_on, footprintpal, heat_on; + + char holster_weapon, falling_counter; + char gotweapon[MAX_WEAPONS], refresh_inventory; + + char toggle_key_flag, knuckle_incs; // , select_dir; + char walking_snd_toggle, palookup, hard_landing; + char /*fire_flag, */pals[3]; + char return_to_center, reloading, name[32]; } DukePlayer_t; extern char tempbuf[2048], packbuf[576], menutextbuf[128]; -extern int SpriteGravity; +extern int g_spriteGravity; extern int g_impactDamage,g_actorRespawnTime,g_itemRespawnTime; extern int g_startArmorAmount; @@ -546,6 +546,7 @@ typedef struct { short tempang,actorstayput,dispicnum; short timetosleep; char cgg; + char filler; projectile_t projectile; } actordata_t; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 93ff7c9b8..be3a1fe0b 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -49,8 +49,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define WIN32_LEAN_AND_MEAN #include #include -#include -#include extern int G_GetVersionFromWebsite(char *buffer); #define UPDATEINTERVAL 604800 // 1w #else @@ -169,101 +167,6 @@ unsigned int g_frameDelay = 0; extern char forcegl; #endif -#ifdef _WIN32 -int G_GetVersionFromWebsite(char *buffer) // FIXME: this probably belongs in game land -{ - int wsainitialized = 0; - int bytes_sent, i=0, j=0; - struct sockaddr_in dest_addr; - struct hostent *h; - char *host = "eduke32.sourceforge.net"; - char *req = "GET http://eduke32.sourceforge.net/VERSION HTTP/1.0\r\n\r\n"; - char tempbuf[2048],otherbuf[16],ver[16]; - SOCKET mysock; - -#ifdef _WIN32 - if (wsainitialized == 0) - { - WSADATA ws; - - if (WSAStartup(0x101,&ws) == SOCKET_ERROR) - { - initprintf("update: Winsock error in G_GetVersionFromWebsite() (%d)\n",errno); - return(0); - } - wsainitialized = 1; - } -#endif - - if ((h=gethostbyname(host)) == NULL) - { - initprintf("update: gethostbyname() error in G_GetVersionFromWebsite() (%d)\n",h_errno); - return(0); - } - - dest_addr.sin_addr.s_addr = ((struct in_addr *)(h->h_addr))->s_addr; - dest_addr.sin_family = AF_INET; - dest_addr.sin_port = htons(80); - - memset(&(dest_addr.sin_zero), '\0', 8); - - - mysock = socket(PF_INET, SOCK_STREAM, 0); - - if (mysock == INVALID_SOCKET) - { - initprintf("update: socket() error in G_GetVersionFromWebsite() (%d)\n",errno); - return(0); - } - initprintf("Connecting to http://%s\n",host); - if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) - { - initprintf("update: connect() error in G_GetVersionFromWebsite() (%d)\n",errno); - return(0); - } - - bytes_sent = send(mysock, req, strlen(req), 0); - if (bytes_sent == SOCKET_ERROR) - { - initprintf("update: send() error in G_GetVersionFromWebsite() (%d)\n",errno); - return(0); - } - - // initprintf("sent %d bytes\n",bytes_sent); - recv(mysock, (char *)&tempbuf, sizeof(tempbuf), 0); - closesocket(mysock); - - memcpy(&otherbuf,&tempbuf,sizeof(otherbuf)); - - strtok(otherbuf," "); - if (atol(strtok(NULL," ")) == 200) - { - for (i=0;(unsigned)i 4) - if (tempbuf[i-1] == '\n' && tempbuf[i-2] == '\r' && tempbuf[i-3] == '\n' && tempbuf[i-4] == '\r') - { - while (j < 9) - { - ver[j] = tempbuf[i]; - i++, j++; - } - ver[j] = '\0'; - break; - } - } - - if (j) - { - strcpy(buffer,ver); - return(1); - } - } - return(0); -} -#endif - int kopen4loadfrommod(char *filename, char searchfirst) { static char fn[BMAX_PATH]; @@ -980,9 +883,9 @@ void getpackets(void) for (i=connectpoint2[connecthead];i>=0;i=connectpoint2[i]) if (i != other) sendpacket(i,packbuf,packbufleng); - if (packbuf[2] != (char)atoi(s_builddate)) + if (packbuf[2] != (char)atoi(s_buildDate)) { - initprintf("Player %d has version %d, expecting %d\n",packbuf[2],(char)atoi(s_builddate)); + initprintf("Player %d has version %d, expecting %d\n",packbuf[2],(char)atoi(s_buildDate)); G_GameExit("You cannot play with different versions of EDuke32!"); } if (packbuf[3] != BYTEVERSION) @@ -1162,9 +1065,9 @@ void getpackets(void) vote_map = packbuf[3]; Bsprintf(tempbuf,"%s^00 HAS CALLED A VOTE TO CHANGE MAP TO %s (E%dL%d)", - g_player[(unsigned char)packbuf[1]].user_name, - MapInfo[(unsigned char)(packbuf[2]*MAXLEVELS + packbuf[3])].name, - packbuf[2]+1,packbuf[3]+1); + g_player[(unsigned char)packbuf[1]].user_name, + MapInfo[(unsigned char)(packbuf[2]*MAXLEVELS + packbuf[3])].name, + packbuf[2]+1,packbuf[3]+1); G_AddUserQuote(tempbuf); Bsprintf(tempbuf,"PRESS F1 TO ACCEPT, F2 TO DECLINE"); @@ -2974,7 +2877,7 @@ void G_GameExit(const char *t) if (!(t[0] == ' ' && t[1] == 0)) { char titlebuf[256]; - Bsprintf(titlebuf,HEAD2 " %s",s_builddate); + Bsprintf(titlebuf,HEAD2 " %s",s_buildDate); wm_msgbox(titlebuf, (char *)t); } } @@ -8871,7 +8774,7 @@ static void G_ShowParameterHelp(void) "\nSee eduke32 -debughelp for debug parameters" ; #if defined RENDERTYPEWIN - Bsprintf(tempbuf,HEAD2 " %s",s_builddate); + Bsprintf(tempbuf,HEAD2 " %s",s_buildDate); wm_msgbox(tempbuf,s); #else initprintf("%s\n",s); @@ -8901,7 +8804,7 @@ static void G_ShowDebugHelp(void) "-z#/-condebug\tEnable line-by-line CON compile debugging at level #\n" ; #if defined RENDERTYPEWIN - Bsprintf(tempbuf,HEAD2 " %s",s_builddate); + Bsprintf(tempbuf,HEAD2 " %s",s_buildDate); wm_msgbox(tempbuf,s); #else initprintf("%s\n",s); @@ -10656,7 +10559,7 @@ static void Net_SendVersion(void) buf[0] = PACKET_TYPE_VERSION; buf[1] = myconnectindex; - buf[2] = (char)atoi(s_builddate); + buf[2] = (char)atoi(s_buildDate); buf[3] = BYTEVERSION; buf[4] = g_numSyncBytes; @@ -10920,7 +10823,7 @@ void app_main(int argc,const char **argv) (int(*)(void))GetTime, GAME_onshowosd ); - Bsprintf(tempbuf,HEAD2 " %s",s_builddate); + Bsprintf(tempbuf,HEAD2 " %s",s_buildDate); wm_setapptitle(tempbuf); initprintf("%s\n",apptitle); @@ -11058,7 +10961,7 @@ void app_main(int argc,const char **argv) initprintf("Current version is %d",atoi(tempbuf)); ud.config.LastUpdateCheck = time(NULL); - if (atoi(tempbuf) > atoi(s_builddate)) + if (atoi(tempbuf) > atoi(s_buildDate)) { if (wm_ynbox("EDuke32","A new version of EDuke32 is available. " "Browse to http://eduke32.sourceforge.net now?")) @@ -11359,7 +11262,7 @@ void app_main(int argc,const char **argv) initprintf("Initializing OSD...\n"); - Bsprintf(tempbuf,HEAD2 " %s",s_builddate); + Bsprintf(tempbuf,HEAD2 " %s",s_buildDate); OSD_SetVersionString(tempbuf, 10,0); registerosdcommands(); @@ -12312,13 +12215,13 @@ static void Net_DoPrediction(void) if (myz < (fz-(i<<8)) && (G_CheckForSpaceFloor(psect)|G_CheckForSpaceCeiling(psect)) == 0) //falling { if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && !TEST_SYNC_KEY(sb_snum, SK_CROUCH) && - myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8))) + myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8))) myz = fz-(i<<8); else { myonground = 0; - myzvel += (SpriteGravity+80); + myzvel += (g_spriteGravity+80); if (myzvel >= (4096+2048)) myzvel = (4096+2048); } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 80662f365..e79b564cc 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -5330,7 +5330,7 @@ repeatcase: g_actorRespawnTime = params[j++]; g_itemRespawnTime = params[j++]; g_playerFriction = params[j++]; - if (g_scriptVersion == 14) SpriteGravity = params[j++]; + if (g_scriptVersion == 14) g_spriteGravity = params[j++]; g_rpgBlastRadius = params[j++]; g_pipebombBlastRadius = params[j++]; g_shrinkerBlastRadius = params[j++]; diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 6ddcf2a30..c3cf29a2a 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -312,14 +312,14 @@ void A_GetZLimits(int iActor) void A_Fall(int iActor) { spritetype *s = &sprite[iActor]; - int hz,lz,c = SpriteGravity; + int hz,lz,c = g_spriteGravity; if (G_CheckForSpaceFloor(s->sectnum)) c = 0; else { if (G_CheckForSpaceCeiling(s->sectnum) || sector[s->sectnum].lotag == 2) - c = SpriteGravity/6; + c = g_spriteGravity/6; } if ((s->statnum == 1 || s->statnum == 10 || s->statnum == 2 || s->statnum == 6)) @@ -641,15 +641,12 @@ static inline void X_DoConditional(int condition) } } -// int *it = 0x00589a04; - static int X_DoExecute(void) { int j, l, s, tw = *insptr; if (g_killitFlag) return 1; - // if(*it == 1668249134L) G_GameExit("\nERR"); // Bsprintf(g_szBuf,"Parsing: %d",*insptr); // AddLog(g_szBuf); @@ -1034,10 +1031,10 @@ static int X_DoExecute(void) insptr++; g_sp->xoffset = g_sp->yoffset = 0; - j = SpriteGravity; + j = g_spriteGravity; if (G_CheckForSpaceCeiling(g_sp->sectnum) || sector[g_sp->sectnum].lotag == 2) - j = SpriteGravity/6; + j = g_spriteGravity/6; else if (G_CheckForSpaceFloor(g_sp->sectnum)) j = 0; @@ -1591,7 +1588,7 @@ static int X_DoExecute(void) Bstrcpy(ScriptQuotes[i],g_player[g_p].user_name); break; case STR_VERSION: - Bsprintf(tempbuf,HEAD2 " %s",s_builddate); + Bsprintf(tempbuf,HEAD2 " %s",s_buildDate); Bstrcpy(ScriptQuotes[i],tempbuf); break; case STR_GAMETYPE: diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index a221e8204..df73728ac 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -1321,7 +1321,7 @@ static void Gv_AddSystemVars(void) Gv_SetupVar("numplayers",(intptr_t)&numplayers, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY); Gv_SetupVar("viewingrange",(intptr_t)&viewingrange, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_SetupVar("yxaspect",(intptr_t)&yxaspect, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); - Gv_SetupVar("gravitationalconstant",(intptr_t)&SpriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); + Gv_SetupVar("gravitationalconstant",(intptr_t)&g_spriteGravity, GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_SetupVar("gametype_flags",(intptr_t)&GametypeFlags[ud.coop], GAMEVAR_SYSTEM | GAMEVAR_INTPTR); Gv_SetupVar("framerate",(intptr_t)&g_currentFrameRate, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY | GAMEVAR_SYNCCHECK); Gv_SetupVar("CLIPMASK0", CLIPMASK0, GAMEVAR_SYSTEM|GAMEVAR_READONLY); @@ -1473,7 +1473,7 @@ void Gv_RefreshPointers(void) aGameVars[Gv_GetVarIndex("g_currentMenu")].lValue = (intptr_t)&g_currentMenu; aGameVars[Gv_GetVarIndex("viewingrange")].lValue = (intptr_t)&viewingrange; aGameVars[Gv_GetVarIndex("yxaspect")].lValue = (intptr_t)&yxaspect; - aGameVars[Gv_GetVarIndex("gravitationalconstant")].lValue = (intptr_t)&SpriteGravity; + aGameVars[Gv_GetVarIndex("gravitationalconstant")].lValue = (intptr_t)&g_spriteGravity; aGameVars[Gv_GetVarIndex("GametypeFlags")].lValue = (intptr_t)&GametypeFlags[ud.coop]; aGameVars[Gv_GetVarIndex("framerate")].lValue = (intptr_t)&g_currentFrameRate; diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index f07c9cfd6..6d53825a0 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //------------------------------------------------------------------------- #include "duke3d.h" -char *s_builddate = "20081122"; +const char *s_buildDate = "20081122"; char *MusicPtr = NULL; int g_musicSize; @@ -31,8 +31,8 @@ short g_globalRandom; short neartagsector, neartagwall, neartagsprite; int neartaghitdist,lockclock,g_startArmorAmount; -// JBF: SpriteGravity modified to default to Atomic ed. default when using 1.3d CONs -int SpriteGravity=176; +// JBF: g_spriteGravity modified to default to Atomic ed. default when using 1.3d CONs +int g_spriteGravity=176; // int temp_data[MAXSPRITES][6]; actordata_t ActorExtra[MAXSPRITES]; @@ -157,7 +157,7 @@ char szPlayerName[32]; int g_damageCameras,g_freezerSelfDamage=0,g_tripbombLaserMode=0; int g_networkBroadcastMode = 255, g_movesPerPacket = 1,g_gameQuit = 0,everyothertime; int g_numFreezeBounces=3,g_rpgBlastRadius,g_pipebombBlastRadius,g_tripbombBlastRadius, - g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius; + g_shrinkerBlastRadius,g_morterBlastRadius,g_bouncemineBlastRadius,g_seenineBlastRadius; STATUSBARTYPE sbar; int mymaxlag, otherminlag, bufferjitter = 1; diff --git a/polymer/eduke32/source/swmacros.h b/polymer/eduke32/source/macros.h similarity index 100% rename from polymer/eduke32/source/swmacros.h rename to polymer/eduke32/source/macros.h diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index f8105d840..8af27bf22 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -4085,7 +4085,7 @@ void P_ProcessInput(int snum) else { p->on_ground = 0; - p->poszv += (SpriteGravity+80); // (TICSPERFRAME<<6); + p->poszv += (g_spriteGravity+80); // (TICSPERFRAME<<6); if (p->poszv >= (4096+2048)) p->poszv = (4096+2048); if (p->poszv > 2400 && p->falling_counter < 255) { diff --git a/polymer/eduke32/source/winbits.c b/polymer/eduke32/source/winbits.c index 548320ad0..b7d65b89b 100644 --- a/polymer/eduke32/source/winbits.c +++ b/polymer/eduke32/source/winbits.c @@ -31,6 +31,9 @@ Windows-specific hooks for JonoF's Duke3D port. #include #include #include +#include +#include +#include #include "winlayer.h" @@ -87,3 +90,98 @@ void Error(char *error, ...) #endif + +#ifdef _WIN32 +int G_GetVersionFromWebsite(char *buffer) +{ + int wsainitialized = 0; + int bytes_sent, i=0, j=0; + struct sockaddr_in dest_addr; + struct hostent *h; + char *host = "eduke32.sourceforge.net"; + char *req = "GET http://eduke32.sourceforge.net/VERSION HTTP/1.0\r\n\r\n"; + char tempbuf[2048],otherbuf[16],ver[16]; + SOCKET mysock; + +#ifdef _WIN32 + if (wsainitialized == 0) + { + WSADATA ws; + + if (WSAStartup(0x101,&ws) == SOCKET_ERROR) + { +// initprintf("update: Winsock error in G_GetVersionFromWebsite() (%d)\n",errno); + return(0); + } + wsainitialized = 1; + } +#endif + + if ((h=gethostbyname(host)) == NULL) + { +// initprintf("update: gethostbyname() error in G_GetVersionFromWebsite() (%d)\n",h_errno); + return(0); + } + + dest_addr.sin_addr.s_addr = ((struct in_addr *)(h->h_addr))->s_addr; + dest_addr.sin_family = AF_INET; + dest_addr.sin_port = htons(80); + + memset(&(dest_addr.sin_zero), '\0', 8); + + + mysock = socket(PF_INET, SOCK_STREAM, 0); + + if (mysock == INVALID_SOCKET) + { +// initprintf("update: socket() error in G_GetVersionFromWebsite() (%d)\n",errno); + return(0); + } + initprintf("Connecting to http://%s\n",host); + if (connect(mysock, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == SOCKET_ERROR) + { + // initprintf("update: connect() error in G_GetVersionFromWebsite() (%d)\n",errno); + return(0); + } + + bytes_sent = send(mysock, req, strlen(req), 0); + if (bytes_sent == SOCKET_ERROR) + { + // initprintf("update: send() error in G_GetVersionFromWebsite() (%d)\n",errno); + return(0); + } + + // initprintf("sent %d bytes\n",bytes_sent); + recv(mysock, (char *)&tempbuf, sizeof(tempbuf), 0); + closesocket(mysock); + + memcpy(&otherbuf,&tempbuf,sizeof(otherbuf)); + + strtok(otherbuf," "); + if (atol(strtok(NULL," ")) == 200) + { + for (i=0;(unsigned)i 4) + if (tempbuf[i-1] == '\n' && tempbuf[i-2] == '\r' && tempbuf[i-3] == '\n' && tempbuf[i-4] == '\r') + { + while (j < 9) + { + ver[j] = tempbuf[i]; + i++, j++; + } + ver[j] = '\0'; + break; + } + } + + if (j) + { + strcpy(buffer,ver); + return(1); + } + } + return(0); +} +#endif