liblcf
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rpg_fixup.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014 liblcf authors
3  * This file is released under the MIT License
4  * http://opensource.org/licenses/MIT
5  */
6 
7 #include "reader_options.h"
8 #include "rpg_actor.h"
9 #include "rpg_mapinfo.h"
10 #include "rpg_system.h"
11 #include "rpg_save.h"
12 #include "rpg_savemapinfo.h"
13 #include "data.h"
14 
16  const RPG::Actor& actor = Data::actors[ID - 1];
17 
18  if (name == "\x1") {
19  name = actor.name;
20  }
21  if (title == "\x1") {
22  title = actor.title;
23  }
24  if (sprite_name.empty()) {
26  }
27  if (face_name.empty()) {
28  face_name = actor.face_name;
29  }
30  if (face_id == 0) {
31  face_id = actor.face_index;
32  }
33  if (sprite_id == 0) {
34  sprite_id = actor.character_index;
35  }
36  if (sprite_flags == 0) {
37  sprite_flags = actor.transparent ? 3 : 0;
38  }
39  if (class_id == -1) {
40  class_id = actor.class_id;
41  }
42  // Remove, beginning from first zero conditions (invalid value)
43  // No idea why they are written in the savegame by RPG_RT
44  for (size_t i = 0; i < status.size(); ++i) {
45  if (status[i] == 0) {
46  status.resize(i);
47  break;
48  }
49  }
50 }
51 
53  if (move_frequency == -1) {
54  move_frequency = page.move_frequency;
55  }
56  if (move_speed == -1) {
57  move_speed = page.move_speed;
58  }
59  if (sprite_name.empty()) {
60  sprite_name = page.character_name;
61  }
62  if (sprite_id == -1) {
63  sprite_id = page.character_index;
64  }
65 }
66 
69 
70  if (graphics_name.empty()) {
71  graphics_name = system.system_name;
72  }
73  if (switches.size() < Data::switches.size()) {
74  switches.resize(Data::switches.size());
75  }
76  if (variables.size() < Data::variables.size()) {
77  variables.resize(Data::variables.size());
78  }
79  if (title_music.name.empty()) {
80  title_music.name = system.title_music.name;
81  }
82  if (boat_music.name.empty()) {
83  boat_music.name = system.boat_music.name;
84  }
85  if (ship_music.name.empty()) {
86  ship_music.name = system.ship_music.name;
87  }
88  if (airship_music.name.empty()) {
89  airship_music.name = system.airship_music.name;
90  }
91  if (gameover_music.name.empty()) {
92  gameover_music.name = system.gameover_music.name;
93  }
94  if (cursor_se.name.empty()) {
95  cursor_se.name = system.cursor_se.name;
96  }
97  if (decision_se.name.empty()) {
98  decision_se.name = system.decision_se.name;
99  }
100  if (cancel_se.name.empty()) {
101  cancel_se.name = system.cancel_se.name;
102  }
103  if (buzzer_se.name.empty()) {
104  buzzer_se.name = system.buzzer_se.name;
105  }
106  if (battle_se.name.empty()) {
107  battle_se.name = system.battle_se.name;
108  }
109  if (escape_se.name.empty()) {
110  escape_se.name = system.escape_se.name;
111  }
112  if (enemy_attack_se.name.empty()) {
113  enemy_attack_se.name = system.enemy_attack_se.name;
114  }
115  if (enemy_damaged_se.name.empty()) {
116  enemy_damaged_se.name = system.enemy_damaged_se.name;
117  }
118  if (actor_damaged_se.name.empty()) {
119  actor_damaged_se.name = system.actor_damaged_se.name;
120  }
121  if (dodge_se.name.empty()) {
122  dodge_se.name = system.dodge_se.name;
123  }
124  if (enemy_death_se.name.empty()) {
125  enemy_death_se.name = system.enemy_death_se.name;
126  }
127  if (item_se.name.empty()) {
128  item_se.name = system.item_se.name;
129  }
130 }
131 
133  if (chipset_id == -1) {
134  chipset_id = map.chipset_id;
135  }
136 }
137 
139  if (move_speed == -1) {
140  move_speed = 4;
141  }
142 }
143 
145  if (tint_current_red == -1.0) {
146  tint_current_red = 100.0;
147  }
148  if (tint_current_green == -1.0) {
149  tint_current_green = 100.0;
150  }
151  if (tint_current_blue == -1.0) {
152  tint_current_blue = 100.0;
153  }
154  if (tint_current_sat == -1.0) {
155  tint_current_sat = 100.0;
156  }
157 }
Sound enemy_attack_se
Definition: rpg_system.h:124
RPG::System & system
Definition: data.cpp:28
std::string sprite_name
Definition: rpg_saveactor.h:30
Sound battle_se
Definition: rpg_system.h:122
std::string title
Definition: rpg_actor.h:31
std::string name
Definition: rpg_sound.h:23
int chipset_id
Definition: rpg_map.h:44
Sound decision_se
Definition: rpg_system.h:119
Sound enemy_damaged_se
Definition: rpg_system.h:125
Music title_music
Definition: rpg_system.h:110
Sound actor_damaged_se
Definition: rpg_system.h:126
Sound enemy_death_se
Definition: rpg_system.h:128
Sound dodge_se
Definition: rpg_system.h:127
Sound cancel_se
Definition: rpg_system.h:120
int character_index
Definition: rpg_actor.h:33
std::vector< int16_t > status
Definition: rpg_saveactor.h:50
std::string face_name
Definition: rpg_saveactor.h:33
std::string system_name
Definition: rpg_system.h:106
std::string name
Definition: rpg_music.h:23
std::string character_name
Definition: rpg_eventpage.h:78
std::string name
Definition: rpg_saveactor.h:28
void Fixup(const RPG::Map &map)
Definition: rpg_fixup.cpp:132
std::string face_name
Definition: rpg_actor.h:39
int class_id
Definition: rpg_actor.h:51
std::string title
Definition: rpg_saveactor.h:29
Music ship_music
Definition: rpg_system.h:115
Music gameover_music
Definition: rpg_system.h:117
Music boat_music
Definition: rpg_system.h:114
std::string character_name
Definition: rpg_actor.h:32
Sound buzzer_se
Definition: rpg_system.h:121
Music airship_music
Definition: rpg_system.h:116
Sound escape_se
Definition: rpg_system.h:123
std::string name
Definition: rpg_actor.h:30
std::vector< RPG::Variable > & variables
Definition: data.cpp:30
int face_index
Definition: rpg_actor.h:40
Sound item_se
Definition: rpg_system.h:129
std::vector< RPG::Switch > & switches
Definition: data.cpp:29
void Fixup(const RPG::EventPage &page)
Definition: rpg_fixup.cpp:52
Sound cursor_se
Definition: rpg_system.h:118
bool transparent
Definition: rpg_actor.h:34
std::vector< RPG::Actor > & actors
Definition: data.cpp:13