From 5b8055bfc7fbab9182f7c66059eae4706a0c895c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 20 May 2008 04:02:49 +0000 Subject: [PATCH] - Since KDIZD is the only mapset I know of that used reverb, and it didn't define any new ones of its own, I'm pre-emptively renaming the SNDEAX lump to REVERBS to remove any possible misunderstanding that this is something that requires EAX hardware support. (Ideally, it would have been REVERBDEF, but that's 10 characters long.) The eaxedit console command has also been renamed to reverbedit for the same reason. - Fixed: The Palette part of FRemapTable was not initialized with alpha values other than 0. I'm not sure if it would be better to fix this in the game palette that it copies from or not, but right now, they get set unconditionally to 255. SVN r983 (trunk) --- docs/rh-log.txt | 10 ++++++ src/g_shared/a_soundenvironment.cpp | 2 +- src/m_menu.cpp | 6 ++-- src/r_translate.cpp | 22 +++++++----- src/s_environment.cpp | 56 ++++++++++++++--------------- src/s_sound.cpp | 2 +- src/s_sound.h | 4 +-- src/win32/eaxedit.cpp | 2 +- src/win32/zdoom.rc | 4 +-- wadsrc/{sndeax.txt => reverbs.txt} | 0 wadsrc/wadsrc.vcproj | 2 +- wadsrc/zdoom.lst | 2 +- 12 files changed, 63 insertions(+), 49 deletions(-) rename wadsrc/{sndeax.txt => reverbs.txt} (100%) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index e9964b3e1a..1c1df6b5be 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,14 @@ May 19, 2008 +- Since KDIZD is the only mapset I know of that used reverb, and it didn't + define any new ones of its own, I'm pre-emptively renaming the SNDEAX lump + to REVERBS to remove any possible misunderstanding that this is something + that requires EAX hardware support. (Ideally, it would have been REVERBDEF, + but that's 10 characters long.) The eaxedit console command has also been + renamed to reverbedit for the same reason. +- Fixed: The Palette part of FRemapTable was not initialized with alpha values + other than 0. I'm not sure if it would be better to fix this in the game + palette that it copies from or not, but right now, they get set + unconditionally to 255. - Fixed: M_DrawSave() and M_DrawLoad() need to use GetScaledWidth(), in case the texture is high-res. - Replaced all instances of "flags +=" in sbarinfo_parser.cpp with "flags |=" diff --git a/src/g_shared/a_soundenvironment.cpp b/src/g_shared/a_soundenvironment.cpp index 77fdef3310..eb3f2deb5e 100644 --- a/src/g_shared/a_soundenvironment.cpp +++ b/src/g_shared/a_soundenvironment.cpp @@ -1,6 +1,6 @@ /* ** a_soundenvironment.cpp -** Actor that controls the EAX settings in its zone +** Actor that controls the reverb settings in its zone ** **--------------------------------------------------------------------------- ** Copyright 1998-2006 Randy Heit diff --git a/src/m_menu.cpp b/src/m_menu.cpp index 423c6948e5..0aa8898d17 100644 --- a/src/m_menu.cpp +++ b/src/m_menu.cpp @@ -930,8 +930,8 @@ void M_DrawLoad (void) { FTexture *title = TexMan["M_LOADG"]; screen->DrawTexture (title, - (SCREENWIDTH-title->GetScaledWidth()*CleanXfac)/2, 20*CleanYfac, - DTA_CleanNoMove, true, DTA_BilinearFilter, true, TAG_DONE); + (SCREENWIDTH - title->GetScaledWidth()*CleanXfac)/2, 20*CleanYfac, + DTA_CleanNoMove, true, TAG_DONE); } else { @@ -1293,7 +1293,7 @@ void M_DrawSave() { FTexture *title = TexMan["M_SAVEG"]; screen->DrawTexture (title, - (SCREENWIDTH-title->GetWidth()*CleanXfac)/2, 20*CleanYfac, + (SCREENWIDTH-title->GetScaledWidth()*CleanXfac)/2, 20*CleanYfac, DTA_CleanNoMove, true, TAG_DONE); } else diff --git a/src/r_translate.cpp b/src/r_translate.cpp index 04aa4f88e0..dcc7418c73 100644 --- a/src/r_translate.cpp +++ b/src/r_translate.cpp @@ -371,9 +371,9 @@ void R_InitTranslationTables () translationtables[TRANSLATION_Standard][1]->Remap[i] = 0x40 + (i&0xf); translationtables[TRANSLATION_Standard][2]->Remap[i] = 0x20 + (i&0xf); - translationtables[TRANSLATION_Standard][0]->Palette[i] = GPalette.BaseColors[0x60 + (i&0xf)]; - translationtables[TRANSLATION_Standard][1]->Palette[i] = GPalette.BaseColors[0x40 + (i&0xf)]; - translationtables[TRANSLATION_Standard][2]->Palette[i] = GPalette.BaseColors[0x20 + (i&0xf)]; + translationtables[TRANSLATION_Standard][0]->Palette[i] = GPalette.BaseColors[0x60 + (i&0xf)] | MAKEARGB(255,0,0,0); + translationtables[TRANSLATION_Standard][1]->Palette[i] = GPalette.BaseColors[0x40 + (i&0xf)] | MAKEARGB(255,0,0,0); + translationtables[TRANSLATION_Standard][2]->Palette[i] = GPalette.BaseColors[0x20 + (i&0xf)] | MAKEARGB(255,0,0,0); } } else if (gameinfo.gametype == GAME_Heretic) @@ -384,9 +384,9 @@ void R_InitTranslationTables () translationtables[TRANSLATION_Standard][1]->Remap[i] = 145+(i-225); // red translationtables[TRANSLATION_Standard][2]->Remap[i] = 190+(i-225); // blue - translationtables[TRANSLATION_Standard][0]->Palette[i] = GPalette.BaseColors[114+(i-225)]; - translationtables[TRANSLATION_Standard][1]->Palette[i] = GPalette.BaseColors[145+(i-225)]; - translationtables[TRANSLATION_Standard][2]->Palette[i] = GPalette.BaseColors[190+(i-225)]; + translationtables[TRANSLATION_Standard][0]->Palette[i] = GPalette.BaseColors[114+(i-225)] | MAKEARGB(255,0,0,0); + translationtables[TRANSLATION_Standard][1]->Palette[i] = GPalette.BaseColors[145+(i-225)] | MAKEARGB(255,0,0,0); + translationtables[TRANSLATION_Standard][2]->Palette[i] = GPalette.BaseColors[190+(i-225)] | MAKEARGB(255,0,0,0); } } else if (gameinfo.gametype == GAME_Strife) @@ -444,7 +444,7 @@ void R_InitTranslationTables () for (int j = 0x20; j <= 0xFB; ++j) { translationtables[TRANSLATION_Standard][i]->Palette[j] = - GPalette.BaseColors[translationtables[TRANSLATION_Standard][i]->Remap[j]]; + GPalette.BaseColors[translationtables[TRANSLATION_Standard][i]->Remap[j]] | MAKEARGB(255,0,0,0); } } } @@ -466,7 +466,7 @@ void R_InitTranslationTables () int b = GPalette.BaseColors[i].b; int v = (r*77 + g*143 + b*37) >> 12; remap->Remap[i] = IcePaletteRemap[v]; - remap->Palette[i] = PalEntry(IcePalette[v][0], IcePalette[v][1], IcePalette[v][2]); + remap->Palette[i] = PalEntry(255, IcePalette[v][0], IcePalette[v][1], IcePalette[v][2]); } // set up shading tables for shaded columns @@ -528,7 +528,7 @@ static void SetRemap(FRemapTable *table, int i, float r, float g, float b) int ig = clamp (int(g * 255.f), 0, 255); int ib = clamp (int(b * 255.f), 0, 255); table->Remap[i] = ColorMatcher.Pick (ir, ig, ib); - table->Palette[i] = PalEntry(ir, ig, ib); + table->Palette[i] = PalEntry(255, ir, ig, ib); } static void R_CreatePlayerTranslation (float h, float s, float v, FPlayerSkin *skin, FRemapTable *table, FRemapTable *alttable) @@ -558,6 +558,10 @@ static void R_CreatePlayerTranslation (float h, float s, float v, FPlayerSkin *s } memcpy(table->Palette, GPalette.BaseColors, sizeof(table->Palette)); } + for (i = 1; i < 256; ++i) + { + table->Palette[i].a = 255; + } // [GRB] Don't translate skins with color range 0-0 (APlayerPawn default) if (start == 0 && end == 0) diff --git a/src/s_environment.cpp b/src/s_environment.cpp index d6bf7d6a9f..bc06fc0aca 100644 --- a/src/s_environment.cpp +++ b/src/s_environment.cpp @@ -8,7 +8,7 @@ #include "w_wad.h" #include "i_system.h" -struct FEAXField +struct FReverbField { int Min, Max; float REVERB_PROPERTIES::*Float; @@ -16,7 +16,7 @@ struct FEAXField unsigned int Flag; }; -static const FEAXField EAXFields[] = +static const FReverbField ReverbFields[] = { { 0, 25, 0, &REVERB_PROPERTIES::Environment, 0 }, { 1000, 100000, &REVERB_PROPERTIES::EnvSize, 0, 0 }, @@ -56,9 +56,9 @@ static const FEAXField EAXFields[] = { 0, 0, 0, 0, 6 }, { 0, 0, 0, 0, 7 } }; -#define NUM_EAX_FIELDS (int(countof(EAXFields))) +#define NUM_REVERB_FIELDS (int(countof(ReverbFields))) -static const char *EAXFieldNames[NUM_EAX_FIELDS+2] = +static const char *ReverbFieldNames[NUM_REVERB_FIELDS+2] = { "Environment", "EnvironmentSize", @@ -465,7 +465,7 @@ FArchive &operator<< (FArchive &arc, ReverbContainer *&env) return arc; } -static void ReadEAX (int lump) +static void ReadReverbDef (int lump) { FScanner sc; const ReverbContainer *def; @@ -473,7 +473,7 @@ static void ReadEAX (int lump) REVERB_PROPERTIES props; char *name; int id1, id2, i, j; - bool inited[NUM_EAX_FIELDS]; + bool inited[NUM_REVERB_FIELDS]; BYTE bools[32]; sc.OpenLumpNum(lump); @@ -488,20 +488,20 @@ static void ReadEAX (int lump) memset (inited, 0, sizeof(inited)); props.Instance = 0; props.Flags = 0; - while (sc.MustGetString (), NUM_EAX_FIELDS > (i = sc.MustMatchString (EAXFieldNames))) + while (sc.MustGetString (), NUM_REVERB_FIELDS > (i = sc.MustMatchString (ReverbFieldNames))) { - if (EAXFields[i].Float) + if (ReverbFields[i].Float) { sc.MustGetFloat (); - props.*EAXFields[i].Float = clamp (sc.Float, - double(EAXFields[i].Min)/1000, - double(EAXFields[i].Max)/1000); + props.*ReverbFields[i].Float = clamp (sc.Float, + double(ReverbFields[i].Min)/1000, + double(ReverbFields[i].Max)/1000); } - else if (EAXFields[i].Int) + else if (ReverbFields[i].Int) { sc.MustGetNumber (); - props.*EAXFields[i].Int = (j = clamp (sc.Number, - EAXFields[i].Min, EAXFields[i].Max)); + props.*ReverbFields[i].Int = (j = clamp (sc.Number, + ReverbFields[i].Min, ReverbFields[i].Max)); if (i == 0 && j != sc.Number) { sc.ScriptError ("The Environment field is out of range."); @@ -510,7 +510,7 @@ static void ReadEAX (int lump) else { sc.MustGetString (); - bools[EAXFields[i].Flag] = sc.MustMatchString (BoolNames); + bools[ReverbFields[i].Flag] = sc.MustMatchString (BoolNames); } inited[i] = true; } @@ -522,27 +522,27 @@ static void ReadEAX (int lump) // Add the new environment to the list, filling in uninitialized fields // with values from the standard environment specified. def = DefaultEnvironments[props.Environment]; - for (i = 0; i < NUM_EAX_FIELDS; ++i) + for (i = 0; i < NUM_REVERB_FIELDS; ++i) { - if (EAXFields[i].Float) + if (ReverbFields[i].Float) { if (!inited[i]) { - props.*EAXFields[i].Float = def->Properties.*EAXFields[i].Float; + props.*ReverbFields[i].Float = def->Properties.*ReverbFields[i].Float; } } - else if (EAXFields[i].Int) + else if (ReverbFields[i].Int) { if (!inited[i]) { - props.*EAXFields[i].Int = def->Properties.*EAXFields[i].Int; + props.*ReverbFields[i].Int = def->Properties.*ReverbFields[i].Int; } } else { if (!inited[i]) { - int mask = 1 << EAXFields[i].Flag; + int mask = 1 << ReverbFields[i].Flag; if (def->Properties.Flags & mask) { props.Flags |= mask; @@ -550,9 +550,9 @@ static void ReadEAX (int lump) } else { - if (bools[EAXFields[i].Flag]) + if (bools[ReverbFields[i].Flag]) { - props.Flags |= 1 << EAXFields[i].Flag; + props.Flags |= 1 << ReverbFields[i].Flag; } } } @@ -568,19 +568,19 @@ static void ReadEAX (int lump) } } -void S_ParseSndEax () +void S_ParseReverbDef () { int lump, lastlump = 0; - atterm (S_UnloadSndEax); + atterm (S_UnloadReverbDef); - while ((lump = Wads.FindLump ("SNDEAX", &lastlump)) != -1) + while ((lump = Wads.FindLump ("REVERBS", &lastlump)) != -1) { - ReadEAX (lump); + ReadReverbDef (lump); } } -void S_UnloadSndEax () +void S_UnloadReverbDef () { ReverbContainer *probe = Environments; diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 1e82994ea3..4f72bac8c3 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -291,7 +291,7 @@ void S_InitData () LastLocalSndInfo = LastLocalSndSeq = ""; S_ParseSndInfo (); S_ParseSndSeq (-1); - S_ParseSndEax (); + S_ParseReverbDef (); } //========================================================================== diff --git a/src/s_sound.h b/src/s_sound.h index ef3f0f90f4..a5ed5cd68e 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -219,8 +219,8 @@ void S_UpdateSounds (void *listener); // [RH] S_sfx "maintenance" routines void S_ParseSndInfo (); -void S_ParseSndEax (); -void S_UnloadSndEax (); +void S_ParseReverbDef (); +void S_UnloadReverbDef (); void S_HashSounds (); int S_FindSound (const char *logicalname); diff --git a/src/win32/eaxedit.cpp b/src/win32/eaxedit.cpp index 636b37b99a..b94b0948d9 100644 --- a/src/win32/eaxedit.cpp +++ b/src/win32/eaxedit.cpp @@ -1348,7 +1348,7 @@ void ShowEAXEditor () EAXEditWindow = CreateDialog (g_hInst, MAKEINTRESOURCE(IDD_EAXEDIT), Window, EAXProc); } -CCMD (eaxedit) +CCMD (reverbedit) { if (EAXEditWindow != 0) { diff --git a/src/win32/zdoom.rc b/src/win32/zdoom.rc index 94d11e0bbb..28338f0954 100644 --- a/src/win32/zdoom.rc +++ b/src/win32/zdoom.rc @@ -327,7 +327,7 @@ END IDD_EAXEDIT DIALOGEX 0, 0, 280, 326 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE -CAPTION "EAX Environment Editor" +CAPTION "Environment Editor" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN COMBOBOX IDC_CURRENTENVIRONMENT,7,19,265,14,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP @@ -346,7 +346,7 @@ END IDD_NEWEAX DIALOGEX 0, 0, 348, 257 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTERMOUSE | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Create New EAX Environment..." +CAPTION "Create New Environment..." FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN EDITTEXT IDC_NEWENVNAME,32,216,187,12,ES_AUTOHSCROLL diff --git a/wadsrc/sndeax.txt b/wadsrc/reverbs.txt similarity index 100% rename from wadsrc/sndeax.txt rename to wadsrc/reverbs.txt diff --git a/wadsrc/wadsrc.vcproj b/wadsrc/wadsrc.vcproj index d7307cb405..be61c6b983 100644 --- a/wadsrc/wadsrc.vcproj +++ b/wadsrc/wadsrc.vcproj @@ -142,7 +142,7 @@ >