diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c50f7d8ed..bb7a05666 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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 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 diff --git a/src/actor.h b/src/actor.h index 1f581764d..17276366d 100644 --- a/src/actor.h +++ b/src/actor.h @@ -305,6 +305,7 @@ enum MF5_NOVERTICALMELEERANGE=0x04000000,// Does not check vertical distance for melee range MF5_BRIGHT = 0x08000000, // Actor is always rendered fullbright MF5_CANTSEEK = 0x10000000, // seeker missiles cannot home in on this actor + MF5_INCONVERSATION = 0x20000000, // Actor is having a conversation // --- mobj.renderflags --- diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index abd2cb2a8..36a1e3ec9 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -465,6 +465,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_TurretLook) { AActor *target; + if (self->flags5 & MF5_INCONVERSATION) + return; + self->threshold = 0; target = self->LastHeard; if (target != NULL && diff --git a/src/oplsynth/fmopl.cpp b/src/oplsynth/fmopl.cpp index 9bab8bbdc..40efe3164 100644 --- a/src/oplsynth/fmopl.cpp +++ b/src/oplsynth/fmopl.cpp @@ -1908,7 +1908,6 @@ void YM3812SetUpdateHandler(void *chip,OPL_UPDATEHANDLER UpdateHandler,int param void YM3812UpdateOne(void *chip, float *buffer, int length) { FM_OPL *OPL = (FM_OPL *)chip; - UINT8 rhythm = OPL->rhythm&0x20; int i; if (OPL == NULL) @@ -1916,6 +1915,8 @@ void YM3812UpdateOne(void *chip, float *buffer, int length) return; } + UINT8 rhythm = OPL->rhythm&0x20; + UINT32 lfo_am_cnt_bak = OPL->lfo_am_cnt; UINT32 eg_timer_bak = OPL->eg_timer; UINT32 eg_cnt_bak = OPL->eg_cnt; diff --git a/src/oplsynth/mlopl_io.cpp b/src/oplsynth/mlopl_io.cpp index 23dbf8e6b..614c11f59 100644 --- a/src/oplsynth/mlopl_io.cpp +++ b/src/oplsynth/mlopl_io.cpp @@ -302,6 +302,7 @@ int OPLio::OPLinit(uint numchips) { assert(numchips >= 1 && numchips <= 2); chips[0] = YM3812Init (3579545, int(OPL_SAMPLE_RATE)); + chips[1] = NULL; if (chips[0] != NULL) { if (numchips > 1) diff --git a/src/oplsynth/opl_mus_player.cpp b/src/oplsynth/opl_mus_player.cpp index 74063cd90..05b070667 100644 --- a/src/oplsynth/opl_mus_player.cpp +++ b/src/oplsynth/opl_mus_player.cpp @@ -464,7 +464,7 @@ OPLmusicFile::OPLmusicFile(const OPLmusicFile *source, const char *filename) delete io; } io = new DiskWriterIO(filename); - io->OPLinit(TwoChips); + io->OPLinit(TwoChips + 1); Restart(); } diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index ed3846153..7e97c878b 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -659,6 +659,9 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang const char *toSay; 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 // anyone else talk to the NPC. 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->player->momx = pc->player->momy = 0; + static_cast(pc)->PlayIdle (); pc->player->ConversationPC = pc; pc->player->ConversationNPC = npc; + npc->flags5 |= MF5_INCONVERSATION; FStrifeDialogueNode *CurNode = npc->Conversation; @@ -947,6 +952,8 @@ static void PickConversationReply () { Net_WriteByte (DEM_CONVERSATION); Net_WriteByte (CONV_NPCANGLE); + Net_WriteByte (DEM_CONVERSATION); + Net_WriteByte (CONV_CLOSE); return; } @@ -966,6 +973,8 @@ static void PickConversationReply () Net_WriteByte (DEM_CONVERSATION); Net_WriteByte (CONV_NPCANGLE); + Net_WriteByte (DEM_CONVERSATION); + Net_WriteByte (CONV_CLOSE); return; } } @@ -1189,7 +1198,13 @@ void P_ConversationCommand (int player, BYTE **stream) players[player].ConversationNPC = NULL; players[player].ConversationPC = NULL; players[player].ConversationNPCAngle = 0; - break; + // fall through + case CONV_CLOSE: + if (players[player].ConversationNPC != NULL) + { + players[player].ConversationNPC->flags5 &= ~MF5_INCONVERSATION; + } + default: break; diff --git a/src/p_conversation.h b/src/p_conversation.h index 7244521c2..a6da8a8b6 100644 --- a/src/p_conversation.h +++ b/src/p_conversation.h @@ -55,6 +55,7 @@ enum CONV_GIVEINVENTORY, CONV_TAKEINVENTORY, CONV_SETNULL, + CONV_CLOSE, }; extern TArray StrifeDialogues; diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index c41a58dfd..9a1bb0e19 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1538,6 +1538,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look) { AActor *targ; + if (self->flags5 & MF5_INCONVERSATION) + return; + // [RH] Set goal now if appropriate 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. self->flags4 &= ~MF4_INCOMBAT; + if (self->flags5 & MF5_INCONVERSATION) + return; + if (self->flags4 & MF4_STANDSTILL) return; @@ -1693,6 +1699,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look2) { AActor *targ; + if (self->flags5 & MF5_INCONVERSATION) + return; + self->threshold = 0; targ = self->LastHeard; @@ -1753,6 +1762,9 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi { int delta; + if (actor->flags5 & MF5_INCONVERSATION) + return; + if (actor->flags & MF_INCHASE) { return; diff --git a/src/p_enemy_a_lookex.cpp b/src/p_enemy_a_lookex.cpp index f8ba31b86..96c154b1a 100644 --- a/src/p_enemy_a_lookex.cpp +++ b/src/p_enemy_a_lookex.cpp @@ -724,6 +724,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LookEx) AActor *targ = NULL; // Shuts up gcc fixed_t dist; + if (self->flags5 & MF5_INCONVERSATION) + return; + // [RH] Set goal now if appropriate if (self->special == Thing_SetGoal && self->args[0] == 0) {