From f2a2b491d6d56fa854ba1b879c85990d7a7699c0 Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 23 Nov 2008 03:09:34 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1149 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/game.c | 9 +- polymer/eduke32/source/gamedef.c | 8 +- polymer/eduke32/source/global.c | 4 +- polymer/eduke32/source/jaudiolib/sdlmusic.c | 47 ++--------- polymer/eduke32/source/player.c | 94 ++++++++++----------- polymer/eduke32/source/sector.c | 4 +- polymer/eduke32/source/sounds.c | 15 +--- 7 files changed, 71 insertions(+), 110 deletions(-) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 812d9ec6e..93ff7c9b8 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -1162,9 +1162,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"); @@ -12311,7 +12311,8 @@ 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|SK_CROUCH) == 0 && myonground && (sector[psect].floorstat&2) && myz >= (fz-(i<<8)-(16<<8))) + 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))) myz = fz-(i<<8); else { diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 9ea9b7dec..80662f365 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -2094,10 +2094,10 @@ static int C_ParseCommand(void) C_ReportError(WARNING_BADGAMEVAR); } Gv_SetupVar(label+(g_numLabels<<6),*(g_scriptPtr-2), - (*(g_scriptPtr-1)) - // can't define default or secret - & (~(GAMEVAR_DEFAULT | GAMEVAR_SECRET)) - ); + (*(g_scriptPtr-1)) + // can't define default or secret + & (~(GAMEVAR_DEFAULT | GAMEVAR_SECRET)) + ); //AddLog("Added gamevar"); g_scriptPtr -= 3; // no need to save in script... return 0; diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index 1cd539cdf..f07c9cfd6 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 = "20081121"; +char *s_builddate = "20081122"; char *MusicPtr = NULL; int g_musicSize; @@ -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/jaudiolib/sdlmusic.c b/polymer/eduke32/source/jaudiolib/sdlmusic.c index 558704982..9ee6e6b0c 100644 --- a/polymer/eduke32/source/jaudiolib/sdlmusic.c +++ b/polymer/eduke32/source/jaudiolib/sdlmusic.c @@ -70,7 +70,7 @@ static int music_initialized = 0; static int music_context = 0; static int music_loopflag = MUSIC_PlayOnce; static Mix_Music *music_musicchunk = NULL; -static char *music_songdata = NULL; +// static char *music_songdata = NULL; // This gets called all over the place for information and debugging messages. // If the user set the DUKESND_DEBUG environment variable, the messages @@ -294,59 +294,28 @@ int MUSIC_StopSong(void) if (music_musicchunk) Mix_FreeMusic(music_musicchunk); - if (music_songdata) - Bfree(music_songdata); +// if (music_songdata) +// Bfree(music_songdata); music_musicchunk = NULL; - music_songdata = NULL; +// music_songdata = NULL; return(MUSIC_Ok); } // MUSIC_StopSong // Duke3D-specific. --ryan. -void MUSIC_PlayMusic(char *_filename) +// void MUSIC_PlayMusic(char *_filename) +int MUSIC_PlaySong(unsigned char *song, int loopflag) { - int handle; - int size; - int rc; - MUSIC_StopSong(); - - handle = kopen4load(_filename, 0); - if (handle == -1) - return; - - size = kfilelength(handle); - if (size == -1) - { - kclose(handle); - return; - } // if - - music_songdata = Bcalloc(size,sizeof(char)); - if (music_songdata == NULL) - { - kclose(handle); - return; - } // if - - rc = kread(handle, music_songdata, size); - kclose(handle); - if (rc != size) - { - Bfree(music_songdata); - music_songdata = NULL; - return; - } // if - - music_musicchunk = Mix_LoadMUS_RW(SDL_RWFromMem((char *) music_songdata, size)); + music_musicchunk = Mix_LoadMUS_RW(SDL_RWFromMem((char *) song, g_musicSize)); if (music_musicchunk != NULL) { // !!! FIXME: I set the music to loop. Hope that's okay. --ryan. - g_musicSize = size; Mix_PlayMusic(music_musicchunk, -1); } // if + return MUSIC_Ok; } diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 0988b02c7..f8105d840 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -2152,7 +2152,7 @@ static int P_DisplayTipAnim(int gs,int snum) p = wall[g_player[snum].ps->access_wallnum].pal; */ G_DrawTileScaled(170+(g_player[snum].sync->avel>>4)-(g_player[snum].ps->look_ang>>1), - (tip_y[g_player[snum].ps->tipincs]>>1)+looking_arc+240-((g_player[snum].ps->horiz-g_player[snum].ps->horizoff)>>4),TIP+((26-g_player[snum].ps->tipincs)>>4),gs,262144,p); + (tip_y[g_player[snum].ps->tipincs]>>1)+looking_arc+240-((g_player[snum].ps->horiz-g_player[snum].ps->horizoff)>>4),TIP+((26-g_player[snum].ps->tipincs)>>4),gs,262144,p); return 1; } @@ -2255,9 +2255,9 @@ void P_DisplayWeapon(int snum) if (j < 6 || j > 12) G_DrawTileScaled(weapon_xoffset+80-(p->look_ang>>1), - looking_arc+250-gun_pos,KNEE,gs,o|4|262144,pal); + looking_arc+250-gun_pos,KNEE,gs,o|4|262144,pal); else G_DrawTileScaled(weapon_xoffset+160-16-(p->look_ang>>1), - looking_arc+214-gun_pos,KNEE+1,gs,o|4|262144,pal); + looking_arc+214-gun_pos,KNEE+1,gs,o|4|262144,pal); } if (sprite[p->i].xrepeat < 40) @@ -2271,13 +2271,13 @@ void P_DisplayWeapon(int snum) cw = weapon_xoffset; weapon_xoffset += sintable[(fistsign)&2047]>>10; G_DrawTile(weapon_xoffset+250-(p->look_ang>>1), - looking_arc+258-(klabs(sintable[(fistsign)&2047]>>8)), - FIST,gs,o); + looking_arc+258-(klabs(sintable[(fistsign)&2047]>>8)), + FIST,gs,o); weapon_xoffset = cw; weapon_xoffset -= sintable[(fistsign)&2047]>>10; G_DrawTile(weapon_xoffset+40-(p->look_ang>>1), - looking_arc+200+(klabs(sintable[(fistsign)&2047]>>8)), - FIST,gs,o|4); + looking_arc+200+(klabs(sintable[(fistsign)&2047]>>8)), + FIST,gs,o|4); } else switch (cw) @@ -2303,10 +2303,10 @@ void P_DisplayWeapon(int snum) if ((*kb) < 5 || (*kb) > 9) G_DrawTileScaled(weapon_xoffset+220-(p->look_ang>>1), - looking_arc+250-gun_pos,KNEE,gs,o,pal); + looking_arc+250-gun_pos,KNEE,gs,o,pal); else G_DrawTileScaled(weapon_xoffset+160-(p->look_ang>>1), - looking_arc+214-gun_pos,KNEE+1,gs,o,pal); + looking_arc+214-gun_pos,KNEE+1,gs,o,pal); } } break; @@ -2330,14 +2330,14 @@ void P_DisplayWeapon(int snum) looking_arc += ((*kb)<<3); else if ((*kb) < 4) G_DrawWeaponTile(weapon_xoffset+142-(p->look_ang>>1), - looking_arc+234-gun_pos,HANDHOLDINGLASER+3,gs,o,pal); + looking_arc+234-gun_pos,HANDHOLDINGLASER+3,gs,o,pal); G_DrawWeaponTile(weapon_xoffset+130-(p->look_ang>>1), - looking_arc+249-gun_pos, - HANDHOLDINGLASER+((*kb)>>2),gs,o,pal); + looking_arc+249-gun_pos, + HANDHOLDINGLASER+((*kb)>>2),gs,o,pal); G_DrawWeaponTile(weapon_xoffset+152-(p->look_ang>>1), - looking_arc+249-gun_pos, - HANDHOLDINGLASER+((*kb)>>2),gs,o|4,pal); + looking_arc+249-gun_pos, + HANDHOLDINGLASER+((*kb)>>2),gs,o|4,pal); } break; @@ -2361,12 +2361,12 @@ void P_DisplayWeapon(int snum) if (*kb < 8) { G_DrawWeaponTile(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos, - RPGGUN+((*kb)>>1),gs,o,pal); + RPGGUN+((*kb)>>1),gs,o,pal); } } G_DrawWeaponTile(weapon_xoffset+164,(looking_arc<<1)+176-gun_pos, - RPGGUN,gs,o,pal); + RPGGUN,gs,o,pal); } break; @@ -2390,13 +2390,13 @@ void P_DisplayWeapon(int snum) case 1: case 2: G_DrawWeaponTile(weapon_xoffset+168-(p->look_ang>>1),looking_arc+201-gun_pos, - SHOTGUN+2,-128,o,pal); + SHOTGUN+2,-128,o,pal); case 0: case 6: case 7: case 8: G_DrawWeaponTile(weapon_xoffset+146-(p->look_ang>>1),looking_arc+202-gun_pos, - SHOTGUN,gs,o,pal); + SHOTGUN,gs,o,pal); break; case 3: case 4: @@ -2411,45 +2411,45 @@ void P_DisplayWeapon(int snum) weapon_xoffset += 20; G_DrawWeaponTile(weapon_xoffset+178-(p->look_ang>>1),looking_arc+194-gun_pos, - SHOTGUN+1+((*(kb)-1)>>1),-128,o,pal); + SHOTGUN+1+((*(kb)-1)>>1),-128,o,pal); } G_DrawWeaponTile(weapon_xoffset+158-(p->look_ang>>1),looking_arc+220-gun_pos, - SHOTGUN+3,gs,o,pal); + SHOTGUN+3,gs,o,pal); break; case 13: case 14: case 15: G_DrawWeaponTile(32+weapon_xoffset+166-(p->look_ang>>1),looking_arc+210-gun_pos, - SHOTGUN+4,gs,o,pal); + SHOTGUN+4,gs,o,pal); break; case 16: case 17: case 18: case 19: G_DrawWeaponTile(64+weapon_xoffset+170-(p->look_ang>>1),looking_arc+196-gun_pos, - SHOTGUN+5,gs,o,pal); + SHOTGUN+5,gs,o,pal); break; case 20: case 21: case 22: case 23: G_DrawWeaponTile(64+weapon_xoffset+176-(p->look_ang>>1),looking_arc+196-gun_pos, - SHOTGUN+6,gs,o,pal); + SHOTGUN+6,gs,o,pal); break; case 24: case 25: case 26: case 27: G_DrawWeaponTile(64+weapon_xoffset+170-(p->look_ang>>1),looking_arc+196-gun_pos, - SHOTGUN+5,gs,o,pal); + SHOTGUN+5,gs,o,pal); break; case 28: case 29: case 30: G_DrawWeaponTile(32+weapon_xoffset+156-(p->look_ang>>1),looking_arc+206-gun_pos, - SHOTGUN+4,gs,o,pal); + SHOTGUN+4,gs,o,pal); break; } } @@ -2474,12 +2474,12 @@ void P_DisplayWeapon(int snum) if (*kb > 0 && sprite[p->i].pal != 1) weapon_xoffset += 1-(rand()&3); G_DrawWeaponTile(weapon_xoffset+168-(p->look_ang>>1),looking_arc+260-gun_pos, - CHAINGUN,gs,o,pal); + CHAINGUN,gs,o,pal); switch (*kb) { case 0: G_DrawWeaponTile(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos, - CHAINGUN+1,gs,o,pal); + CHAINGUN+1,gs,o,pal); break; default: if (*kb > *aplWeaponFireDelay[CHAINGUN_WEAPON] && *kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]) @@ -2487,21 +2487,21 @@ void P_DisplayWeapon(int snum) i = 0; if (sprite[p->i].pal != 1) i = rand()&7; G_DrawWeaponTile(i+weapon_xoffset-4+140-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos, - CHAINGUN+5+((*kb-4)/5),gs,o,pal); + CHAINGUN+5+((*kb-4)/5),gs,o,pal); if (sprite[p->i].pal != 1) i = rand()&7; G_DrawWeaponTile(i+weapon_xoffset-4+184-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos, - CHAINGUN+5+((*kb-4)/5),gs,o,pal); + CHAINGUN+5+((*kb-4)/5),gs,o,pal); } if (*kb < *aplWeaponTotalTime[CHAINGUN_WEAPON]-4) { i = rand()&7; G_DrawWeaponTile(i+weapon_xoffset-4+162-(p->look_ang>>1),i+looking_arc-((*kb)>>1)+208-gun_pos, - CHAINGUN+5+((*kb-2)/5),gs,o,pal); + CHAINGUN+5+((*kb-2)/5),gs,o,pal); G_DrawWeaponTile(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos, - CHAINGUN+1+((*kb)>>1),gs,o,pal); + CHAINGUN+1+((*kb)>>1),gs,o,pal); } else G_DrawWeaponTile(weapon_xoffset+178-(p->look_ang>>1),looking_arc+233-gun_pos, - CHAINGUN+1,gs,o,pal); + CHAINGUN+1,gs,o,pal); break; } } @@ -2709,21 +2709,21 @@ void P_DisplayWeapon(int snum) } G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, - o,2); + looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, + o,2); G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER-1,gs,o,pal); + looking_arc+240-gun_pos,SHRINKER-1,gs,o,pal); } else { G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+2, - 16-(sintable[p->random_club_frame&2047]>>10), - o,2); + looking_arc+240-gun_pos,SHRINKER+2, + 16-(sintable[p->random_club_frame&2047]>>10), + o,2); G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER-2,gs,o,pal); + looking_arc+240-gun_pos,SHRINKER-2,gs,o,pal); } } } @@ -2751,22 +2751,22 @@ void P_DisplayWeapon(int snum) } G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, - o,0); + looking_arc+240-gun_pos,SHRINKER+3+((*kb)&3),-32, + o,0); G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+1,gs,o,pal); + looking_arc+240-gun_pos,SHRINKER+1,gs,o,pal); } else { G_DrawWeaponTile(weapon_xoffset+184-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER+2, - 16-(sintable[p->random_club_frame&2047]>>10), - o,0); + looking_arc+240-gun_pos,SHRINKER+2, + 16-(sintable[p->random_club_frame&2047]>>10), + o,0); G_DrawWeaponTile(weapon_xoffset+188-(p->look_ang>>1), - looking_arc+240-gun_pos,SHRINKER,gs,o,pal); + looking_arc+240-gun_pos,SHRINKER,gs,o,pal); } } break; @@ -4080,7 +4080,7 @@ void P_ProcessInput(int snum) // not jumping or crouching - if (!TEST_SYNC_KEY(sb_snum, SK_JUMP|SK_CROUCH) && p->on_ground && (sector[psect].floorstat&2) && p->posz >= (fz-(i<<8)-(16<<8))) + if (!TEST_SYNC_KEY(sb_snum, SK_JUMP) && !TEST_SYNC_KEY(sb_snum, SK_CROUCH) && p->on_ground && (sector[psect].floorstat&2) && p->posz >= (fz-(i<<8)-(16<<8))) p->posz = fz-(i<<8); else { diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 4aca8cc6f..aa957891c 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -2584,7 +2584,7 @@ void G_HandleSharedKeys(int snum) } // j = sb_snum & ((15<<8)|(1<<12)|(1<<15)|(1<<16)|(1<<22)|(1<<19)|(1<<20)|(1<<21)|(1<<24)|(1<<25)|(1<<27)|(1<<28)|(1<<29)|(1<<30)|(1<<31)); - j = sb_snum & ((15<<8)|BIT(SK_STEROIDS)|BIT(SK_NIGHTVISION)|BIT(SK_MEDKIT)|BIT(SK_QUICK_KICK)| \ + j = sb_snum & ((15<interface_toggle_flag; @@ -2681,7 +2681,7 @@ void G_HandleSharedKeys(int snum) sb_snum |= BIT(SK_INV_LEFT); // emulate move left... } if (p->newowner == -1) - if (TEST_SYNC_KEY(sb_snum, SK_INV_LEFT|SK_INV_RIGHT)) + if (TEST_SYNC_KEY(sb_snum, SK_INV_LEFT) || TEST_SYNC_KEY(sb_snum, SK_INV_RIGHT)) { p->invdisptime = 26*2; diff --git a/polymer/eduke32/source/sounds.c b/polymer/eduke32/source/sounds.c index b0413dc0a..d7bd48917 100644 --- a/polymer/eduke32/source/sounds.c +++ b/polymer/eduke32/source/sounds.c @@ -194,37 +194,28 @@ void S_MenuSound(void) void _playmusic(const char *fn) { -#if defined(_WIN32) int fp, l; -#else - extern void MUSIC_PlayMusic(char *_filename); -#endif if (fn == NULL) return; if (ud.config.MusicToggle == 0) return; if (ud.config.MusicDevice < 0) return; -#if defined(_WIN32) + fp = kopen4loadfrommod((char *)fn,0); if (fp == -1) return; l = kfilelength(fp); MUSIC_StopSong(); - g_musicSize=0; - if (!MusicPtr) - MusicPtr=Bcalloc(1,l * sizeof(char)); + if (!MusicPtr) MusicPtr=Bcalloc(1,l * sizeof(char)); else MusicPtr=Brealloc(MusicPtr,l * sizeof(char)); g_musicSize=l; kread(fp, (unsigned char *)MusicPtr, l); kclose(fp); - MUSIC_PlaySong((unsigned char *)MusicPtr, MUSIC_LoopSong); -#else // FIXME: I need this to get the music volume initialized (not sure why) -- Jim Bentler MUSIC_SetVolume(ud.config.MusicVolume); - MUSIC_PlayMusic((char *)fn); -#endif + MUSIC_PlaySong((unsigned char *)MusicPtr, MUSIC_LoopSong); } int S_PlayMusic(const char *fn, const int sel)