ScummVM API documentation
data.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 ULTIMA2_DATA_DATA_H
23#define ULTIMA2_DATA_DATA_H
24
25#include "common/scummsys.h"
26
27namespace Ultima {
28namespace Ultima2 {
29namespace Data {
30
31// CGA mode 4, palette 1 (black/light cyan/light magenta/white), the
32// palette used by both the pic??? art and the embedded tile graphics
33extern const byte CGA_PALETTE1[4 * 3];
34
35// An extra bright green entry after the four CGA colors, used by the
36// dungeon minimap's player marker
37constexpr int PALETTE_PLAYER_MARKER = 4;
38
39// The "Ultima II Upgrade" fan patch's alternate renderers
40enum RenderMode {
41 RENDER_CGA = 0, RENDER_CGA_COMPOSITE = 1, RENDER_EGA = 2, RENDER_EGA_V1 = 3,
42 RENDER_EGA_WILTSHIRE = 4, RENDER_EGA_C64 = 5, RENDER_MODE_COUNT = 6
43};
44extern const char *const RENDER_MODE_NAMES[RENDER_MODE_COUNT];
45
46// Descriptions of the modes for the launcher's graphics mode drop-down, in
47// the same order. Marked for translation, but not translated
48extern const char *const RENDER_MODE_LABELS[RENDER_MODE_COUNT];
49
50inline bool isEgaMode(RenderMode mode) {
51 return mode >= RENDER_EGA && mode < RENDER_MODE_COUNT;
52}
53
54// The EGA-family renderers' 16-color palette occupies this range, kept
55// well away from CGA_PALETTE1/PALETTE_PLAYER_MARKER (indices 0-4) so
56// CGA-drawn chrome (text, the pic??? title art) keeps rendering
57// correctly no matter which renderer's tiles are currently active
58constexpr int EGA_PALETTE_BASE = 16;
59constexpr int EGA_PALETTE_SIZE = 16;
60extern const byte EGA_PALETTE16[EGA_PALETTE_SIZE * 3];
61
62// The composite renderer's 16 artifact colors, which are loaded from
63// CGACOMP.PAL by setPalette. Gfx::compositeDecode maps each decoded CGA
64// pixel to one of these
65constexpr int COMPOSITE_PALETTE_BASE = 32;
66constexpr int COMPOSITE_PALETTE_SIZE = 16;
67
68// Names of the worlds that can be orbited, indexed by Savegame::_orbitTarget
69constexpr int PLANET_COUNT = 9;
70extern const char *const PLANET_NAMES[PLANET_COUNT];
71
72// Hyperwarp coordinates (XENO, YAKO, ZABO) of each world, indexed the same
73// way, with a tenth entry for planet X
74extern const byte PLANET_COORDS[PLANET_COUNT + 1][3];
75
79void setPalette();
80
81constexpr int MAX_NAME_LENGTH = 12;
82
83// Ceilings for stats that round-trip through the original PLAYER file's packed-BCD fields
84constexpr int MAX_BCD_BYTE = 99;
85constexpr int MAX_BCD_WORD = 9999;
86
87enum Direction {
88 DIR_UP = 0, DIR_DOWN = 1, DIR_LEFT = 2, DIR_RIGHT = 3, DIR_UNSPECIFIED = 4
89};
90
91enum Sex {
92 SEX_MALE = 0, SEX_FEMALE = 1
93};
94enum Race {
95 RACE_HUMAN = 0, RACE_ELF = 1, RACE_DWARF = 2, RACE_HOBBIT = 3, RACE_COUNT = 4
96};
97extern const char *const RACE_NAMES[RACE_COUNT];
98
99enum CharClass {
100 CLASS_FIGHTER = 0, CLASS_CLERIC = 1, CLASS_WIZARD = 2, CLASS_THIEF = 3, CLASS_COUNT = 4
101};
102extern const char *const CLASS_NAMES[CLASS_COUNT];
103
104// Indexes into Savegame::_weaponOwned
105enum WeaponType {
106 WEAPON_HANDS = 0, WEAPON_DAGGER = 1, WEAPON_MACE = 2, WEAPON_AXE = 3, WEAPON_BOW = 4,
107 WEAPON_SWORD = 5, WEAPON_GREAT_SWORD = 6, WEAPON_LIGHT_SWORD = 7, WEAPON_PHASER = 8,
108 WEAPON_QUICK_SWORD = 9, WEAPON_COUNT = 10
109};
110extern const char *const WEAPON_NAMES[WEAPON_COUNT];
111
112// Indexes into Savegame::_armorOwned
113enum ArmorType {
114 ARMOR_SKIN = 0, ARMOR_CLOTH = 1, ARMOR_LEATHER = 2, ARMOR_CHAIN = 3, ARMOR_PLATE = 4,
115 ARMOR_REFLECT = 5, ARMOR_POWER = 6, ARMOR_COUNT = 7
116};
117extern const char *const ARMOR_NAMES[ARMOR_COUNT];
118
119// Indexes into Savegame::_spellCharges
120enum SpellType {
121 SPELL_NONE = 0, SPELL_LIGHT = 1, SPELL_DOWN_LADDER = 2, SPELL_UP_LADDER = 3, SPELL_PASSWALL = 4,
122 SPELL_SURFACE = 5, SPELL_PRAYER = 6, SPELL_MAGIC_MISSILE = 7, SPELL_BLINK = 8, SPELL_KILL = 9,
123 SPELL_COUNT = 10
124};
125extern const char *const SPELL_NAMES[SPELL_COUNT];
126
127// Indexes into Savegame::_items
128enum ItemType {
129 ITEM_RING = 0, ITEM_WAND = 1, ITEM_STAFF = 2, ITEM_BOOTS = 3, ITEM_CLOAK = 4, ITEM_HELM = 5,
130 ITEM_GEM = 6, ITEM_ANKH = 7, ITEM_RED_GEM = 8, ITEM_SKULL_KEY = 9, ITEM_GREEN_GEM = 10,
131 ITEM_BRASS_BUTTON = 11, ITEM_BLUE_TASSLE = 12, ITEM_STRANGE_COIN = 13, ITEM_GREEN_IDOL = 14,
132 ITEM_TRI_LITHIUM = 15, ITEM_COUNT = 16
133};
134extern const char *const ITEM_NAMES[ITEM_COUNT];
135
136// Bounds-checked lookups into the *_NAMES arrays above, the single shared
137// implementation for what used to be separately duplicated per view
138const char *raceName(Race race);
139const char *className(CharClass charClass);
140const char *weaponName(WeaponType weapon);
141const char *armorName(ArmorType armor);
142const char *spellName(SpellType spell);
143const char *itemName(int item);
144
145// Short PC speaker effects, played through Ultima2Engine::playFX
146enum SoundEffect {
147 SFX_TICK, SFX_STEP, SFX_ATTACK, SFX_HIT, SFX_CANNON, SFX_TRAP, SFX_FAIL, SFX_BEEP, SFX_MAGIC
148};
149
154inline int bcdValue(byte v) {
155 return (v >> 4) * 10 + (v & 0xF);
156}
157
161inline byte toBcd(int v) {
162 return (byte)(((v / 10) << 4) | (v % 10));
163}
164
165} // namespace Data
166} // namespace Ultima2
167} // namespace Ultima
168
169#endif
RenderMode
Definition: rendermode.h:48