* Center Abort Skirmish game dialog

* Savegame compatible centering of skirmish start
This commit is contained in:
Ben Lankamp
2020-06-18 22:26:39 +02:00
parent 71007c06d0
commit 720e7064d1
3 changed files with 16 additions and 13 deletions
+1 -1
View File
@@ -523,7 +523,7 @@ class HouseClass {
** the base.
*/
COORDINATE Center; // Center COORDINATE of the base.
CELL CenterCell; // Center CELL of the base.
//CELL CenterCell; // Center CELL of the base.
int Radius; // Average building distance from center (leptons).
struct {
int AirDefense;
+11 -8
View File
@@ -619,10 +619,7 @@ int Surrender_Dialog(int text)
//------------------------------------------------------------------------
enum {
D_DIALOG_W = 240*RESFACTOR, // dialog width
D_DIALOG_H = 63*RESFACTOR, // dialog height
D_DIALOG_X = ((320*RESFACTOR - D_DIALOG_W) / 2),// centered x-coord
D_DIALOG_Y = ((200*RESFACTOR - D_DIALOG_H) / 2),// centered y-coord
D_DIALOG_CX = D_DIALOG_X + (D_DIALOG_W / 2), // coord of x-center
D_DIALOG_H = 63*RESFACTOR, // dialog height
D_TXT6_H = 7*RESFACTOR, // ht of 6-pt text
D_MARGIN = 5*RESFACTOR, // margin width/height
@@ -630,13 +627,9 @@ int Surrender_Dialog(int text)
D_OK_W = 45*RESFACTOR, // OK width
D_OK_H = 9*RESFACTOR, // OK height
D_OK_X = D_DIALOG_CX - D_OK_W - 5*RESFACTOR, // OK x
D_OK_Y = D_DIALOG_Y + D_DIALOG_H - D_OK_H - D_MARGIN*2, // OK y
D_CANCEL_W = 45*RESFACTOR, // Cancel width
D_CANCEL_H = 9*RESFACTOR, // Cancel height
D_CANCEL_X = D_DIALOG_CX + 5*RESFACTOR, // Cancel x
D_CANCEL_Y = D_DIALOG_Y + D_DIALOG_H - D_CANCEL_H - D_MARGIN*2, // Cancel y
};
//------------------------------------------------------------------------
@@ -647,6 +640,16 @@ int Surrender_Dialog(int text)
BUTTON_CANCEL,
};
int D_DIALOG_X = (SeenBuff.Get_Width() - D_DIALOG_W) / 2; // centered x-coord
int D_DIALOG_Y = (SeenBuff.Get_Height() - D_DIALOG_H) / 2; // centered y-coord
int D_DIALOG_CX = D_DIALOG_X + (D_DIALOG_W / 2); // coord of x-center
int D_OK_X = D_DIALOG_CX - D_OK_W - 5 * RESFACTOR; // OK x
int D_OK_Y = D_DIALOG_Y + D_DIALOG_H - D_OK_H - D_MARGIN * 2; // OK y
int D_CANCEL_X = D_DIALOG_CX + 5 * RESFACTOR; // Cancel x
int D_CANCEL_Y = D_DIALOG_Y + D_DIALOG_H - D_CANCEL_H - D_MARGIN * 2; // Cancel y
//------------------------------------------------------------------------
// Buttons
//------------------------------------------------------------------------
+4 -4
View File
@@ -400,7 +400,7 @@ bool Start_Scenario(char * name, bool briefing)
if (Scen.BriefMovie != VQ_NONE) {
sprintf(buffer, "%s.VQA", VQName[Scen.BriefMovie]);
}
if (Session.Type == GAME_NORMAL && Scen.BriefMovie == VQ_NONE || !CCFileClass(buffer).Is_Available()) {
if (Session.Type == GAME_NORMAL && ( Scen.BriefMovie == VQ_NONE || !CCFileClass(buffer).Is_Available() ) ) {
/*
** Make sure the mouse is visible before showing the restatement.
*/
@@ -649,8 +649,9 @@ void Fill_In_Data(void)
Map.Set_Tactical_Position(Cell_Coord((Scen.Waypoint[WAYPT_HOME] - (MAP_CELL_W * 4 * RESFACTOR)) - (5*RESFACTOR)));
}
if (Session.Type == GAME_SKIRMISH) {
Scen.Views[0] = Scen.Views[1] = Scen.Views[2] = Scen.Views[3] = PlayerPtr->CenterCell;
Map.Set_Tactical_Position( Cell_Coord( (PlayerPtr->CenterCell - (MAP_CELL_W * 4 * RESFACTOR) ) - (5 * RESFACTOR) ) );
CELL PlayerCenterCell = XY_Cell( Coord_XCell(PlayerPtr->Center), Coord_YCell( PlayerPtr->Center) );
Scen.Views[0] = Scen.Views[1] = Scen.Views[2] = Scen.Views[3] = PlayerCenterCell;
Map.Set_Tactical_Position( Cell_Coord( (PlayerCenterCell - (MAP_CELL_W * 4 * RESFACTOR) ) - (5 * RESFACTOR) ) );
}
}
#endif
@@ -3244,7 +3245,6 @@ static void Create_Units(bool official)
** Assign the center of this house to the waypoint location.
*/
hptr->Center = Cell_Coord(centroid);
hptr->CenterCell = centroid;
/*
** If Bases are ON, human & computer houses are treated differently