diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 95e185d48..cc8b6e22e 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ December 22, 2007 (Changes by Graf Zahl) +- Added Karate Chris's teamdamage in MAPINFO submission. +- Added Blzut3's second SBARINFO update. +- Fixed: The second flash state of the chaingun called A_Light1 instead of A_Light2. - Added Blzut3's SBARINFO update. December 21, 2007 diff --git a/src/doomstat.cpp b/src/doomstat.cpp index 20721763c..64491e143 100644 --- a/src/doomstat.cpp +++ b/src/doomstat.cpp @@ -51,7 +51,11 @@ CVAR (Bool, var_friction, true, CVAR_SERVERINFO); CVAR (Bool, var_pushers, true, CVAR_SERVERINFO); CVAR (Bool, alwaysapplydmflags, false, CVAR_SERVERINFO); -CVAR (Float, teamdamage, 0.f, CVAR_SERVERINFO); + +CUSTOM_CVAR (Float, teamdamage, 0.f, CVAR_SERVERINFO) +{ + level.teamdamage = self; +} CUSTOM_CVAR (String, language, "auto", CVAR_ARCHIVE) { diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index f2c27bd5b..8e91dc4e2 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -438,7 +438,7 @@ int APoisonCloud::DoSpecialDamage (AActor *victim, int damage) } else { - dopoison = victim->player->poisoncount < (int)(4.f * teamdamage); + dopoison = victim->player->poisoncount < (int)(4.f * level.teamdamage); } if (dopoison) @@ -446,7 +446,7 @@ int APoisonCloud::DoSpecialDamage (AActor *victim, int damage) int damage = 15 + (pr_poisoncloudd()&15); if (mate) { - damage = (int)((float)damage * teamdamage); + damage = (int)((float)damage * level.teamdamage); } if (damage > 0) { diff --git a/src/g_level.cpp b/src/g_level.cpp index 1c642ddd7..b48dd83fb 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -299,6 +299,7 @@ static const char *MapInfoMapLevel[] = "infiniteflightpowerup", "noinfiniteflightpowerup", "allowrespawn", + "teamdamage", NULL }; @@ -440,6 +441,7 @@ MapHandlers[] = { MITYPE_SETFLAG, LEVEL_INFINITE_FLIGHT, 0 }, { MITYPE_CLRFLAG, LEVEL_INFINITE_FLIGHT, 0 }, { MITYPE_SETFLAG, LEVEL_ALLOWRESPAWN, 0 }, + { MITYPE_FLOAT, lioffset(teamdamage), 0 }, }; static const char *MapInfoClusterLevel[] = @@ -2259,6 +2261,7 @@ void G_InitLevelLocals () level.gravity = sv_gravity * 35/TICRATE; level.aircontrol = (fixed_t)(sv_aircontrol * 65536.f); + level.teamdamage = teamdamage; level.flags = 0; info = FindLevelInfo (level.mapname); @@ -2297,6 +2300,10 @@ void G_InitLevelLocals () { level.aircontrol = (fixed_t)(info->aircontrol * 65536.f); } + if (info->teamdamage != 0.f) + { + level.teamdamage = info->teamdamage; + } G_AirControlChanged (); @@ -2621,6 +2628,7 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad) << level.killed_monsters << level.gravity << level.aircontrol + << level.teamdamage << level.maptime << i; diff --git a/src/g_level.h b/src/g_level.h index 2ffbafe7e..3a1b0b1b9 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -175,6 +175,8 @@ struct level_info_s char sndseq[9]; char bordertexture[9]; FSpecialAction * specialactions; + + float teamdamage; }; typedef struct level_info_s level_info_t; @@ -242,6 +244,8 @@ struct level_locals_s const char *f1; + float teamdamage; + bool IsJumpingAllowed() const; bool IsCrouchingAllowed() const; bool IsFreelookAllowed() const; diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index d175cd1bc..62db67c23 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -15,6 +15,7 @@ #include "i_system.h" #include "sbarinfo.h" #include "sc_man.h" +#include "gi.h" static FRandom pr_chainwiggle; //use the same method of chain wiggling as heretic. @@ -651,11 +652,21 @@ void SBarInfo::ParseSBarInfoBlock(SBarInfoBlock &block) cmd.sprite = newImage(sc_String); SC_MustGetToken(','); SC_MustGetToken(TK_IntConst); - if(sc_Number <= 0) - SC_ScriptError("Size must be a positive number."); + if(sc_Number < 0) + SC_ScriptError("Left padding must be a positive number."); cmd.special2 = sc_Number; SC_MustGetToken(','); SC_MustGetToken(TK_IntConst); + if(sc_Number < 0) + SC_ScriptError("Right padding must be a positive number."); + cmd.special3 = sc_Number; + SC_MustGetToken(','); + SC_MustGetToken(TK_IntConst); + if(sc_Number < 0) + SC_ScriptError("Chain size must be a positive number."); + cmd.special4 = sc_Number; + SC_MustGetToken(','); + SC_MustGetToken(TK_IntConst); cmd.x = sc_Number; SC_MustGetToken(','); SC_MustGetToken(TK_IntConst); @@ -1467,7 +1478,7 @@ private: { wiggle = (cmd.flags & DRAWGEM_WIGGLE) == DRAWGEM_WIGGLE; } - DrawGem(Images[cmd.special], Images[cmd.sprite], value, cmd.x, cmd.y, cmd.special2, wiggle, translate); + DrawGem(Images[cmd.special], Images[cmd.sprite], value, cmd.x, cmd.y, cmd.special2, cmd.special3, cmd.special4-1, wiggle, translate); break; } case SBARINFO_GAMEMODE: @@ -1499,7 +1510,7 @@ private: y -= (texture->GetHeight()/2)-texture->TopOffset; } if((flags & DRAWIMAGE_TRANSLATABLE) == DRAWIMAGE_TRANSLATABLE) - DrawImage(texture, x, y, translationtables[TRANSLATION_Players] + (CPlayer - players)*256); + DrawImage(texture, x, y, getTranslation()); else DrawImage(texture, x, y); } @@ -1710,7 +1721,8 @@ private: } //draws heretic/hexen style life gems - void DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int size, bool wiggle, bool translate) + void DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int padleft, int padright, int chainsize, + bool wiggle, bool translate) { if(value > 100) value = 100; @@ -1719,18 +1731,20 @@ private: if(wiggle) y += chainWiggle; int gemWidth = gem->GetWidth(); - int offset = (int) (((double) (size-gemWidth)/100)*value); + int chainWidth = chain->GetWidth(); + int offset = (int) (((double) (chainWidth-padleft-padright)/100)*value); if(chain != NULL) { - DrawImage(chain, x+offset, y); - DrawImage(chain, x-chain->GetWidth()+offset+7, y); + DrawImage(chain, x+(offset%chainsize), y); } if(gem != NULL) - DrawImage(gem, x-gemWidth+offset, y, translate ? /*translationtables[TRANSLATION_Players] + (CPlayer-players)*256*/ getTranslation() : NULL); + DrawImage(gem, x+padleft+offset, y, translate ? getTranslation() : NULL); } BYTE* getTranslation() { + if(gameinfo.gametype & GAME_Raven) + return translationtables[TRANSLATION_PlayersExtra] + (CPlayer - players)*256; return translationtables[TRANSLATION_Players] + (CPlayer - players)*256; } diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 84ea8ce49..2f566e694 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1025,7 +1025,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage FriendlyFire = true; if (damage < 1000000) { // Still allow telefragging :-( - damage = (int)((float)damage * teamdamage); + damage = (int)((float)damage * level.teamdamage); if (damage <= 0) return; } @@ -1290,7 +1290,7 @@ void P_PoisonPlayer (player_t *player, AActor *poisoner, AActor *source, int poi } if (source != NULL && source->player != player && player->mo->IsTeammate (source)) { - poison = (int)((float)poison * teamdamage); + poison = (int)((float)poison * level.teamdamage); } if (poison > 0) {