@@ -26,12 +26,13 @@
extern TileIndex _cur_tileloop_tile;
/* Keep track of current game position */
int _saved_scrollpos_x;
int _saved_scrollpos_y;
ZoomLevelByte _saved_scrollpos_zoom;
void SaveViewportBeforeSaveGame()
{
const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
if (w != NULL) {
@@ -48,13 +49,13 @@ void ResetViewportAfterLoadGame()
w->viewport->scrollpos_x = _saved_scrollpos_x;
w->viewport->scrollpos_y = _saved_scrollpos_y;
w->viewport->dest_scrollpos_x = _saved_scrollpos_x;
w->viewport->dest_scrollpos_y = _saved_scrollpos_y;
ViewPort *vp = w->viewport;
vp->zoom = min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
vp->zoom = min<ZoomLevel>(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
DoZoomInOutWindow(ZOOM_NONE, w); // update button status
MarkWholeScreenDirty();
}
@@ -42,12 +42,13 @@ void ConnectMultiheadedTrains();
Engine *GetTempDataEngine(EngineID index);
void CopyTempEngineData();
extern int32 _saved_scrollpos_x;
extern int32 _saved_scrollpos_y;
extern ZoomLevelByte _saved_scrollpos_zoom;
extern SavegameType _savegame_type;
extern uint32 _ttdp_version;
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face);
@@ -50,13 +50,12 @@
#include "table/sprites.h"
#include "table/strings.h"
PlaceProc *_place_proc;
Point _tile_fract_coords;
ZoomLevel _saved_scrollpos_zoom;
struct StringSpriteToDraw {
StringID string;
Colours colour;
int32 x;
int32 y;
@@ -11,14 +11,12 @@
#ifndef ZOOM_FUNC_H
#define ZOOM_FUNC_H
#include "zoom_type.h"
extern ZoomLevel _saved_scrollpos_zoom;
/**
* Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL)
* When shifting right, value is rounded up
* @param value value to shift
* @param zoom zoom level to shift to
* @return shifted value
@@ -41,7 +41,9 @@ enum ZoomLevel {
ZOOM_LVL_MIN = ZOOM_LVL_NORMAL,
ZOOM_LVL_MAX = ZOOM_LVL_OUT_8X,
};
DECLARE_POSTFIX_INCREMENT(ZoomLevel)
typedef SimpleTinyEnumT<ZoomLevel, byte> ZoomLevelByte;
#endif /* ZOOM_TYPE_H */
Status change: