Makes sure the camera position and rotation is again saved & loaded. The distance is not, but this would need changing the save game format. The
initial height is again a fixed value, instead of relative to the terrain height. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3633 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
aafbc90945
commit
ba8daddd8d
|
@ -197,6 +197,7 @@ extern void setDesiredPitch(SDWORD pitch);
|
|||
#define MAXDISTANCE (3500)
|
||||
#define MINDISTANCE (500)
|
||||
#define START_DISTANCE (2000)
|
||||
#define START_HEIGHT (1500)
|
||||
|
||||
#define CAMERA_PIVOT_HEIGHT (500)
|
||||
|
||||
|
|
|
@ -899,14 +899,6 @@ BOOL init3DView(void)
|
|||
|
||||
pie_PrepareSkybox(skyboxPageName);
|
||||
|
||||
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
|
||||
distance = START_DISTANCE; // distance
|
||||
player.p.y = 1000 + map_Height(player.r.x, player.r.z); // height
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -917,6 +909,18 @@ void disp3d_setView(iView *newView)
|
|||
memcpy(&player,newView,sizeof(iView));
|
||||
}
|
||||
|
||||
// reset the camera rotation
|
||||
void disp3d_resetView()
|
||||
{
|
||||
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
|
||||
distance = START_DISTANCE; // distance
|
||||
player.p.y = START_HEIGHT; // height
|
||||
}
|
||||
|
||||
// get the view position for save game
|
||||
void disp3d_getView(iView *newView)
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ extern void setViewPos( UDWORD x, UDWORD y, BOOL Pan);
|
|||
extern void getPlayerPos(SDWORD *px, SDWORD *py);
|
||||
extern void setPlayerPos(SDWORD x, SDWORD y);
|
||||
extern void disp3d_setView(iView *newView);
|
||||
extern void disp3d_resetView();
|
||||
extern void disp3d_getView(iView *newView);
|
||||
|
||||
extern void draw3DScene (void);
|
||||
|
|
30
src/game.c
30
src/game.c
|
@ -2367,17 +2367,21 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
|
|||
memset(asBodyUpgrade, 0, MAX_PLAYERS * sizeof(BODY_UPGRADE) * BODY_TYPE);
|
||||
//JPS 25 feb
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
if (UserSaveGame)//always !keepObjects
|
||||
{
|
||||
if (saveGameVersion >= VERSION_11)//v21
|
||||
{
|
||||
//camera position
|
||||
disp3d_setView(&(saveGameData.currentPlayerPos));
|
||||
}
|
||||
|
||||
if (saveGameVersion >= VERSION_12)
|
||||
{
|
||||
mission.startTime = saveGameData.missionTime;
|
||||
|
@ -2390,12 +2394,6 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
|
|||
height = saveGameData.ScrollMaxY - saveGameData.ScrollMinY;
|
||||
gameType = saveGameData.GameType;
|
||||
|
||||
if (saveGameVersion >= VERSION_11)
|
||||
{
|
||||
//camera position
|
||||
disp3d_setView(&(saveGameData.currentPlayerPos));
|
||||
}
|
||||
|
||||
if (saveGameVersion >= VERSION_14)
|
||||
{
|
||||
//mission data
|
||||
|
@ -3496,8 +3494,6 @@ BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL User
|
|||
// multiPlayerInUse = FALSE;
|
||||
// }
|
||||
// initViewPosition();
|
||||
setViewAngle(INITIAL_STARTING_PITCH);
|
||||
setDesiredPitch(INITIAL_DESIRED_PITCH);
|
||||
|
||||
//check if limbo_expand mission has changed to an expand mission for user save game (mid-mission)
|
||||
if (gameType == GTYPE_SAVE_MIDMISSION && missionLimboExpand())
|
||||
|
@ -4575,6 +4571,10 @@ bool gameLoadV(PHYSFS_file* fileHandle, unsigned int version)
|
|||
//camera position
|
||||
disp3d_setView(&saveGameData.currentPlayerPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
disp3d_resetView();
|
||||
}
|
||||
|
||||
//load mission data from save game these values reloaded after load game
|
||||
|
||||
|
|
Loading…
Reference in New Issue