mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-27 04:00:42 +00:00
- license correction for ct_chat.cpp
This was supposed to get the same treatment as d_net.cpp, i.e get the old license restored and be released under a duplicate GPL/Doom Source license but it was somehow missed when it got added. Also removed all leftover Doom specific parts.
This commit is contained in:
parent
658712d893
commit
008391a2ad
1 changed files with 39 additions and 96 deletions
|
@ -17,6 +17,18 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
//
|
||||
//
|
||||
// Alternatively the following applies:
|
||||
//
|
||||
// This source is available for distribution and/or modification
|
||||
// only under the terms of the DOOM Source Code License as
|
||||
// published by id Software. All rights reserved.
|
||||
//
|
||||
// The source is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
||||
// for more details.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
|
@ -308,11 +320,17 @@ static void CT_ClearChatMessage ()
|
|||
|
||||
static void ShoveChatStr (const char *str, uint8_t who)
|
||||
{
|
||||
#if 0
|
||||
// Don't send empty messages
|
||||
if (str == NULL || str[0] == '\0')
|
||||
return;
|
||||
|
||||
if (*str == '#')
|
||||
{
|
||||
C_DoCommand(FStringf("activatecheat %s", str + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
#if 0
|
||||
FString substBuff;
|
||||
|
||||
if (str[0] == '/' &&
|
||||
|
@ -323,10 +341,10 @@ static void ShoveChatStr (const char *str, uint8_t who)
|
|||
who |= 2;
|
||||
}
|
||||
|
||||
Net_WriteByte (DEM_SAY);
|
||||
Net_WriteByte (who);
|
||||
Net_WriteByte(DEM_SAY);
|
||||
Net_WriteByte(who);
|
||||
|
||||
if (!chat_substitution || !DoSubstitution (substBuff, str))
|
||||
if (!chat_substitution || !DoSubstitution(substBuff, str))
|
||||
{
|
||||
Net_WriteString(MakeUTF8(str));
|
||||
}
|
||||
|
@ -335,15 +353,9 @@ static void ShoveChatStr (const char *str, uint8_t who)
|
|||
Net_WriteString(MakeUTF8(substBuff));
|
||||
}
|
||||
#else
|
||||
if (*str == '#')
|
||||
{
|
||||
C_DoCommand(FStringf("activatecheat %s", str + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
Printf("%s %s\n", GStrings("TXT_SAY"), str);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -358,10 +370,6 @@ static void ShoveChatStr (const char *str, uint8_t who)
|
|||
static bool DoSubstitution (FString &out, const char *in)
|
||||
{
|
||||
#if 0
|
||||
player_t *player = &players[consoleplayer];
|
||||
auto weapon = player->ReadyWeapon;
|
||||
auto ammo1 = weapon ? weapon->PointerVar<AActor>(NAME_Ammo1) : nullptr;
|
||||
auto ammo2 = weapon ? weapon->PointerVar<AActor>(NAME_Ammo2) : nullptr;
|
||||
const char *a, *b;
|
||||
|
||||
a = in;
|
||||
|
@ -378,75 +386,10 @@ static bool DoSubstitution (FString &out, const char *in)
|
|||
|
||||
ptrdiff_t ByteLen = b - a;
|
||||
|
||||
if (ByteLen == 6)
|
||||
// todo: forward to the game modules. Doom used the following tokens:
|
||||
// health, weapon, armor, ammocount, ammo
|
||||
if (0)
|
||||
{
|
||||
if (strnicmp(a, "health", 6) == 0)
|
||||
{
|
||||
out.AppendFormat("%d", player->health);
|
||||
}
|
||||
else if (strnicmp(a, "weapon", 6) == 0)
|
||||
{
|
||||
if (weapon == NULL)
|
||||
{
|
||||
out += "no weapon";
|
||||
}
|
||||
else
|
||||
{
|
||||
out += weapon->GetClass()->TypeName.GetChars();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ByteLen == 5)
|
||||
{
|
||||
if (strnicmp(a, "armor", 5) == 0)
|
||||
{
|
||||
auto armor = player->mo->FindInventory(NAME_BasicArmor);
|
||||
out.AppendFormat("%d", armor != NULL ? armor->IntVar(NAME_Amount) : 0);
|
||||
}
|
||||
}
|
||||
else if (ByteLen == 9)
|
||||
{
|
||||
if (strnicmp(a, "ammocount", 9) == 0)
|
||||
{
|
||||
if (weapon == NULL)
|
||||
{
|
||||
out += '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
out.AppendFormat("%d", ammo1 != NULL ? ammo1->IntVar(NAME_Amount) : 0);
|
||||
if (ammo2 != NULL)
|
||||
{
|
||||
out.AppendFormat("/%d", ammo2->IntVar(NAME_Amount));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ByteLen == 4)
|
||||
{
|
||||
if (strnicmp(a, "ammo", 4) == 0)
|
||||
{
|
||||
if (ammo1 == NULL)
|
||||
{
|
||||
out += "no ammo";
|
||||
}
|
||||
else
|
||||
{
|
||||
out.AppendFormat("%s", ammo1->GetClass()->TypeName.GetChars());
|
||||
if (ammo2 != NULL)
|
||||
{
|
||||
out.AppendFormat("/%s", ammo2->GetClass()->TypeName.GetChars());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ByteLen == 0)
|
||||
{
|
||||
out += '$';
|
||||
if (*b == '$')
|
||||
{
|
||||
b++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue