When talking to an enemy, we can surrender to him if he hasn't asked us to before.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5793 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-01-19 20:22:51 +00:00
parent f8531461d3
commit d55a57007d
14 changed files with 96 additions and 10 deletions
+1
View File
@@ -1570,6 +1570,7 @@ void LoadGameExternalOptions()
// Flugente: prisoner system
gGameExternalOptions.fAllowPrisonerSystem = iniReader.ReadBoolean("Strategic Gameplay Settings","ALLOW_TAKE_PRISONERS", TRUE);
gGameExternalOptions.fEnemyCanSurrender = iniReader.ReadBoolean("Strategic Gameplay Settings","ENEMY_CAN_SURRENDER", TRUE);
gGameExternalOptions.fPlayerCanAsktoSurrender = iniReader.ReadBoolean("Strategic Gameplay Settings","PLAYER_CAN_ASK_TO_SURRENDER", TRUE);
gGameExternalOptions.ubPrisonerReturntoQueenChance = iniReader.ReadInteger("Strategic Gameplay Settings","PRISONER_RETURN_TO_ARMY_CHANCE", 50, 0, 100);
gGameExternalOptions.ubPrisonerProcessDefectChance = iniReader.ReadInteger("Strategic Gameplay Settings","PRISONER_DEFECT_CHANCE", 10, 0, 100);
gGameExternalOptions.ubPrisonerProcessInfoBaseChance = iniReader.ReadInteger("Strategic Gameplay Settings","PRISONER_INFO_BASECHANCE", 10, 0, 100);
+1
View File
@@ -1170,6 +1170,7 @@ typedef struct
// Flugente: prisoner related settings
BOOLEAN fAllowPrisonerSystem;
BOOLEAN fEnemyCanSurrender;
BOOLEAN fPlayerCanAsktoSurrender;
UINT8 ubPrisonerReturntoQueenChance;
UINT8 ubPrisonerProcessDefectChance;
UINT8 ubPrisonerProcessInfoBaseChance;
+64 -8
View File
@@ -10048,21 +10048,28 @@ static UINT8 prisonerdialoguetargetID = 0;
void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue )
{
if (ubExitValue == MSG_BOX_RETURN_YES)
SOLDIERTYPE *pSoldier = NULL;
UINT32 uiCnt=0;
BOOLEAN success = FALSE;
if ( ubExitValue == 1 )
{
if ( !gGameExternalOptions.fEnemyCanSurrender )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[ SRT_PRISONER_INI_SETTING_OFF ] );
return;
}
// we have to remove the region, as we are calling a message from within a messagebox
MSYS_RemoveRegion(&(gMsgBox.BackRegion) );
// we determine the chance that enemy will surrender. This depends on the strength of our and their side
UINT32 playersidestrength = 0;
UINT32 enemysidestrength = 0;
SOLDIERTYPE *pSoldier = NULL;
UINT32 uiCnt=0;
// player team
UINT32 firstid = gTacticalStatus.Team[ OUR_TEAM ].bFirstID;
UINT32 lastid = gTacticalStatus.Team[ OUR_TEAM ].bLastID;
UINT32 firstid = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
UINT32 lastid = gTacticalStatus.Team[ gbPlayerNum ].bLastID;
for ( uiCnt = firstid, pSoldier = MercPtrs[ uiCnt ]; uiCnt <= lastid; ++uiCnt, ++pSoldier)
{
if( pSoldier->bActive && ( pSoldier->sSectorX == gWorldSectorX ) && ( pSoldier->sSectorY == gWorldSectorY ) && ( pSoldier->bSectorZ == gbWorldSectorZ) )
@@ -10137,6 +10144,55 @@ void PrisonerSurrenderMessageBoxCallBack( UINT8 ubExitValue )
}
}
}
// we offered to surrender OURSELVES TO the enemy
else if ( ubExitValue == 2 )
{
if ( !gGameExternalOptions.fPlayerCanAsktoSurrender )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[ SRT_PRISONER_INI_SETTING_OFF ] );
return;
}
// in order for this to work, there must be no militia present, the enemy must not already have offered asked you to surrender, and certain quests may not be active
if ( !( gTacticalStatus.fEnemyFlags & ENEMY_OFFERED_SURRENDER ) && gTacticalStatus.Team[ MILITIA_TEAM ].bMenInSector == 0 )
{
if ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTNOTSTARTED || ( gubQuest[ QUEST_HELD_IN_ALMA ] == QUESTDONE && gubQuest[ QUEST_INTERROGATION ] == QUESTNOTSTARTED ) )
{
gTacticalStatus.fEnemyFlags |= ENEMY_OFFERED_SURRENDER;
// CJC Dec 1 2002: fix multiple captures
BeginCaptureSquence();
// Do capture....
uiCnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
for ( pSoldier = MercPtrs[ uiCnt ]; uiCnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++uiCnt, ++pSoldier)
{
// Are we active and in sector.....
if ( pSoldier->bActive && pSoldier->bInSector )
{
if ( pSoldier->stats.bLife != 0 )
{
EnemyCapturesPlayerSoldier( pSoldier );
RemoveSoldierFromTacticalSector( pSoldier, TRUE );
}
}
}
EndCaptureSequence( );
gfSurrendered = TRUE;
SetCustomizableTimerCallbackAndDelay( 3000, CaptureTimerCallback, FALSE );
success = TRUE;
}
}
if ( !success )
{
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, szPrisonerTextStr[ STR_PRISONER_REFUSE_TAKE_PRISONERS ] );
}
}
else
{
// normal dialog
@@ -10157,5 +10213,5 @@ void HandleSurrenderOffer( SOLDIERTYPE* pSoldier )
prisonerdialoguetargetID = pSoldier->ubID;
// open a dialogue box and see wether we really want to offer this, or just talk
DoMessageBox( MSG_BOX_BASIC_STYLE, TacticalStr[ PRISONER_OFFER_SURRENDER ], guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_YESNO, PrisonerSurrenderMessageBoxCallBack, NULL );
DoMessageBox( MSG_BOX_BASIC_SMALL_BUTTONS, TacticalStr[ PRISONER_OFFER_SURRENDER ], guiCurrentScreen, ( UINT8 )MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, PrisonerSurrenderMessageBoxCallBack, NULL );
}
+1 -1
View File
@@ -16980,7 +16980,7 @@ BOOLEAN SOLDIERTYPE::PlayerSoldierStartTalking( UINT8 ubTargetID, BOOLEAN fValid
apsDeducted = TRUE;
// Flugente: if we are talking to an enemy, we have the option to offer them surrendering... but not on y levels >= 16 (no surrendering in the palace, as we have to kill, not capture, the queen)
if ( pTSoldier->bTeam == ENEMY_TEAM && gGameExternalOptions.fEnemyCanSurrender && gWorldSectorY < WORLD_MAP_X - 2 )
if ( pTSoldier->bTeam == ENEMY_TEAM && (gGameExternalOptions.fEnemyCanSurrender || gGameExternalOptions.fPlayerCanAsktoSurrender) && gWorldSectorY < WORLD_MAP_X - 2 )
{
HandleSurrenderOffer(pTSoldier);
return( FALSE );
+2
View File
@@ -742,6 +742,8 @@ enum
STR_PRISONER_RELEASED,
STR_PRISONER_ARMY_FREED_PRISON,
STR_PRISONER_REFUSE_SURRENDER,
STR_PRISONER_REFUSE_TAKE_PRISONERS,
SRT_PRISONER_INI_SETTING_OFF,
TEXT_NUM_PRISONER_STR
};
+3
View File
@@ -2920,6 +2920,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"你现在没有可用的监狱关押这些俘虏,你不得不放他们走。", //L"You have no prison for these prisoners, you have to let them go",
L"Yes - 将俘虏送入监狱 No - 放俘虏离开这里", //L"Yes - Send prisoners to jail No - Let them go",
L"劝说敌人投降?", //L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk", // TODO.Translate
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7507,6 +7508,8 @@ STR16 szPrisonerTextStr[]=
L"俘虏已被释放!", //L"Prisoners have been released!",
L"军队已占领 %s 监狱,俘虏已被释放!", //L"The army now occupies the prison in %s, the prisoners were freed!",
L"这敌人丫宁死不从!",//L"The enemy refuses to surrender!",
L"The enemy refuses to take you as prisoners - they prefer you dead!", // TODO.Translate
L"This behaviour is set OFF in your ini settings.",
};
STR16 szMTATextStr[]= // TODO.Translate
+3
View File
@@ -2917,6 +2917,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"You have no prison for these prisoners, you have to let them go",
L"Yes - Send prisoners to jail No - Let them go",
L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7505,6 +7506,8 @@ STR16 szPrisonerTextStr[]=
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
L"The enemy refuses to surrender!",
L"The enemy refuses to take you as prisoners - they prefer you dead!", // TODO.Translate
L"This behaviour is set OFF in your ini settings.",
};
STR16 szMTATextStr[]= // TODO.Translate
+3 -1
View File
@@ -2918,7 +2918,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
// added by Flugente: decide what to do with prisoners
L"You have no prison for these prisoners, you have to let them go",
L"Yes - Send prisoners to jail No - Let them go",
L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7492,6 +7492,8 @@ STR16 szPrisonerTextStr[]=
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
L"The enemy refuses to surrender!",
L"The enemy refuses to take you as prisoners - they prefer you dead!",
L"This behaviour is set OFF in your ini settings.",
};
STR16 szMTATextStr[]=
+3
View File
@@ -2924,6 +2924,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"You have no prison for these prisoners, you have to let them go",
L"Yes - Send prisoners to jail No - Let them go",
L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk", // TODO.Translate
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7484,6 +7485,8 @@ STR16 szPrisonerTextStr[]=
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
L"The enemy refuses to surrender!",
L"The enemy refuses to take you as prisoners - they prefer you dead!", // TODO.Translate
L"This behaviour is set OFF in your ini settings.",
};
STR16 szMTATextStr[]= // TODO.Translate
+3
View File
@@ -2922,6 +2922,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"You have no prison for these prisoners, you have to let them go",
L"Yes - Send prisoners to jail No - Let them go",
L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk", // TODO.Translate
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7319,6 +7320,8 @@ STR16 szPrisonerTextStr[]=
L"Gefangene freigelassen!",
L"Die Armee hat das Gefängnis in %s besetzt, die Gefangenen wurden befreit!",
L"Der Gegner weigert sich aufzugeben!",
L"Der Gegner will uns tot sehen!",
L"Dieses Feature ist in der ini auf AUS gesetzt.",
};
STR16 szMTATextStr[]= // TODO.Translate
+3
View File
@@ -2912,6 +2912,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"You have no prison for these prisoners, you have to let them go",
L"Yes - Send prisoners to jail No - Let them go",
L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk", // TODO.Translate
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7492,6 +7493,8 @@ STR16 szPrisonerTextStr[]=
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
L"The enemy refuses to surrender!",
L"The enemy refuses to take you as prisoners - they prefer you dead!", // TODO.Translate
L"This behaviour is set OFF in your ini settings.",
};
STR16 szMTATextStr[]= // TODO.Translate
+3
View File
@@ -2927,6 +2927,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"You have no prison for these prisoners, you have to let them go",
L"Yes - Send prisoners to jail No - Let them go",
L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk", // TODO.Translate
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7506,6 +7507,8 @@ STR16 szPrisonerTextStr[]=
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
L"The enemy refuses to surrender!",
L"The enemy refuses to take you as prisoners - they prefer you dead!", // TODO.Translate
L"This behaviour is set OFF in your ini settings.",
};
STR16 szMTATextStr[]= // TODO.Translate
+3
View File
@@ -2920,6 +2920,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"You have no prison for these prisoners, you have to let them go",
L"Yes - Send prisoners to jail No - Let them go",
L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk", // TODO.Translate
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7458,6 +7459,8 @@ STR16 szPrisonerTextStr[]=
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
L"The enemy refuses to surrender!",
L"The enemy refuses to take you as prisoners - they prefer you dead!", // TODO.Translate
L"This behaviour is set OFF in your ini settings.",
};
STR16 szMTATextStr[]= // TODO.Translate
+3
View File
@@ -2921,6 +2921,7 @@ CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
L"You have no prison for these prisoners, you have to let them go",
L"Yes - Send prisoners to jail No - Let them go",
L"Ask enemy for surrender?",
L"1 - Ask enemy for surrender 2 - Surrender to enemy 3,4 - Talk", // TODO.Translate
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
@@ -7509,6 +7510,8 @@ STR16 szPrisonerTextStr[]=
L"Prisoners have been released!",
L"The army now occupies the prison in %s, the prisoners were freed!",
L"The enemy refuses to surrender!",
L"The enemy refuses to take you as prisoners - they prefer you dead!", // TODO.Translate
L"This behaviour is set OFF in your ini settings.",
};
STR16 szMTATextStr[]= // TODO.Translate