aboutsummaryrefslogtreecommitdiff
path: root/libs/game_bethesda/src/games/morrowind/morrowindsavegame.h
blob: b4ea96028d91baeee39522bcbff32a3f558a2aa2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef MORROWINDSAVEGAME_H
#define MORROWINDSAVEGAME_H

#include "gamebryosavegame.h"
#include "gamemorrowind.h"

namespace MOBase
{
class IPluginGame;
}

class MorrowindSaveGame : public GamebryoSaveGame
{
public:
  MorrowindSaveGame(QString const& fileName, GameMorrowind const* game);

public:  // ISaveGame interface
  // We need to override getName() because we do not read the level at
  // the beginning.
  virtual QString getName() const override;

  // The PC level is not pre-fetch for morrowind.
  unsigned short getPCLevel() const override;

public:
  // Simple getters
  QString getSaveName() const { return m_SaveName; }
  float getPCCurrentHealth() const { return m_PCCurrentHealth; }
  float getPCMaxHealth() const { return m_PCCMaxHealth; }
  float getGameDays() const { return m_GameDays; }

protected:
  QString m_SaveName;
  float m_PCCurrentHealth;
  float m_PCCMaxHealth;
  float m_GameDays;

protected:
  QImage readImageBGRA(GamebryoSaveGame::FileWrapper& file, unsigned long width,
                       unsigned long height, int scale, bool alpha) const;

  // We need to add the PC level here.
  struct MorrowindDataFields : public DataFields
  {
    unsigned short PCLevel = 0;
  };

  // Fetch easy-to-access information.
  void fetchInformationFields(FileWrapper& file, QString& saveName,
                              QStringList& plugins, float& playerCurrentHealth,
                              float& playerMaxHealth, QString& playerLocation,
                              float& gameDays, QString& playerName) const;

  std::unique_ptr<DataFields> fetchDataFields() const override;
};

#endif  // MORROWINDSAVEGAME_H