Skip to content

Commit

Permalink
Abolish camera rotation at the start of every game for original maps.
Browse files Browse the repository at this point in the history
Patch by Forgon.
Closes ticket:4642
  • Loading branch information
perim committed Oct 24, 2017
1 parent c64a9a3 commit c83236b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/display.h
Expand Up @@ -205,7 +205,7 @@ void setDesiredPitch(SDWORD pitch);
#define CAMERA_PIVOT_HEIGHT (500)

#define INITIAL_STARTING_PITCH (-40)
#define INITIAL_DESIRED_ROTATION (-45)
#define OLD_INITIAL_ROTATION (-45) // only used in savegames <= 10

#define HIDDEN_FRONTEND_WIDTH (640)
#define HIDDEN_FRONTEND_HEIGHT (480)
Expand Down
12 changes: 5 additions & 7 deletions src/display3d.cpp
Expand Up @@ -1112,7 +1112,9 @@ bool init3DView()
// distance is not saved, so initialise it now
distance = START_DISTANCE; // distance

disp3d_resetView(); // clear player view variables
player.r.z = 0; // roll
player.r.y = 0; // rotation
player.r.x = DEG(360 + INITIAL_STARTING_PITCH); // angle

if (!initTerrain())
{
Expand All @@ -1133,13 +1135,9 @@ void disp3d_setView(iView *newView)
}

/// reset the camera rotation (used for save games <= 10)
void disp3d_resetView()
void disp3d_oldView()
{
player.r.z = 0; // roll
player.r.y = INITIAL_DESIRED_ROTATION; // rotation
player.r.x = DEG(360 + INITIAL_STARTING_PITCH); // angle

// and set the camera position
player.r.y = OLD_INITIAL_ROTATION; // rotation
player.p.y = START_HEIGHT; // height
}

Expand Down
2 changes: 1 addition & 1 deletion src/display3d.h
Expand Up @@ -66,7 +66,7 @@ void setViewPos(UDWORD x, UDWORD y, bool Pan);
Vector2i getPlayerPos();
void setPlayerPos(SDWORD x, SDWORD y);
void disp3d_setView(iView *newView);
void disp3d_resetView();
void disp3d_oldView(); // for save games <= 10
void disp3d_getView(iView *newView);

void draw3DScene();
Expand Down
17 changes: 3 additions & 14 deletions src/game.cpp
Expand Up @@ -1869,21 +1869,10 @@ bool loadGame(const char *pGameToLoad, bool keepObjects, bool freeMem, bool User
}
mission.apsOilList[0] = nullptr;
mission.apsSensorList[0] = nullptr;
}

if (saveGameVersion >= VERSION_11)
{
//camera position
disp3d_setView(&(saveGameData.currentPlayerPos));
}
else
{
disp3d_resetView();
}
// Stuff added after level load to avoid being reset or initialised during load
// always !keepObjects

//Stuff added after level load to avoid being reset or initialised during load
if (UserSaveGame)//always !keepObjects
{
if (saveGameVersion >= VERSION_12)
{
mission.startTime = saveGameData.missionTime;
Expand Down Expand Up @@ -3625,7 +3614,7 @@ bool gameLoadV(PHYSFS_file *fileHandle, unsigned int version)
}
else
{
disp3d_resetView();
disp3d_oldView();
}

//load mission data from save game these values reloaded after load game
Expand Down

0 comments on commit c83236b

Please sign in to comment.