@@ -51,10 +51,9 @@ std::string GetFileDirectory (const std::string& file) {
51
51
}
52
52
53
53
bool Exists (const std::string& filename) {
54
- std::ifstream infile (filename.c_str ());
54
+ std::ifstream infile (filename.c_str ());
55
55
return infile.good ();
56
56
}
57
-
58
57
std::string path;
59
58
60
59
std::string FindResource (const std::string& folder, const std::string& base_name) {
@@ -154,19 +153,31 @@ void DrawEvents(SDL_Surface* output_img, stChipset * gen, std::unique_ptr<lcf::r
154
153
}
155
154
156
155
void RenderCore (SDL_Surface* output_img, std::string chipset, uint8_t * csflag, std::unique_ptr<lcf::rpg::Map> & map, int show_background, int show_lowertiles, int show_uppertiles, int show_events) {
157
- SDL_Surface* chipset_img = LoadImage (chipset.c_str (), true );
156
+ SDL_Surface* chipset_img;
157
+ if (!chipset.empty ()) {
158
+ chipset_img = LoadImage (chipset.c_str (), true );
159
+ } else {
160
+ chipset_img = SDL_CreateRGBSurfaceWithFormat (0 , 32 * 16 , 45 * 16 , 32 , SDL_PIXELFORMAT_RGBA32);
161
+ }
158
162
159
163
stChipset gen;
160
164
gen.GenerateFromSurface (chipset_img);
161
165
162
166
// Draw parallax background
163
- if (show_background && !map->parallax_name .empty ()) {
167
+ if (show_background) {
168
+
164
169
std::string pname = lcf::ToString (map->parallax_name );
165
170
std::string background (FindResource (" Panorama" , pname));
166
- if (background.empty ()) {
171
+ if (background.empty () && !map-> parallax_name . empty () ) {
167
172
std::cout << " Can't find parallax background " << map->parallax_name << std::endl;
168
173
} else {
169
- SDL_Surface* background_img (LoadImage (background.c_str ()));
174
+ SDL_Surface* background_img;
175
+ if (map->parallax_name .empty ()) {
176
+ background_img = SDL_CreateRGBSurface (0 , 1 , 1 , 24 , 0 , 0 , 0 , 0 );
177
+ SDL_FillRect (background_img, 0 , 0 );
178
+ } else {
179
+ background_img = (LoadImage (background.c_str ()));
180
+ }
170
181
SDL_Rect dst_rect = background_img->clip_rect ;
171
182
// Fill screen with copies of the background
172
183
for (dst_rect.x = 0 ; dst_rect.x < output_img->w ; dst_rect.x += background_img->w ) {
@@ -284,7 +295,7 @@ int main(int argc, char** argv) {
284
295
std::string chipset_base (cs.chipset_name );
285
296
286
297
chipset = FindResource (" ChipSet" , chipset_base);
287
- if (chipset.empty ()) {
298
+ if (chipset.empty () && !chipset_base. empty () ) {
288
299
std::cout << " Chipset " << chipset_base << " can't be found." << std::endl;
289
300
exit (EXIT_FAILURE);
290
301
}
0 commit comments