- Sync scripting branch with what was in trunk on Sunday. I believe that would be revision 2739.

SVN r2790 (scripting)
This commit is contained in:
Randy Heit 2010-09-16 03:14:32 +00:00
commit 99670b708c
317 changed files with 17299 additions and 7273 deletions

View file

@ -116,13 +116,13 @@ EXTERN_CVAR (Float, con_midtime);
//
// CVAR displaynametags
//
// Selects whether to display name tags or not when changing weapons
// Selects whether to display name tags or not when changing weapons/items
//
//==========================================================================
CUSTOM_CVAR (Bool, displaynametags, 0, CVAR_ARCHIVE)
CUSTOM_CVAR (Int, displaynametags, 0, CVAR_ARCHIVE)
{
if (self != 0 && self != 1)
if (self < 0 || self > 3)
{
self = 0;
}
@ -288,7 +288,8 @@ CCMD (slot)
if (slot < NUM_WEAPON_SLOTS)
{
SendItemUse = players[consoleplayer].weapons.Slots[slot].PickWeapon (&players[consoleplayer]);
SendItemUse = players[consoleplayer].weapons.Slots[slot].PickWeapon (&players[consoleplayer],
!(dmflags2 & DF2_DONTCHECKAMMO));
}
}
}
@ -321,11 +322,23 @@ CCMD (turn180)
CCMD (weapnext)
{
SendItemUse = players[consoleplayer].weapons.PickNextWeapon (&players[consoleplayer]);
// [BC] Option to display the name of the weapon being cycled to.
if ((displaynametags & 2) && StatusBar && SmallFont && SendItemUse)
{
StatusBar->AttachMessage(new DHUDMessageFadeOut(SmallFont, SendItemUse->GetTag(),
1.5f, 0.90f, 0, 0, CR_GOLD, 2.f, 0.35f), MAKE_ID( 'W', 'E', 'P', 'N' ));
}
}
CCMD (weapprev)
{
SendItemUse = players[consoleplayer].weapons.PickPrevWeapon (&players[consoleplayer]);
// [BC] Option to display the name of the weapon being cycled to.
if ((displaynametags & 2) && StatusBar && SmallFont && SendItemUse)
{
StatusBar->AttachMessage(new DHUDMessageFadeOut(SmallFont, SendItemUse->GetTag(),
1.5f, 0.90f, 0, 0, CR_GOLD, 2.f, 0.35f), MAKE_ID( 'W', 'E', 'P', 'N' ));
}
}
CCMD (invnext)
@ -353,10 +366,9 @@ CCMD (invnext)
who->InvSel = who->Inventory;
}
}
if (displaynametags && StatusBar && SmallFont
&& gamestate == GS_LEVEL && level.time > con_midtime && who->InvSel)
StatusBar->AttachMessage (new DHUDMessage (SmallFont, who->InvSel->GetTag(),
2.5f, 0.375f, 0, 0, CR_YELLOW, con_midtime), MAKE_ID('S','I','N','V'));
if ((displaynametags & 1) && StatusBar && SmallFont && who->InvSel)
StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, who->InvSel->GetTag(),
1.5f, 0.80f, 0, 0, CR_GOLD, 2.f, 0.35f), MAKE_ID('S','I','N','V'));
}
who->player->inventorytics = 5*TICRATE;
}
@ -384,10 +396,9 @@ CCMD (invprev)
}
who->InvSel = item;
}
if (displaynametags && StatusBar && SmallFont
&& gamestate == GS_LEVEL && level.time > con_midtime && who->InvSel)
StatusBar->AttachMessage (new DHUDMessage (SmallFont, who->InvSel->GetTag(),
2.5f, 0.375f, 0, 0, CR_YELLOW, con_midtime), MAKE_ID('S','I','N','V'));
if ((displaynametags & 1) && StatusBar && SmallFont && who->InvSel)
StatusBar->AttachMessage (new DHUDMessageFadeOut (SmallFont, who->InvSel->GetTag(),
1.5f, 0.80f, 0, 0, CR_GOLD, 2.f, 0.35f), MAKE_ID('S','I','N','V'));
}
who->player->inventorytics = 5*TICRATE;
}
@ -871,7 +882,7 @@ bool G_Responder (event_t *ev)
if (gameaction == ga_nothing &&
(demoplayback || gamestate == GS_DEMOSCREEN || gamestate == GS_TITLELEVEL))
{
const char *cmd = C_GetBinding (ev->data1);
const char *cmd = Bindings.GetBind (ev->data1);
if (ev->type == EV_KeyDown)
{
@ -894,11 +905,11 @@ bool G_Responder (event_t *ev)
}
else
{
return C_DoKey (ev);
return C_DoKey (ev, &Bindings, &DoubleBindings);
}
}
if (cmd && cmd[0] == '+')
return C_DoKey (ev);
return C_DoKey (ev, &Bindings, &DoubleBindings);
return false;
}
@ -910,7 +921,7 @@ bool G_Responder (event_t *ev)
{
if (ST_Responder (ev))
return true; // status window ate it
if (!viewactive && AM_Responder (ev))
if (!viewactive && AM_Responder (ev, false))
return true; // automap ate it
}
else if (gamestate == GS_FINALE)
@ -922,12 +933,12 @@ bool G_Responder (event_t *ev)
switch (ev->type)
{
case EV_KeyDown:
if (C_DoKey (ev))
if (C_DoKey (ev, &Bindings, &DoubleBindings))
return true;
break;
case EV_KeyUp:
C_DoKey (ev);
C_DoKey (ev, &Bindings, &DoubleBindings);
break;
// [RH] mouse buttons are sent as key up/down events
@ -941,7 +952,7 @@ bool G_Responder (event_t *ev)
// the events *last* so that any bound keys get precedence.
if (gamestate == GS_LEVEL && viewactive)
return AM_Responder (ev);
return AM_Responder (ev, true);
return (ev->type == EV_KeyDown ||
ev->type == EV_Mouse);
@ -1165,7 +1176,9 @@ void G_Ticker ()
// G_PlayerFinishLevel
// Called when a player completes a level.
//
void G_PlayerFinishLevel (int player, EFinishLevelType mode, bool resetinventory)
// flags is checked for RESETINVENTORY and RESETHEALTH only.
void G_PlayerFinishLevel (int player, EFinishLevelType mode, int flags)
{
AInventory *item, *next;
player_t *p;
@ -1237,8 +1250,14 @@ void G_PlayerFinishLevel (int player, EFinishLevelType mode, bool resetinventory
P_UndoPlayerMorph (p, p, 0, true);
}
// Resets player health to default
if (flags & CHANGELEVEL_RESETHEALTH)
{
p->health = p->mo->health = p->mo->SpawnHealth();
}
// Clears the entire inventory and gives back the defaults for starting a game
if (resetinventory)
if (flags & CHANGELEVEL_RESETINVENTORY)
{
AInventory *inv = p->mo->Inventory;
@ -2044,11 +2063,11 @@ void G_DoSaveGame (bool okForQuicksave, FString filename, const char *descriptio
M_AppendPNGChunk (stdfile, MAKE_ID('s','n','X','t'), &next, 1);
}
M_NotifyNewSave (filename.GetChars(), description, okForQuicksave);
M_FinishPNG (stdfile);
fclose (stdfile);
M_NotifyNewSave (filename.GetChars(), description, okForQuicksave);
// Check whether the file is ok.
bool success = false;
stdfile = fopen (filename.GetChars(), "rb");