diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 14e1a6dbc..5f7d8d695 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,12 @@ +March 30, 2008 (Changes by Graf Zahl) +- Fixed: The HIRESTEX parser didn't check if a graphic specified in a remap + command actually existed. +- Fixed: My $Limit fix from yesterday didn't work because NearLimit was + an unsigned byte and the comparisons with -1 didn't work. Made it a + signed word instead. +- Made sfxinfo_t::Link an unsigned int because it limited the amount of + usable sounds to 65535. + March 29, 2008 - Fixed: OPLMIDIDevice sent the wrong pitch wheel value to the player code. Missimp.mid sounds a lot better now, though still a little off. diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index 3ab80215f..c38744e9d 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -535,7 +535,7 @@ static int S_AddSound (const char *logicalname, int lumpnum, FScanner *sc) sfx->bRandomHeader = false; sfx->link = sfxinfo_t::NO_LINK; sfx->bTentative = false; - if (sfx->NearLimit == (BYTE)-1) sfx->NearLimit = 2; + if (sfx->NearLimit == -1) sfx->NearLimit = 2; //sfx->PitchMask = CurrentPitchMask; } else @@ -1579,7 +1579,7 @@ static int S_LookupPlayerSound (int classidx, int gender, int refid) // If we're not done parsing SNDINFO yet, assume that the target sound is valid if (PlayerClassesIsSorted && (sndnum == 0 || - ((S_sfx[sndnum].lumpnum == -1 || S_sfx[sndnum].lumpnum == sfx_empty) && S_sfx[sndnum].link == 0xffff))) + ((S_sfx[sndnum].lumpnum == -1 || S_sfx[sndnum].lumpnum == sfx_empty) && S_sfx[sndnum].link == sfxinfo_t::NO_LINK))) { // This sound is unavailable. if (ingender != 0) { // Try "male" diff --git a/src/s_sound.h b/src/s_sound.h index f5ab57e35..f7156ec3a 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -44,7 +44,7 @@ struct sfxinfo_t float Volume; BYTE PitchMask; - BYTE NearLimit; // 0 means unlimited + SWORD NearLimit; // 0 means unlimited WORD bRandomHeader:1; WORD bPlayerReserve:1; @@ -58,8 +58,8 @@ struct sfxinfo_t WORD bTentative:1; WORD RolloffType:2; - WORD link; - enum { NO_LINK = 0xffff }; + unsigned int link; + enum { NO_LINK = 0xffffffff }; float MinDistance; union { float MaxDistance, RolloffFactor; }; diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 9889e0dd1..980360cbd 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -79,6 +79,7 @@ FTexture * FTexture::CreateTexture (int lumpnum, int usetype) { FAutomapTexture::Check, FAutomapTexture::Create, TEX_Autopage }, }; + if (lumpnum == -1) return NULL; FWadLump data = Wads.OpenLumpNum (lumpnum); diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index f90a852a2..114657eb3 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -455,8 +455,11 @@ void FTextureManager::AddHiresTextures (int wadnum) { // A texture with this name does not yet exist FTexture * newtex = FTexture::CreateTexture (firsttx, FTexture::TEX_Any); - newtex->UseType=FTexture::TEX_Override; - AddTexture(newtex); + if (newtex != NULL) + { + newtex->UseType=FTexture::TEX_Override; + AddTexture(newtex); + } } else { @@ -537,6 +540,11 @@ void FTextureManager::LoadHiresTex(int wadnum) Printf("Attempting to remap non-existent texture %s to %s\n", texname.GetChars(), sc.String); } + else if (lumpnum == -1) + { + Printf("Attempting to remap texture %s to non-existent lump %s\n", + texname.GetChars(), sc.String); + } else { for(unsigned int i = 0; i < tlist.Size(); i++) @@ -572,7 +580,6 @@ void FTextureManager::LoadHiresTex(int wadnum) memcpy(src, sc.String, 8); int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics); - if (lumpnum < 0) lumpnum = Wads.CheckNumForName(sc.String, ns_graphics); sc.GetString(); is32bit = !!sc.Compare("force32bit");