Merge branch 'master' into ExtraMercs

This commit is contained in:
Asdow
2023-07-26 13:17:49 +03:00
754 changed files with 9435 additions and 74371 deletions
+80 -16
View File
@@ -1,7 +1,3 @@
#ifdef PRECOMPILEDHEADERS
#include "Strategic All.h"
#include "GameSettings.h"
#else
#include "sgp.h"
#include "message.h"
#include "quests.h"
@@ -32,7 +28,6 @@
#include "strategic.h"
#include "Strategic Event Handler.h"
#include "Soldier Control.h"
#endif
#include "BobbyRMailOrder.h"
#include "connect.h"
@@ -1601,9 +1596,7 @@ void CheckForQuests( UINT32 uiDay )
{
// This function gets called at 8:00 AM time of the day
#ifdef TESTQUESTS
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay );
#endif
#ifdef JA2UB
// -------------------------------------------------------------------------------
@@ -1614,9 +1607,7 @@ void CheckForQuests( UINT32 uiDay )
if( gubQuest[ QUEST_DESTROY_MISSLES ] == QUESTNOTSTARTED )
{
StartQuest( QUEST_DESTROY_MISSLES, -1, -1 );
#ifdef TESTQUESTS
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DESTORY MISSLES quest");
#endif
}
//Ja25: No deliver letter quest, dont start it
#else
@@ -1628,11 +1619,9 @@ void CheckForQuests( UINT32 uiDay )
if (gubQuest[QUEST_DELIVER_LETTER] == QUESTNOTSTARTED)
{
StartQuest( QUEST_DELIVER_LETTER, -1, -1 );
#ifdef TESTQUESTS
if (!is_networked)
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest");
#endif
}
#endif
// This quest gets turned OFF through conversation with Miguel - when user hands
@@ -1742,9 +1731,84 @@ void GiveQuestRewardPoint( INT16 sQuestSectorX, INT16 sQuestsSectorY, INT8 bExpR
}
}
void HandlePOWQuestState(PowQuestState state, Quests quest, INT16 mapX, INT16 mapY, INT8 mapZ)
{
#ifndef JA2UB
bool correctSector = false;
switch (quest)
{
case QUEST_HELD_IN_ALMA:
correctSector = (mapX == gModSettings.ubInitialPOWSectorX && mapY == gModSettings.ubInitialPOWSectorY && mapZ == 0);
break;
case QUEST_INTERROGATION:
correctSector = (mapX == gModSettings.ubMeanwhileInterrogatePOWSectorX && mapY == gModSettings.ubMeanwhileInterrogatePOWSectorY && mapZ == 0);
break;
case QUEST_HELD_IN_TIXA:
correctSector = (mapX == gModSettings.ubTixaPrisonSectorX && mapY == gModSettings.ubTixaPrisonSectorY && mapZ == 0);
break;
default:
break;
}
if (correctSector)
{
switch (state)
{
case Q_FAIL:
// End quest if player loses prison
if (gubQuest[quest] == QUESTINPROGRESS)
{
// Quest failed
InternalEndQuest(quest, mapX, mapY, FALSE);
}
else if (gubQuest[quest] == QUESTCANNOTSTART)
{
// Re-enable quest if player loses control of the prison and quest was disabled previously
gubQuest[quest] = QUESTNOTSTARTED;
}
break;
case Q_SUCCESS:
// End quest if player takes control of the prison
if (gubQuest[quest] == QUESTINPROGRESS)
{
// Complete quest
EndQuest(quest, mapX, mapY);
}
else if (gubQuest[quest] == QUESTNOTSTARTED)
{
// Disable quest if player takes control of the prison
gubQuest[quest] = QUESTCANNOTSTART;
}
break;
case Q_RESET:
// Re-enable quest if player loses control of the prison and quest was disabled previously
if (gubQuest[quest] == QUESTCANNOTSTART)
{
gubQuest[quest] = QUESTNOTSTARTED;
}
break;
case Q_END:
if (gubQuest[quest] == QUESTINPROGRESS)
{
EndQuest(quest, mapX, mapY);
HandleNPCDoAction(0, NPC_ACTION_GRANT_EXPERIENCE_3, 0);
}
break;
case Q_LEFT_SECTOR:
// End interrogation quest if we left the sector, but haven't killed all enemies
if (gubQuest[quest] == QUESTINPROGRESS)
{
// Finish quest, although not give points here...
InternalEndQuest(quest, mapX, mapY, FALSE);
// ... give them manually, but halved
GiveQuestRewardPoint(mapX, mapY, 4, NO_PROFILE);
// Also let us know we finished the quest
ResetHistoryFact(quest, mapX, mapY);
}
break;
default:
break;
}
}
#endif
}