- Fixed: With opl_onechip set the second OPL chip was never set to anything valid

so it contained an invalid pointer. There were also a few other places that
  simply assumed that the second chip is set to something valid.
- Fixed: NPCs which are engaged in a conversation should not move.
- Fixed: Player movement animation was not stopped when starting a conversation.


SVN r1439 (trunk)
This commit is contained in:
Christoph Oelckers 2009-02-22 10:25:12 +00:00
parent 10c31b82cb
commit eb47f4fdbf
10 changed files with 48 additions and 4 deletions

View file

@ -1,4 +1,11 @@
February 21, 2009 February 22, 2009 (Changes by Graf Zahl)
- Fixed: With opl_onechip set the second OPL chip was never set to anything valid
so it contained an invalid pointer. There were also a few other places that
simply assumed that the second chip is set to something valid.
- Fixed: NPCs which are engaged in a conversation should not move.
- Fixed: Player movement animation was not stopped when starting a conversation.
February 21, 2009
- Added selective compression of network packets. Interestingly, most packets - Added selective compression of network packets. Interestingly, most packets
don't actually compress all that well, even the ones that aren't too short don't actually compress all that well, even the ones that aren't too short
to possibly compress. (Maybe make the whole thing one long, never-ending to possibly compress. (Maybe make the whole thing one long, never-ending

View file

@ -305,6 +305,7 @@ enum
MF5_NOVERTICALMELEERANGE=0x04000000,// Does not check vertical distance for melee range MF5_NOVERTICALMELEERANGE=0x04000000,// Does not check vertical distance for melee range
MF5_BRIGHT = 0x08000000, // Actor is always rendered fullbright MF5_BRIGHT = 0x08000000, // Actor is always rendered fullbright
MF5_CANTSEEK = 0x10000000, // seeker missiles cannot home in on this actor MF5_CANTSEEK = 0x10000000, // seeker missiles cannot home in on this actor
MF5_INCONVERSATION = 0x20000000, // Actor is having a conversation
// --- mobj.renderflags --- // --- mobj.renderflags ---

View file

@ -465,6 +465,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_TurretLook)
{ {
AActor *target; AActor *target;
if (self->flags5 & MF5_INCONVERSATION)
return;
self->threshold = 0; self->threshold = 0;
target = self->LastHeard; target = self->LastHeard;
if (target != NULL && if (target != NULL &&

View file

@ -1908,7 +1908,6 @@ void YM3812SetUpdateHandler(void *chip,OPL_UPDATEHANDLER UpdateHandler,int param
void YM3812UpdateOne(void *chip, float *buffer, int length) void YM3812UpdateOne(void *chip, float *buffer, int length)
{ {
FM_OPL *OPL = (FM_OPL *)chip; FM_OPL *OPL = (FM_OPL *)chip;
UINT8 rhythm = OPL->rhythm&0x20;
int i; int i;
if (OPL == NULL) if (OPL == NULL)
@ -1916,6 +1915,8 @@ void YM3812UpdateOne(void *chip, float *buffer, int length)
return; return;
} }
UINT8 rhythm = OPL->rhythm&0x20;
UINT32 lfo_am_cnt_bak = OPL->lfo_am_cnt; UINT32 lfo_am_cnt_bak = OPL->lfo_am_cnt;
UINT32 eg_timer_bak = OPL->eg_timer; UINT32 eg_timer_bak = OPL->eg_timer;
UINT32 eg_cnt_bak = OPL->eg_cnt; UINT32 eg_cnt_bak = OPL->eg_cnt;

View file

@ -302,6 +302,7 @@ int OPLio::OPLinit(uint numchips)
{ {
assert(numchips >= 1 && numchips <= 2); assert(numchips >= 1 && numchips <= 2);
chips[0] = YM3812Init (3579545, int(OPL_SAMPLE_RATE)); chips[0] = YM3812Init (3579545, int(OPL_SAMPLE_RATE));
chips[1] = NULL;
if (chips[0] != NULL) if (chips[0] != NULL)
{ {
if (numchips > 1) if (numchips > 1)

View file

@ -464,7 +464,7 @@ OPLmusicFile::OPLmusicFile(const OPLmusicFile *source, const char *filename)
delete io; delete io;
} }
io = new DiskWriterIO(filename); io = new DiskWriterIO(filename);
io->OPLinit(TwoChips); io->OPLinit(TwoChips + 1);
Restart(); Restart();
} }

View file

@ -659,6 +659,9 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
const char *toSay; const char *toSay;
int i, j; int i, j;
// Make sure this is actually a player.
if (pc->player == NULL) return;
// [CW] If an NPC is talking to a PC already, then don't let // [CW] If an NPC is talking to a PC already, then don't let
// anyone else talk to the NPC. // anyone else talk to the NPC.
for (i = 0; i < MAXPLAYERS; i++) for (i = 0; i < MAXPLAYERS; i++)
@ -672,9 +675,11 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang
pc->momx = pc->momy = 0; // Stop moving pc->momx = pc->momy = 0; // Stop moving
pc->player->momx = pc->player->momy = 0; pc->player->momx = pc->player->momy = 0;
static_cast<APlayerPawn*>(pc)->PlayIdle ();
pc->player->ConversationPC = pc; pc->player->ConversationPC = pc;
pc->player->ConversationNPC = npc; pc->player->ConversationNPC = npc;
npc->flags5 |= MF5_INCONVERSATION;
FStrifeDialogueNode *CurNode = npc->Conversation; FStrifeDialogueNode *CurNode = npc->Conversation;
@ -947,6 +952,8 @@ static void PickConversationReply ()
{ {
Net_WriteByte (DEM_CONVERSATION); Net_WriteByte (DEM_CONVERSATION);
Net_WriteByte (CONV_NPCANGLE); Net_WriteByte (CONV_NPCANGLE);
Net_WriteByte (DEM_CONVERSATION);
Net_WriteByte (CONV_CLOSE);
return; return;
} }
@ -966,6 +973,8 @@ static void PickConversationReply ()
Net_WriteByte (DEM_CONVERSATION); Net_WriteByte (DEM_CONVERSATION);
Net_WriteByte (CONV_NPCANGLE); Net_WriteByte (CONV_NPCANGLE);
Net_WriteByte (DEM_CONVERSATION);
Net_WriteByte (CONV_CLOSE);
return; return;
} }
} }
@ -1189,7 +1198,13 @@ void P_ConversationCommand (int player, BYTE **stream)
players[player].ConversationNPC = NULL; players[player].ConversationNPC = NULL;
players[player].ConversationPC = NULL; players[player].ConversationPC = NULL;
players[player].ConversationNPCAngle = 0; players[player].ConversationNPCAngle = 0;
break; // fall through
case CONV_CLOSE:
if (players[player].ConversationNPC != NULL)
{
players[player].ConversationNPC->flags5 &= ~MF5_INCONVERSATION;
}
default: default:
break; break;

View file

@ -55,6 +55,7 @@ enum
CONV_GIVEINVENTORY, CONV_GIVEINVENTORY,
CONV_TAKEINVENTORY, CONV_TAKEINVENTORY,
CONV_SETNULL, CONV_SETNULL,
CONV_CLOSE,
}; };
extern TArray<FStrifeDialogueNode *> StrifeDialogues; extern TArray<FStrifeDialogueNode *> StrifeDialogues;

View file

@ -1538,6 +1538,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look)
{ {
AActor *targ; AActor *targ;
if (self->flags5 & MF5_INCONVERSATION)
return;
// [RH] Set goal now if appropriate // [RH] Set goal now if appropriate
if (self->special == Thing_SetGoal && self->args[0] == 0) if (self->special == Thing_SetGoal && self->args[0] == 0)
{ {
@ -1652,6 +1655,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Wander)
// This seems as good a place as any. // This seems as good a place as any.
self->flags4 &= ~MF4_INCOMBAT; self->flags4 &= ~MF4_INCOMBAT;
if (self->flags5 & MF5_INCONVERSATION)
return;
if (self->flags4 & MF4_STANDSTILL) if (self->flags4 & MF4_STANDSTILL)
return; return;
@ -1693,6 +1699,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look2)
{ {
AActor *targ; AActor *targ;
if (self->flags5 & MF5_INCONVERSATION)
return;
self->threshold = 0; self->threshold = 0;
targ = self->LastHeard; targ = self->LastHeard;
@ -1753,6 +1762,9 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
{ {
int delta; int delta;
if (actor->flags5 & MF5_INCONVERSATION)
return;
if (actor->flags & MF_INCHASE) if (actor->flags & MF_INCHASE)
{ {
return; return;

View file

@ -724,6 +724,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LookEx)
AActor *targ = NULL; // Shuts up gcc AActor *targ = NULL; // Shuts up gcc
fixed_t dist; fixed_t dist;
if (self->flags5 & MF5_INCONVERSATION)
return;
// [RH] Set goal now if appropriate // [RH] Set goal now if appropriate
if (self->special == Thing_SetGoal && self->args[0] == 0) if (self->special == Thing_SetGoal && self->args[0] == 0)
{ {