- 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:
Christoph Oelckers 2009-02-21 10:15:11 +00:00
parent 4b723beddd
commit 5bd3d0d37d
4 changed files with 116 additions and 81 deletions

View File

@ -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.
- 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

View File

@ -163,16 +163,25 @@ bool AWeapon::PickupForAmmo (AWeapon *ownedWeapon)
// Don't take ammo if the weapon sticks around.
if (!ShouldStay ())
{
int oldamount = 0;
if (ownedWeapon->Ammo1 != NULL) oldamount = ownedWeapon->Ammo1->Amount;
int oldamount1 = 0;
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 (AmmoGive2 > 0) gotstuff |= AddExistingAmmo (ownedWeapon->Ammo2, AmmoGive2);
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;

View File

@ -676,7 +676,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
pc->player->ConversationPC = pc;
pc->player->ConversationNPC = npc;
CurNode = npc->Conversation;
FStrifeDialogueNode *CurNode = npc->Conversation;
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);
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)
if (CurNode->SpeakerVoice != 0)
{
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);
for (j = 0; reply->ReplyLines[j].Width >= 0; ++j)
// Set up the menu
::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();
item.b.position = j == 0 ? i : 0;
item.c.extra = reply;
ConversationItems.Push (item);
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. ;)
}
++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);
DialogueLines = V_BreakLines (SmallFont, screen->GetWidth()/CleanXfac-24*2, toSay);
// Determine where the top of the reply list should be positioned.
i = (gameinfo.gametype & GAME_Raven) ? 9 : 8;
ConversationMenu.y = MIN<int> (140, 192 - ConversationItems.Size() * i);
for (i = 0; DialogueLines[i].Width >= 0; ++i)
{ }
i = 44 + i * 10;
if (ConversationMenu.y - 100 < i - screen->GetHeight() / CleanYfac / 2)
{
ConversationMenu.y = i - screen->GetHeight() / CleanYfac / 2 + 100;
}
ConversationMenu.indent = 50;
// 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;
}
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
ConversationMenu.items = &ConversationItems[0];
ConversationMenu.numitems = ConversationItems.Size();
if (CurNode != PrevNode)
{ // Only reset the selection if showing a different menu.
ConversationMenu.lastOn = 0;
PrevNode = CurNode;
}
ConversationMenu.DontDim = true;
// Determine where the top of the reply list should be positioned.
i = (gameinfo.gametype & GAME_Raven) ? 9 : 8;
ConversationMenu.y = MIN<int> (140, 192 - ConversationItems.Size() * i);
for (i = 0; DialogueLines[i].Width >= 0; ++i)
{ }
i = 44 + i * 10;
if (ConversationMenu.y - 100 < i - screen->GetHeight() / CleanYfac / 2)
{
ConversationMenu.y = i - screen->GetHeight() / CleanYfac / 2 + 100;
}
ConversationMenu.indent = 50;
// And open the menu
M_StartControlPanel (false);
OptionsActive = true;
menuactive = MENU_OnNoPause;
ConversationPauseTic = gametic + 20;
M_SwitchMenu (&ConversationMenu);
// Finish setting up the menu
ConversationMenu.items = &ConversationItems[0];
ConversationMenu.numitems = ConversationItems.Size();
if (CurNode != PrevNode)
{ // Only reset the selection if showing a different menu.
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);
}
}
//============================================================================

View File

@ -419,10 +419,12 @@ static const char *skinsoundnames[NUMSKINSOUNDS][2] =
{ "dsjump", "*jump" }
};
/*
static int STACK_ARGS skinsorter (const void *a, const void *b)
{
return stricmp (((FPlayerSkin *)a)->name, ((FPlayerSkin *)b)->name);
}
*/
void R_InitSkins (void)
{
@ -782,6 +784,19 @@ int R_FindSkin (const char *name, int 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 ();
max = (int)numskins-1;
@ -805,6 +820,7 @@ int R_FindSkin (const char *name, int pclass)
max = mid - 1;
}
}
*/
return pclass;
}
@ -932,7 +948,7 @@ void R_InitSprites ()
}
// [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()