From 6cd1e2ce6a4cf39729f6fa2840e9939b53149790 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 16 May 2006 04:19:20 +0000 Subject: [PATCH] - Fixed: CopyPlayer() in p_saveg.cpp should use normal assignment, not memcpy to copy the player structures. - Fixed compilation with MinGW again and removed most of the new warnings. And following is the log that I forgot to paste in for the previous commit: - Changed the memory management for FString. Instead of using a garbage collected heap, it now uses normal heap calls and reference counting to implement lazy copying. You may now use bitwise operators to move (but not copy!) FStrings around in memory. This means that the CopyForTArray template function is gone, since TArrays can now freely move their contents around without bothering with their specifics. There is one important caveat, however. It is not acceptable to blindly 0 an FString's contents. This necessitated the creation of a proper constructor for player_s so that it can be reset without using memset. I did a quick scan of all memsets in the source and didn't see anything else with a similar problem, but it's possible I missed something. - Fixed: Build tiles were never deallocated. - Fixed: Using Build's palette.dat only got half the palette right. SVN r117 (trunk) --- Makefile.mgw | 6 +++--- Makefile.mingw | 25 +--------------------- docs/rh-log.txt | 3 +++ src/am_map.cpp | 7 ++++--- src/c_console.cpp | 6 +++--- src/d_dehacked.cpp | 2 +- src/d_main.cpp | 2 +- src/dobject.cpp | 6 +++--- src/farchive.cpp | 5 ++--- src/g_level.cpp | 5 +++-- src/g_shared/a_keys.cpp | 2 +- src/m_options.cpp | 7 ++++--- src/p_effect.cpp | 2 +- src/p_mobj.cpp | 3 +-- src/p_saveg.cpp | 3 +-- src/p_terrain.cpp | 45 +++++++++++++++++++++------------------- src/r_data.cpp | 2 +- src/thingdef.cpp | 5 +++++ src/thingdef_codeptr.cpp | 6 +++--- src/v_palette.h | 4 ++-- tools/makewad/Makefile | 11 ++++++++-- tools/makewad/makewad.c | 5 ----- tools/makewad/zip.c | 4 ++-- wadsrc/Makefile.mgw | 6 +++--- 24 files changed, 81 insertions(+), 91 deletions(-) diff --git a/Makefile.mgw b/Makefile.mgw index 32e8a1aee..5ec4febfd 100644 --- a/Makefile.mgw +++ b/Makefile.mgw @@ -31,9 +31,9 @@ cleanexe: clean: @$(MAKE) -C tools/lemon -f Makefile.mgw clean @$(MAKE) -C tools/re2c -f Makefile.mgw clean - @$(MAKE) -C tools/dehsupp -f Makefile.mgw clean - @$(MAKE) -C tools/makewad -f Makefile.mgw clean - @$(MAKE) -C tools/xlatcc -f Makefile.mgw clean + @$(MAKE) -C tools/dehsupp -f Makefile clean + @$(MAKE) -C tools/makewad -f Makefile clean + @$(MAKE) -C tools/xlatcc -f Makefile clean @$(MAKE) -C wadsrc -f Makefile.mgw clean @$(MAKE) -C . -f Makefile.mingw clean @$(MAKE) -C zlib -f Makefile.mgw clean diff --git a/Makefile.mingw b/Makefile.mingw index ecdce9da3..d49b5b379 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -90,6 +90,7 @@ OBJECTS += \ $(OBJDIR)/decallib.o \ $(OBJDIR)/decorations.o \ $(OBJDIR)/dobject.o \ + $(OBJDIR)/dobjtype.o \ $(OBJDIR)/doomdef.o \ $(OBJDIR)/doomstat.o \ $(OBJDIR)/dsectoreffect.o \ @@ -190,7 +191,6 @@ OBJECTS += \ $(OBJDIR)/vectors.o \ $(OBJDIR)/name.o \ $(OBJDIR)/zstring.o \ - $(OBJDIR)/zstringpool.o \ $(OBJDIR)/zstrformat.o \ $(OBJDIR)/w_wad.o \ $(OBJDIR)/wi_stuff.o \ @@ -201,12 +201,8 @@ OBJECTS += \ $(OBJDIR)/a_cacodemon.o \ $(OBJDIR)/a_cyberdemon.o \ $(OBJDIR)/a_demon.o \ - $(OBJDIR)/a_doomarmor.o \ - $(OBJDIR)/a_doomartifacts.o \ - $(OBJDIR)/a_doomdecorations.o \ $(OBJDIR)/a_doomhealth.o \ $(OBJDIR)/a_doomimp.o \ - $(OBJDIR)/a_doomkeys.o \ $(OBJDIR)/a_doommisc.o \ $(OBJDIR)/a_doomplayer.o \ $(OBJDIR)/a_doomweaps.o \ @@ -223,9 +219,7 @@ OBJECTS += \ $(OBJDIR)/a_chicken.o \ $(OBJDIR)/a_clink.o \ $(OBJDIR)/a_dsparil.o \ - $(OBJDIR)/a_hereticarmor.o \ $(OBJDIR)/a_hereticartifacts.o \ - $(OBJDIR)/a_hereticdecorations.o \ $(OBJDIR)/a_hereticimp.o \ $(OBJDIR)/a_heretickeys.o \ $(OBJDIR)/a_hereticmisc.o \ @@ -257,14 +251,10 @@ OBJECTS += \ $(OBJDIR)/a_fighterplayer.o \ $(OBJDIR)/a_fighterquietus.o \ $(OBJDIR)/a_firedemon.o \ - $(OBJDIR)/a_flame.o \ $(OBJDIR)/a_flechette.o \ $(OBJDIR)/a_fog.o \ $(OBJDIR)/a_healingradius.o \ $(OBJDIR)/a_heresiarch.o \ - $(OBJDIR)/a_hexenarmor.o \ - $(OBJDIR)/a_hexendecorations.o \ - $(OBJDIR)/a_hexenkeys.o \ $(OBJDIR)/a_hexenspecialdecs.o \ $(OBJDIR)/a_iceguy.o \ $(OBJDIR)/a_korax.o \ @@ -277,9 +267,7 @@ OBJECTS += \ $(OBJDIR)/a_mana.o \ $(OBJDIR)/a_pig.o \ $(OBJDIR)/a_puzzleitems.o \ - $(OBJDIR)/a_scriptprojectiles.o \ $(OBJDIR)/a_serpent.o \ - $(OBJDIR)/a_speedboots.o \ $(OBJDIR)/a_spike.o \ $(OBJDIR)/a_summon.o \ $(OBJDIR)/a_teleportother.o \ @@ -291,39 +279,29 @@ OBJECTS += \ $(OBJDIR)/a_artitele.o \ $(OBJDIR)/a_minotaur.o \ $(OBJDIR)/a_ravenambient.o \ - $(OBJDIR)/a_ravenartifacts.o \ - $(OBJDIR)/a_ravenhealth.o \ $(OBJDIR)/a_acolyte.o \ $(OBJDIR)/a_alienspectres.o \ - $(OBJDIR)/a_beggars.o \ $(OBJDIR)/a_coin.o \ $(OBJDIR)/a_crusader.o \ $(OBJDIR)/a_entityboss.o \ $(OBJDIR)/a_inquisitor.o \ $(OBJDIR)/a_loremaster.o \ $(OBJDIR)/a_macil.o \ - $(OBJDIR)/a_merchants.o \ $(OBJDIR)/a_oracle.o \ - $(OBJDIR)/a_peasant.o \ $(OBJDIR)/a_programmer.o \ - $(OBJDIR)/a_questitems.o \ - $(OBJDIR)/a_ratbuddy.o \ $(OBJDIR)/a_reaver.o \ $(OBJDIR)/a_rebels.o \ $(OBJDIR)/a_sentinel.o \ $(OBJDIR)/a_spectral.o \ $(OBJDIR)/a_stalker.o \ $(OBJDIR)/a_strifeammo.o \ - $(OBJDIR)/a_strifearmor.o \ $(OBJDIR)/a_strifebishop.o \ $(OBJDIR)/a_strifeitems.o \ - $(OBJDIR)/a_strifekeys.o \ $(OBJDIR)/a_strifeplayer.o \ $(OBJDIR)/a_strifestuff.o \ $(OBJDIR)/a_strifeweapons.o \ $(OBJDIR)/a_templar.o \ $(OBJDIR)/a_thingstoblowup.o \ - $(OBJDIR)/a_zombie.o \ $(OBJDIR)/strife_sbar.o \ $(OBJDIR)/a_action.o \ $(OBJDIR)/a_artifacts.o \ @@ -346,7 +324,6 @@ OBJECTS += \ $(OBJDIR)/a_soundenvironment.o \ $(OBJDIR)/a_soundsequence.o \ $(OBJDIR)/a_spark.o \ - $(OBJDIR)/a_splashes.o \ $(OBJDIR)/a_waterzone.o \ $(OBJDIR)/a_weapons.o \ $(OBJDIR)/hudmessages.o \ diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 219c58bdb..1d82617f4 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ May 15, 2006 +- Fixed: CopyPlayer() in p_saveg.cpp should use normal assignment, not + memcpy to copy the player structures. +- Fixed compilation with MinGW again and removed most of the new warnings. - Changed the memory management for FString. Instead of using a garbage collected heap, it now uses normal heap calls and reference counting to implement lazy copying. You may now use bitwise operators to move diff --git a/src/am_map.cpp b/src/am_map.cpp index 646e82095..058aee353 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -752,10 +752,11 @@ static void AM_initColors (BOOL overlayed) int red = (int)(backRed * back + foreRed * fore); int green = (int)(backGreen * back + foreGreen * fore); int blue = (int)(backGreen * back + foreBlue * fore); - if (palette) +// [RH] What was I thinking here? +// if (palette) antialias[alias][i] = ColorMatcher.Pick (red, green, blue); - else - antialias[alias][i] = MAKERGB(red, green, blue); +// else +// antialias[alias][i] = MAKERGB(red, green, blue); } *(aliasedLines[alias].color) = aliasedLines[alias].falseColor; } diff --git a/src/c_console.cpp b/src/c_console.cpp index 5a13c79a7..f3f52d561 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -1971,7 +1971,7 @@ static void C_TabComplete (bool goForward) } else { // Find the last matching tab, then go one past it. - while (++TabPos < TabCommands.Size()) + while (++TabPos < (int)TabCommands.Size()) { if (FindDiffPoint (TabCommands[TabPos].TabName, (char *)(CmdLine + TabStart)) < TabSize) { @@ -1986,7 +1986,7 @@ static void C_TabComplete (bool goForward) } } - if ((goForward && ++TabPos == TabCommands.Size()) || + if ((goForward && ++TabPos == (int)TabCommands.Size()) || (!goForward && --TabPos < 0)) { TabbedLast = false; @@ -2022,7 +2022,7 @@ static bool C_TabCompleteList () nummatches = 0; maxwidth = 0; - for (i = TabPos; i < TabCommands.Size(); ++i) + for (i = TabPos; i < (int)TabCommands.Size(); ++i) { if (FindDiffPoint (TabCommands[i].TabName, (char *)(CmdLine + TabStart)) < TabSize) { diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index da341e122..3ef40ec0d 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1336,7 +1336,7 @@ static int PatchAmmo (int ammoNum) // Fix per-ammo/max-ammo amounts for descendants of the base ammo class if (oldclip != *per) { - for (int i = 0; i < PClass::m_Types.Size(); ++i) + for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i) { PClass *type = PClass::m_Types[i]; diff --git a/src/d_main.cpp b/src/d_main.cpp index d6c19ebbf..837d5b892 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1559,7 +1559,7 @@ static EIWADType IdentifyVersion (const char *zdoom_wad) for (i = numwads = 0; i < sizeof(IWADNames)/sizeof(char *); i++) { - if (wads[i].Path != NULL) + if (!wads[i].Path.IsEmpty()) { if (i != numwads) { diff --git a/src/dobject.cpp b/src/dobject.cpp index 75351be01..e460045d7 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -295,7 +295,7 @@ CCMD (dumpclasses) } }; - int i; + unsigned int i; int shown, omitted; DumpInfo *tree = NULL; const PClass *root = NULL; @@ -499,7 +499,7 @@ void DObject::PointerSubstitution (DObject *old, DObject *notOld) players[i].FixPointers (old, notOld); } - for (i = 0; i < numsectors; ++i) + for (i = 0; i < (unsigned int)numsectors; ++i) { if (sectors[i].SoundTarget == old) { @@ -582,7 +582,7 @@ void DObject::DestroyScan () } } - for (i = 0; i < numsectors; ++i) + for (i = 0; i < (unsigned int)numsectors; ++i) { j = destroycount; do diff --git a/src/farchive.cpp b/src/farchive.cpp index 0b4fce966..2a1b3230b 100644 --- a/src/farchive.cpp +++ b/src/farchive.cpp @@ -628,7 +628,7 @@ FArchive::FArchive (FFile &file) void FArchive::AttachToFile (FFile &file) { - int i; + unsigned int i; m_HubTravel = false; m_File = &file; @@ -1349,7 +1349,6 @@ const PClass *FArchive::ReadClass () ~String() { if (val) delete[] val; } char *val; } typeName; - int i; if (m_ClassCount >= PClass::m_Types.Size()) { @@ -1360,7 +1359,7 @@ const PClass *FArchive::ReadClass () FName zaname(typeName.val, true); if (zaname != NAME_None) { - for (i = 0; i < PClass::m_Types.Size(); i++) + for (unsigned int i = 0; i < PClass::m_Types.Size(); i++) { if (PClass::m_Types[i]->TypeName == zaname) { diff --git a/src/g_level.cpp b/src/g_level.cpp index 735d87f9f..fcd0cd866 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -80,8 +80,9 @@ EXTERN_CVAR (Float, sv_gravity) EXTERN_CVAR (Float, sv_aircontrol) EXTERN_CVAR (Int, disableautosave) -#define lioffset(x) myoffsetof(level_info_t,x) -#define cioffset(x) myoffsetof(cluster_info_t,x) +// Hey, GCC, these macros better be safe! +#define lioffset(x) ((size_t)&((level_info_t*)1)->x - 1) +#define cioffset(x) ((size_t)&((cluster_info_t*)1)->x - 1) #define SNAP_ID MAKE_ID('s','n','A','p') #define VIST_ID MAKE_ID('v','i','S','t') diff --git a/src/g_shared/a_keys.cpp b/src/g_shared/a_keys.cpp index 36287f837..7e565b08d 100644 --- a/src/g_shared/a_keys.cpp +++ b/src/g_shared/a_keys.cpp @@ -293,7 +293,7 @@ static void ParseLock() static void ClearLocks() { - int i; + unsigned int i; for(i=0;iIsDescendantOf(RUNTIME_CLASS(AKey))) diff --git a/src/m_options.cpp b/src/m_options.cpp index 3f8be0c78..2573e3b90 100644 --- a/src/m_options.cpp +++ b/src/m_options.cpp @@ -1171,10 +1171,11 @@ static byte BitTranslate[16]; void M_OptInit (void) { - int currval = 0, dummy1, dummy2, i; + int dummy1, dummy2; + size_t currval = 0; char name[24]; - for (i = 1; i < 32 && currval < countof(Depths); i++) + for (unsigned int i = 1; i < 32 && currval < countof(Depths); i++) { I_StartModeIterator (i); if (I_NextMode (&dummy1, &dummy2, NULL)) @@ -3049,7 +3050,7 @@ CCMD (addmenukey) void M_Deinit () { // Free bitdepth names for the modes menu. - for (int i = 0; i < countof(Depths); ++i) + for (size_t i = 0; i < countof(Depths); ++i) { if (Depths[i].name != NULL) { diff --git a/src/p_effect.cpp b/src/p_effect.cpp index 15e8d493e..3e8dcbaec 100644 --- a/src/p_effect.cpp +++ b/src/p_effect.cpp @@ -442,7 +442,7 @@ void P_DrawRailTrail (AActor * source, vec3_t start, vec3_t end, int color1, int // Allow other sounds than 'weapons/railgf'! if (!source->player) sound = source->AttackSound; else if (source->player->ReadyWeapon) sound = source->player->ReadyWeapon->AttackSound; - else sound = NULL; + else sound = 0; if (!sound) sound=S_FindSound("weapons/railgf"); // The railgun's sound is special. It gets played from the diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3d8048c19..bf6e5184d 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3296,7 +3296,6 @@ void P_SpawnPlayer (mapthing2_t *mthing) int playernum; player_t *p; APlayerPawn *mobj, *oldactor; - int i; BYTE state; // [RH] Things 4001-? are also multiplayer starts. Just like 1-4. @@ -3433,7 +3432,7 @@ void P_SpawnPlayer (mapthing2_t *mthing) // give all cards in death match mode if (deathmatch) { - for (i = 0; i < PClass::m_Types.Size(); ++i) + for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i) { if (PClass::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey))) { diff --git a/src/p_saveg.cpp b/src/p_saveg.cpp index afbd81909..8dd7d5f15 100644 --- a/src/p_saveg.cpp +++ b/src/p_saveg.cpp @@ -122,7 +122,6 @@ static void ReadOnePlayer (FArchive &arc) { didIt = true; player_t playerTemp; - memset (&playerTemp, 0, sizeof(playerTemp)); playerTemp.Serialize (arc); CopyPlayer (&players[i], &playerTemp, name); } @@ -227,7 +226,7 @@ static void CopyPlayer (player_t *dst, player_t *src, const char *name) // The userinfo needs to be saved for real players, but it // needs to come from the save for bots. userinfo_t uibackup = dst->userinfo; - memcpy (dst, src, sizeof(player_t)); + *dst = *src; if (dst->isbot) { diff --git a/src/p_terrain.cpp b/src/p_terrain.cpp index 77ceba454..0c49d026b 100644 --- a/src/p_terrain.cpp +++ b/src/p_terrain.cpp @@ -198,36 +198,39 @@ static const char *DamageKeywords[] = NULL }; +// Alternate offsetof macro to shut GCC up +#define theoffsetof(type,field) ((size_t)&((type*)1)->field - 1) + static FGenericParse SplashParser[] = { { GEN_End, {0} }, - { GEN_Sound, {myoffsetof(FSplashDef, SmallSplashSound)} }, - { GEN_Fixed, {myoffsetof(FSplashDef, SmallSplashClip)} }, - { GEN_Sound, {myoffsetof(FSplashDef, NormalSplashSound)} }, - { GEN_Class, {myoffsetof(FSplashDef, SmallSplash)} }, - { GEN_Class, {myoffsetof(FSplashDef, SplashBase)} }, - { GEN_Class, {myoffsetof(FSplashDef, SplashChunk)} }, - { GEN_Byte, {myoffsetof(FSplashDef, ChunkXVelShift)} }, - { GEN_Byte, {myoffsetof(FSplashDef, ChunkYVelShift)} }, - { GEN_Byte, {myoffsetof(FSplashDef, ChunkZVelShift)} }, - { GEN_Fixed, {myoffsetof(FSplashDef, ChunkBaseZVel)} }, - { GEN_Bool, {myoffsetof(FSplashDef, NoAlert)} } + { GEN_Sound, {theoffsetof(FSplashDef, SmallSplashSound)} }, + { GEN_Fixed, {theoffsetof(FSplashDef, SmallSplashClip)} }, + { GEN_Sound, {theoffsetof(FSplashDef, NormalSplashSound)} }, + { GEN_Class, {theoffsetof(FSplashDef, SmallSplash)} }, + { GEN_Class, {theoffsetof(FSplashDef, SplashBase)} }, + { GEN_Class, {theoffsetof(FSplashDef, SplashChunk)} }, + { GEN_Byte, {theoffsetof(FSplashDef, ChunkXVelShift)} }, + { GEN_Byte, {theoffsetof(FSplashDef, ChunkYVelShift)} }, + { GEN_Byte, {theoffsetof(FSplashDef, ChunkZVelShift)} }, + { GEN_Fixed, {theoffsetof(FSplashDef, ChunkBaseZVel)} }, + { GEN_Bool, {theoffsetof(FSplashDef, NoAlert)} } }; static FGenericParse TerrainParser[] = { { GEN_End, {0} }, - { GEN_Splash, {myoffsetof(FTerrainDef, Splash)} }, - { GEN_Int, {myoffsetof(FTerrainDef, DamageAmount)} }, + { GEN_Splash, {theoffsetof(FTerrainDef, Splash)} }, + { GEN_Int, {theoffsetof(FTerrainDef, DamageAmount)} }, { GEN_Custom, {(size_t)ParseDamage} }, - { GEN_Int, {myoffsetof(FTerrainDef, DamageTimeMask)} }, - { GEN_Fixed, {myoffsetof(FTerrainDef, FootClip)} }, - { GEN_Float, {myoffsetof(FTerrainDef, StepVolume)} }, - { GEN_Time, {myoffsetof(FTerrainDef, WalkStepTics)} }, - { GEN_Time, {myoffsetof(FTerrainDef, RunStepTics)} }, - { GEN_Sound, {myoffsetof(FTerrainDef, LeftStepSound)} }, - { GEN_Sound, {myoffsetof(FTerrainDef, RightStepSound)} }, - { GEN_Bool, {myoffsetof(FTerrainDef, IsLiquid)} }, + { GEN_Int, {theoffsetof(FTerrainDef, DamageTimeMask)} }, + { GEN_Fixed, {theoffsetof(FTerrainDef, FootClip)} }, + { GEN_Float, {theoffsetof(FTerrainDef, StepVolume)} }, + { GEN_Time, {theoffsetof(FTerrainDef, WalkStepTics)} }, + { GEN_Time, {theoffsetof(FTerrainDef, RunStepTics)} }, + { GEN_Sound, {theoffsetof(FTerrainDef, LeftStepSound)} }, + { GEN_Sound, {theoffsetof(FTerrainDef, RightStepSound)} }, + { GEN_Bool, {theoffsetof(FTerrainDef, IsLiquid)} }, { GEN_Custom, {(size_t)ParseFriction} } }; diff --git a/src/r_data.cpp b/src/r_data.cpp index a287ac7cb..44599a94e 100644 --- a/src/r_data.cpp +++ b/src/r_data.cpp @@ -2793,7 +2793,7 @@ void R_InitBuildTiles () break; } - int len = Q_filelength (f); + size_t len = Q_filelength (f); BYTE *art = new BYTE[len]; if (fread (art, 1, len, f) != len || LittleLong(*(DWORD *)art) != 1) { diff --git a/src/thingdef.cpp b/src/thingdef.cpp index a27df016d..3167f4fa8 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -1744,6 +1744,11 @@ do_stop: case 'y': v = ParseExpression (true); break; + + default: + assert(false); + v = -1; + break; } StateParameters[paramindex++]=v; params++; diff --git a/src/thingdef_codeptr.cpp b/src/thingdef_codeptr.cpp index 86154559e..4d63057a4 100644 --- a/src/thingdef_codeptr.cpp +++ b/src/thingdef_codeptr.cpp @@ -1084,7 +1084,7 @@ void A_SpawnItem(AActor * self) if (index<0) return; const PClass * missile= PClass::FindClass((ENamedName)StateParameters[index]); - fixed_t distance = EvalExpressionF (StateParameters[index+1], self); + fixed_t distance = fixed_t(EvalExpressionF (StateParameters[index+1], self) * FRACUNIT); fixed_t zheight = fixed_t(EvalExpressionF (StateParameters[index+2], self) * FRACUNIT); bool useammo = EvalExpressionN (StateParameters[index+3], self); @@ -1481,8 +1481,8 @@ void A_SetBlend(AActor * self) int tics = EvalExpressionI (StateParameters[index+2], self); PalEntry color2 = StateParameters[index+3]; - if (color==-1) color=0; - if (color2==-1) color2=0; + if (color == MAKEARGB(255,255,255,255)) color=0; + if (color2 == MAKEARGB(255,255,255,255)) color2=0; if (!color2.a) color2 = color; diff --git a/src/v_palette.h b/src/v_palette.h index 1c80f5b33..f26af408c 100644 --- a/src/v_palette.h +++ b/src/v_palette.h @@ -37,8 +37,8 @@ #include "doomtype.h" #include "r_main.h" -#define MAKERGB(r,g,b) (((r)<<16)|((g)<<8)|(b)) -#define MAKEARGB(a,r,g,b) (((a)<<24)|((r)<<16)|((g)<<8)|(b)) +#define MAKERGB(r,g,b) DWORD(((r)<<16)|((g)<<8)|(b)) +#define MAKEARGB(a,r,g,b) DWORD(((a)<<24)|((r)<<16)|((g)<<8)|(b)) #define APART(c) (((c)>>24)&0xff) #define RPART(c) (((c)>>16)&0xff) diff --git a/tools/makewad/Makefile b/tools/makewad/Makefile index cffdbedda..145831cb8 100644 --- a/tools/makewad/Makefile +++ b/tools/makewad/Makefile @@ -3,11 +3,13 @@ ifeq (Windows_NT,$(OS)) CCDV = @../../ccdv CFLAGS = -Os -Wall -fomit-frame-pointer LDFLAGS = -L../../zlib/ -lz + ZLIB = ../../zlib/libz.a else EXE = makewad CCDV = CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer LDFLAGS = -lz + ZLIB = endif CC = gcc @@ -19,8 +21,13 @@ all: $(EXE) .c.o: $(CCDV) $(CC) $(CFLAGS) -c -o $@ $< -$(EXE): $(OBJS) - $(CCDV) $(CC) $(LDFLAGS) -o $(EXE) $(OBJS) +$(EXE): $(OBJS) $(ZLIB) + $(CCDV) $(CC) -o $(EXE) $(OBJS) $(LDFLAGS) + +ifeq (Windows_NT,$(OS)) +$(ZLIB): + make -C ../../zlib -f Makefile.mgw +endif .PHONY: clean diff --git a/tools/makewad/makewad.c b/tools/makewad/makewad.c index fdb01b42a..b4d05827b 100644 --- a/tools/makewad/makewad.c +++ b/tools/makewad/makewad.c @@ -107,7 +107,6 @@ int appendtozip (zipFile zipfile, const char * zipname, const char *filename) char *readbuf; FILE *lumpfile; size_t readlen; - int ret = 0; size_t len; zip_fileinfo zip_inf; @@ -451,10 +450,6 @@ int buildwad (FILE *listfile, char *listfilename, char *makecmd, char *makefile) return ret; } -#if !defined(_MSC_VER) -#define __cdecl -#endif - int __cdecl main (int argc, char **argv) { FILE *listfile = NULL; diff --git a/tools/makewad/zip.c b/tools/makewad/zip.c index 3e0e12689..197c500de 100644 --- a/tools/makewad/zip.c +++ b/tools/makewad/zip.c @@ -189,14 +189,14 @@ local void init_linkedlist(ll) { ll->first_block = ll->last_block = NULL; } - +/* local void free_linkedlist(ll) linkedlist_data* ll; { free_datablock(ll->first_block); ll->first_block = ll->last_block = NULL; } - +*/ local int add_data_in_datablock(ll,buf,len) linkedlist_data* ll; diff --git a/wadsrc/Makefile.mgw b/wadsrc/Makefile.mgw index 00c5cf5e1..fbba69ba8 100644 --- a/wadsrc/Makefile.mgw +++ b/wadsrc/Makefile.mgw @@ -13,10 +13,10 @@ clean: del /q /f wadmake zdoom.pk3 xlat\*.x dehsupp.lmp 2>nul ../tools/makewad/makewad.exe: - $(MAKE) -C ../tools/makewad -f Makefile.mgw + $(MAKE) -C ../tools/makewad -f Makefile ../tools/xlatcc/xlatcc.exe: - $(MAKE) -C ../tools/xlatcc -f Makefile.mgw + $(MAKE) -C ../tools/xlatcc -f Makefile ../tools/dehsupp/dehsupp.exe: - $(MAKE) -C ../tools/dehsupp -f Makefile.mgw + $(MAKE) -C ../tools/dehsupp -f Makefile