diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 3e12189d9c..64b8fcdd9e 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,6 @@ +August 19, 2006 (Changes by Graf Zahl) +- Added custom fail messages to the puzzle items. + August 17, 2006 (Changes by Graf Zahl) - Added a check to the map loader to check whether the map label is in the same WAD as the following lump. diff --git a/src/g_hexen/a_puzzleitems.cpp b/src/g_hexen/a_puzzleitems.cpp index 8ddf39debb..3fbd80b824 100644 --- a/src/g_hexen/a_puzzleitems.cpp +++ b/src/g_hexen/a_puzzleitems.cpp @@ -39,7 +39,10 @@ bool APuzzleItem::Use (bool pickup) } // [RH] Always play the sound if the use fails. S_Sound (Owner, CHAN_VOICE, "*puzzfail", 1, ATTN_IDLE); - C_MidPrintBold (GStrings("TXT_USEPUZZLEFAILED")); + const char *message = GetClass()->Meta.GetMetaString (AIMETA_PuzzFailMessage); + if (message != NULL && *message=='$') message = GStrings[message + 1]; + if (message == NULL) message = GStrings("TXT_USEPUZZLEFAILED"); + C_MidPrintBold (message); return false; } diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index ead13b826b..b4fcf21044 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -76,6 +76,7 @@ enum AIMETA_DropAmount, // specifies the amount for a dropped ammo item AIMETA_LowHealth, AIMETA_LowHealthMessage, + AIMETA_PuzzFailMessage, }; enum diff --git a/src/thingdef.cpp b/src/thingdef.cpp index d568cec356..9e092c870d 100644 --- a/src/thingdef.cpp +++ b/src/thingdef.cpp @@ -3278,7 +3278,7 @@ static void InventoryUsesound (AInventory *defaults, Baggage &bag) //========================================================================== // //========================================================================== -static void InventoryGiveQuest (APuzzleItem *defaults, Baggage &bag) +static void InventoryGiveQuest (AInventory *defaults, Baggage &bag) { SC_MustGetNumber(); bag.Info->Class->Meta.SetMetaInt(AIMETA_GiveQuest, sc_Number); @@ -3305,6 +3305,15 @@ static void PuzzleitemNumber (APuzzleItem *defaults, Baggage &bag) defaults->PuzzleItemNumber=sc_Number; } +//========================================================================== +// +//========================================================================== +static void PuzzleitemFailMsg (APuzzleItem *defaults, Baggage &bag) +{ + SC_MustGetString(); + bag.Info->Class->Meta.SetMetaString(AIMETA_PuzzFailMessage, sc_String); +} + //========================================================================== // //========================================================================== @@ -3837,6 +3846,7 @@ static const ActorProps props[] = { "powerup.duration", (apf)PowerupDuration, RUNTIME_CLASS(APowerupGiver) }, { "powerup.type", (apf)PowerupType, RUNTIME_CLASS(APowerupGiver) }, { "projectile", ActorProjectile, RUNTIME_CLASS(AActor) }, + { "puzzleitem.failmessage", (apf)PuzzleitemFailMsg, RUNTIME_CLASS(APuzzleItem) }, { "puzzleitem.number", (apf)PuzzleitemNumber, RUNTIME_CLASS(APuzzleItem) }, { "radius", ActorRadius, RUNTIME_CLASS(AActor) }, { "radiusdamagefactor", ActorRadiusDamageFactor, RUNTIME_CLASS(AActor) },