ScummVM API documentation
roster.h
1
/* ScummVM - Graphic Adventure Engine
2
*
3
* ScummVM is the legal property of its developers, whose names
4
* are too numerous to list here. Please refer to the COPYRIGHT
5
* file distributed with this source distribution.
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
*
20
*/
21
22
#ifndef ULTIMA3_DATA_ROSTER_H
23
#define ULTIMA3_DATA_ROSTER_H
24
25
#include "common/scummsys.h"
26
#include "common/serializer.h"
27
28
namespace
Ultima {
29
namespace
Ultima3 {
30
namespace
Data {
31
32
constexpr
int
ROSTER_COUNT = 20;
33
constexpr
int
PARTY_MAX = 4;
34
constexpr
int
PARTY_NAME_MAX = 9;
35
36
constexpr
byte
IN_PARTY = 0xFF;
37
constexpr
byte
STATUS_GOOD =
'G'
;
38
constexpr
byte
STATUS_POISONED =
'P'
;
39
constexpr
byte
STATUS_DEAD =
'D'
;
40
constexpr
byte
STATUS_ASHES =
'A'
;
41
46
inline
byte
toBcd(
int
value) {
47
return
((value / 10) << 4) | (value % 10);
48
}
49
50
inline
uint16 toBcdWord(
int
value) {
51
return
(toBcd(value / 100) << 8) | toBcd(value % 100);
52
}
53
54
inline
int
fromBcd(
byte
value) {
55
return
(value >> 4) * 10 + (value & 0xF);
56
}
57
58
inline
int
fromBcdWord(uint16 value) {
59
return
fromBcd(value >> 8) * 100 + fromBcd(value & 0xFF);
60
}
61
66
struct
RosterEntry
{
67
char
_name[PARTY_NAME_MAX + 1] = {};
68
byte
_marksAndCards = 0;
69
byte
_torches = 0;
70
byte
_partyMember = 0;
71
byte
_status = 0;
72
byte
_strength = 0;
73
byte
_dexterity = 0;
74
byte
_intelligence = 0;
75
byte
_wisdom = 0;
76
byte
_race = 0;
77
byte
_class = 0;
78
byte
_sex = 0;
79
byte
_magicPoints = 0;
80
uint16 _hitPoints = 0;
81
uint16 _maxHitPoints = 0;
82
uint16 _experience = 0;
83
byte
_foodSubCounter = 0;
84
uint16 _food = 0;
85
uint16 _gold = 0;
86
byte
_gems = 0;
87
byte
_keys = 0;
88
byte
_powder = 0;
89
byte
_armourIndex = 0;
90
byte
_armourOwned[7] = {};
91
byte
_weaponIndex = 0;
92
byte
_weaponOwned[15] = {};
93
94
void
clear() {
95
*
this
=
RosterEntry
();
96
}
97
98
bool
isEmpty()
const
{
99
return
_name[0] ==
'\0'
;
100
}
101
102
bool
isInParty()
const
{
103
return
_partyMember == IN_PARTY;
104
}
105
106
bool
isAlive()
const
{
107
return
_status == STATUS_GOOD || _status == STATUS_POISONED;
108
}
109
115
void
synchronize
(
Common::Serializer
&s,
bool
original =
false
);
116
};
117
118
}
// namespace Data
119
}
// namespace Ultima3
120
}
// namespace Ultima
121
122
#endif
Common::Serializer
Definition:
serializer.h:80
Ultima::Ultima3::Data::RosterEntry
Definition:
roster.h:66
Ultima::Ultima3::Data::RosterEntry::synchronize
void synchronize(Common::Serializer &s, bool original=false)
engines
ultima
ultima3
data
roster.h
Generated on Sun Nov 22 2026 09:34:25 for ScummVM API documentation by
1.9.4