mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-16 17:21:10 +00:00
- Fixed: skins can not be sorted for binary search because the player class
code depends on the original indices. - Fixed: P_StartConversation set the global dialog node variable for all players, not just the consoleplayer. - Fixed: AWeapon::PickupForAmmo assumed that any weapon having a secondary ammo type also has a primary one. SVN r1431 (trunk)
This commit is contained in:
parent
4b723beddd
commit
5bd3d0d37d
4 changed files with 116 additions and 81 deletions
|
@ -1,4 +1,12 @@
|
||||||
February 20, 2009 (Changes by Graf Zahl)
|
February 21, 2009 (Changes by Graf Zahl)
|
||||||
|
- Fixed: skins can not be sorted for binary search because the player class
|
||||||
|
code depends on the original indices.
|
||||||
|
- Fixed: P_StartConversation set the global dialog node variable for all
|
||||||
|
players, not just the consoleplayer.
|
||||||
|
- Fixed: AWeapon::PickupForAmmo assumed that any weapon having a secondary
|
||||||
|
ammo type also has a primary one.
|
||||||
|
|
||||||
|
February 20, 2009 (Changes by Graf Zahl)
|
||||||
- Bumped netgame, demo and min demo version for the weapon slot changes.
|
- Bumped netgame, demo and min demo version for the weapon slot changes.
|
||||||
- changed weapon slots to be stored per player. Information is now transmitted
|
- changed weapon slots to be stored per player. Information is now transmitted
|
||||||
across the network so that all machines know each player's current weapon
|
across the network so that all machines know each player's current weapon
|
||||||
|
|
|
@ -163,16 +163,25 @@ bool AWeapon::PickupForAmmo (AWeapon *ownedWeapon)
|
||||||
// Don't take ammo if the weapon sticks around.
|
// Don't take ammo if the weapon sticks around.
|
||||||
if (!ShouldStay ())
|
if (!ShouldStay ())
|
||||||
{
|
{
|
||||||
int oldamount = 0;
|
int oldamount1 = 0;
|
||||||
if (ownedWeapon->Ammo1 != NULL) oldamount = ownedWeapon->Ammo1->Amount;
|
int oldamount2 = 0;
|
||||||
|
if (ownedWeapon->Ammo1 != NULL) oldamount1 = ownedWeapon->Ammo1->Amount;
|
||||||
|
if (ownedWeapon->Ammo2 != NULL) oldamount2 = ownedWeapon->Ammo1->Amount;
|
||||||
|
|
||||||
if (AmmoGive1 > 0) gotstuff = AddExistingAmmo (ownedWeapon->Ammo1, AmmoGive1);
|
if (AmmoGive1 > 0) gotstuff = AddExistingAmmo (ownedWeapon->Ammo1, AmmoGive1);
|
||||||
if (AmmoGive2 > 0) gotstuff |= AddExistingAmmo (ownedWeapon->Ammo2, AmmoGive2);
|
if (AmmoGive2 > 0) gotstuff |= AddExistingAmmo (ownedWeapon->Ammo2, AmmoGive2);
|
||||||
|
|
||||||
AActor *Owner = ownedWeapon->Owner;
|
AActor *Owner = ownedWeapon->Owner;
|
||||||
if (gotstuff && oldamount == 0 && Owner != NULL && Owner->player != NULL)
|
if (gotstuff && Owner != NULL && Owner->player != NULL)
|
||||||
{
|
{
|
||||||
static_cast<APlayerPawn *>(Owner)->CheckWeaponSwitch(ownedWeapon->Ammo1->GetClass());
|
if (ownedWeapon->Ammo1 != NULL && oldamount1 == 0)
|
||||||
|
{
|
||||||
|
static_cast<APlayerPawn *>(Owner)->CheckWeaponSwitch(ownedWeapon->Ammo1->GetClass());
|
||||||
|
}
|
||||||
|
else if (ownedWeapon->Ammo2 != NULL && oldamount2 == 0)
|
||||||
|
{
|
||||||
|
static_cast<APlayerPawn *>(Owner)->CheckWeaponSwitch(ownedWeapon->Ammo2->GetClass());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gotstuff;
|
return gotstuff;
|
||||||
|
|
|
@ -676,7 +676,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
|
||||||
pc->player->ConversationPC = pc;
|
pc->player->ConversationPC = pc;
|
||||||
pc->player->ConversationNPC = npc;
|
pc->player->ConversationNPC = npc;
|
||||||
|
|
||||||
CurNode = npc->Conversation;
|
FStrifeDialogueNode *CurNode = npc->Conversation;
|
||||||
|
|
||||||
if (pc->player == &players[consoleplayer])
|
if (pc->player == &players[consoleplayer])
|
||||||
{
|
{
|
||||||
|
@ -717,88 +717,90 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurNode->SpeakerVoice != 0)
|
// The rest is only done when the conversation is actually displayed.
|
||||||
|
if (pc->player == &players[consoleplayer])
|
||||||
{
|
{
|
||||||
I_SetMusicVolume (dlg_musicvolume);
|
if (CurNode->SpeakerVoice != 0)
|
||||||
S_Sound (npc, CHAN_VOICE|CHAN_NOPAUSE, CurNode->SpeakerVoice, 1, ATTN_NORM);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pc->player != &players[consoleplayer])
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Set up the menu
|
|
||||||
ConversationMenu.PreDraw = DrawConversationMenu;
|
|
||||||
ConversationMenu.EscapeHandler = ConversationMenuEscaped;
|
|
||||||
|
|
||||||
// Format the speaker's message.
|
|
||||||
toSay = CurNode->Dialogue;
|
|
||||||
if (strncmp (toSay, "RANDOM_", 7) == 0)
|
|
||||||
{
|
|
||||||
FString dlgtext;
|
|
||||||
|
|
||||||
dlgtext.Format("TXT_%s_%02d", toSay, 1+(pr_randomspeech() % NUM_RANDOM_LINES));
|
|
||||||
toSay = GStrings[dlgtext.GetChars()];
|
|
||||||
if (toSay==NULL) toSay = "Go away!"; // Ok, it's lame - but it doesn't look like an error to the player. ;)
|
|
||||||
}
|
|
||||||
DialogueLines = V_BreakLines (SmallFont, screen->GetWidth()/CleanXfac-24*2, toSay);
|
|
||||||
|
|
||||||
// Fill out the possible choices
|
|
||||||
ShowGold = false;
|
|
||||||
item.type = numberedmore;
|
|
||||||
item.e.mfunc = PickConversationReply;
|
|
||||||
for (reply = CurNode->Children, i = 1; reply != NULL; reply = reply->Next)
|
|
||||||
{
|
|
||||||
if (reply->Reply == NULL)
|
|
||||||
{
|
{
|
||||||
continue;
|
I_SetMusicVolume (dlg_musicvolume);
|
||||||
|
S_Sound (npc, CHAN_VOICE|CHAN_NOPAUSE, CurNode->SpeakerVoice, 1, ATTN_NORM);
|
||||||
}
|
}
|
||||||
ShowGold |= reply->NeedsGold;
|
|
||||||
reply->ReplyLines = V_BreakLines (SmallFont, 320-50-10, reply->Reply);
|
// Set up the menu
|
||||||
for (j = 0; reply->ReplyLines[j].Width >= 0; ++j)
|
::CurNode = CurNode; // only set the global variaböle for the consoleplayer
|
||||||
|
ConversationMenu.PreDraw = DrawConversationMenu;
|
||||||
|
ConversationMenu.EscapeHandler = ConversationMenuEscaped;
|
||||||
|
|
||||||
|
// Format the speaker's message.
|
||||||
|
toSay = CurNode->Dialogue;
|
||||||
|
if (strncmp (toSay, "RANDOM_", 7) == 0)
|
||||||
{
|
{
|
||||||
item.label = reply->ReplyLines[j].Text.LockBuffer();
|
FString dlgtext;
|
||||||
item.b.position = j == 0 ? i : 0;
|
|
||||||
item.c.extra = reply;
|
dlgtext.Format("TXT_%s_%02d", toSay, 1+(pr_randomspeech() % NUM_RANDOM_LINES));
|
||||||
ConversationItems.Push (item);
|
toSay = GStrings[dlgtext.GetChars()];
|
||||||
|
if (toSay==NULL) toSay = "Go away!"; // Ok, it's lame - but it doesn't look like an error to the player. ;)
|
||||||
}
|
}
|
||||||
++i;
|
DialogueLines = V_BreakLines (SmallFont, screen->GetWidth()/CleanXfac-24*2, toSay);
|
||||||
}
|
|
||||||
char goodbye[25];
|
|
||||||
mysnprintf(goodbye, countof(goodbye), "TXT_RANDOMGOODBYE_%d", 1+(pr_randomspeech() % NUM_RANDOM_GOODBYES));
|
|
||||||
item.label = (char*)GStrings[goodbye];
|
|
||||||
if (item.label == NULL) item.label = "Bye.";
|
|
||||||
item.b.position = i;
|
|
||||||
item.c.extra = NULL;
|
|
||||||
ConversationItems.Push (item);
|
|
||||||
|
|
||||||
// Determine where the top of the reply list should be positioned.
|
// Fill out the possible choices
|
||||||
i = (gameinfo.gametype & GAME_Raven) ? 9 : 8;
|
ShowGold = false;
|
||||||
ConversationMenu.y = MIN<int> (140, 192 - ConversationItems.Size() * i);
|
item.type = numberedmore;
|
||||||
for (i = 0; DialogueLines[i].Width >= 0; ++i)
|
item.e.mfunc = PickConversationReply;
|
||||||
{ }
|
for (reply = CurNode->Children, i = 1; reply != NULL; reply = reply->Next)
|
||||||
i = 44 + i * 10;
|
{
|
||||||
if (ConversationMenu.y - 100 < i - screen->GetHeight() / CleanYfac / 2)
|
if (reply->Reply == NULL)
|
||||||
{
|
{
|
||||||
ConversationMenu.y = i - screen->GetHeight() / CleanYfac / 2 + 100;
|
continue;
|
||||||
}
|
}
|
||||||
ConversationMenu.indent = 50;
|
ShowGold |= reply->NeedsGold;
|
||||||
|
reply->ReplyLines = V_BreakLines (SmallFont, 320-50-10, reply->Reply);
|
||||||
|
for (j = 0; reply->ReplyLines[j].Width >= 0; ++j)
|
||||||
|
{
|
||||||
|
item.label = reply->ReplyLines[j].Text.LockBuffer();
|
||||||
|
item.b.position = j == 0 ? i : 0;
|
||||||
|
item.c.extra = reply;
|
||||||
|
ConversationItems.Push (item);
|
||||||
|
}
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
char goodbye[25];
|
||||||
|
mysnprintf(goodbye, countof(goodbye), "TXT_RANDOMGOODBYE_%d", 1+(pr_randomspeech() % NUM_RANDOM_GOODBYES));
|
||||||
|
item.label = (char*)GStrings[goodbye];
|
||||||
|
if (item.label == NULL) item.label = "Bye.";
|
||||||
|
item.b.position = i;
|
||||||
|
item.c.extra = NULL;
|
||||||
|
ConversationItems.Push (item);
|
||||||
|
|
||||||
// Finish setting up the menu
|
// Determine where the top of the reply list should be positioned.
|
||||||
ConversationMenu.items = &ConversationItems[0];
|
i = (gameinfo.gametype & GAME_Raven) ? 9 : 8;
|
||||||
ConversationMenu.numitems = ConversationItems.Size();
|
ConversationMenu.y = MIN<int> (140, 192 - ConversationItems.Size() * i);
|
||||||
if (CurNode != PrevNode)
|
for (i = 0; DialogueLines[i].Width >= 0; ++i)
|
||||||
{ // Only reset the selection if showing a different menu.
|
{ }
|
||||||
ConversationMenu.lastOn = 0;
|
i = 44 + i * 10;
|
||||||
PrevNode = CurNode;
|
if (ConversationMenu.y - 100 < i - screen->GetHeight() / CleanYfac / 2)
|
||||||
}
|
{
|
||||||
ConversationMenu.DontDim = true;
|
ConversationMenu.y = i - screen->GetHeight() / CleanYfac / 2 + 100;
|
||||||
|
}
|
||||||
|
ConversationMenu.indent = 50;
|
||||||
|
|
||||||
// And open the menu
|
// Finish setting up the menu
|
||||||
M_StartControlPanel (false);
|
ConversationMenu.items = &ConversationItems[0];
|
||||||
OptionsActive = true;
|
ConversationMenu.numitems = ConversationItems.Size();
|
||||||
menuactive = MENU_OnNoPause;
|
if (CurNode != PrevNode)
|
||||||
ConversationPauseTic = gametic + 20;
|
{ // Only reset the selection if showing a different menu.
|
||||||
M_SwitchMenu (&ConversationMenu);
|
ConversationMenu.lastOn = 0;
|
||||||
|
PrevNode = CurNode;
|
||||||
|
}
|
||||||
|
ConversationMenu.DontDim = true;
|
||||||
|
|
||||||
|
// And open the menu
|
||||||
|
M_StartControlPanel (false);
|
||||||
|
OptionsActive = true;
|
||||||
|
menuactive = MENU_OnNoPause;
|
||||||
|
ConversationPauseTic = gametic + 20;
|
||||||
|
M_SwitchMenu (&ConversationMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
|
@ -419,10 +419,12 @@ static const char *skinsoundnames[NUMSKINSOUNDS][2] =
|
||||||
{ "dsjump", "*jump" }
|
{ "dsjump", "*jump" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
static int STACK_ARGS skinsorter (const void *a, const void *b)
|
static int STACK_ARGS skinsorter (const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return stricmp (((FPlayerSkin *)a)->name, ((FPlayerSkin *)b)->name);
|
return stricmp (((FPlayerSkin *)a)->name, ((FPlayerSkin *)b)->name);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void R_InitSkins (void)
|
void R_InitSkins (void)
|
||||||
{
|
{
|
||||||
|
@ -782,6 +784,19 @@ int R_FindSkin (const char *name, int pclass)
|
||||||
return pclass;
|
return pclass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (unsigned i = PlayerClasses.Size(); i < numskins; i++)
|
||||||
|
{
|
||||||
|
if (strnicmp (skins[i].name, name, 16) == 0)
|
||||||
|
{
|
||||||
|
if (PlayerClasses[pclass].CheckSkin (mid))
|
||||||
|
return i;
|
||||||
|
else
|
||||||
|
return pclass;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
min = PlayerClasses.Size ();
|
min = PlayerClasses.Size ();
|
||||||
max = (int)numskins-1;
|
max = (int)numskins-1;
|
||||||
|
|
||||||
|
@ -805,6 +820,7 @@ int R_FindSkin (const char *name, int pclass)
|
||||||
max = mid - 1;
|
max = mid - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return pclass;
|
return pclass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -932,7 +948,7 @@ void R_InitSprites ()
|
||||||
}
|
}
|
||||||
|
|
||||||
// [RH] Sort the skins, but leave base as skin 0
|
// [RH] Sort the skins, but leave base as skin 0
|
||||||
qsort (&skins[PlayerClasses.Size ()], numskins-PlayerClasses.Size (), sizeof(FPlayerSkin), skinsorter);
|
//qsort (&skins[PlayerClasses.Size ()], numskins-PlayerClasses.Size (), sizeof(FPlayerSkin), skinsorter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_DeinitSprites()
|
void R_DeinitSprites()
|
||||||
|
|
Loading…
Reference in a new issue