2 Copyright (C) 2004-2011 Parallel Realities
3 Copyright (C) 2011-2015 Perpendicular Dimensions
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include "resources.h"
24 void loadSound(int index, const char *filename)
26 audio.loadSound(index, filename);
28 graphics.showLoading(1, 30);
31 void loadSprite(const char *token)
36 char filename[8][100];
42 sscanf(token, "%s %d %d %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d", name, &hue, &sat, &val, filename[0], &frameTime[0], filename[1], &frameTime[1], filename[2], &frameTime[2], filename[3], &frameTime[3], filename[4], &frameTime[4], filename[5], &frameTime[5], filename[6], &frameTime[6], filename[7], &frameTime[7]);
44 sprite = graphics.addSprite(name);
50 if (strcmp(filename[i], "@none@") == 0)
53 sprite->setFrame(i, graphics.loadImage(filename[i], hue, sat, val), frameTime[i]);
64 graphics.resetLoading();
69 graphics.quickSprite("cheatHeader", graphics.loadImage("gfx/main/cheats.png"));
70 graphics.quickSprite("optionsHeader", graphics.loadImage("gfx/main/options.png"));
71 graphics.quickSprite("joystickHeader", graphics.loadImage("gfx/main/joystickConfig.png"));
72 graphics.quickSprite("keyHeader", graphics.loadImage("gfx/main/keyConfig.png"));
73 graphics.quickSprite("optionsBackground", graphics.loadImage("gfx/main/optionsBackground.png"));
75 SDL_FillRect(graphics.screen, NULL, graphics.black);
76 graphics.drawString(_("Loading..."), 320, 440, TXT_CENTERED, graphics.screen);
77 graphics.showLoading(0, 0);
78 graphics.updateScreen();
80 if (!engine.loadDefines())
81 graphics.showErrorAndExit("Could not load map define list '%s'", "data/defines.h");
83 if (!engine.loadData("data/mainSprites"))
84 graphics.showErrorAndExit(ERR_FILE, "data/mainSprites");
86 char *token = strtok((char*)engine.dataBuffer, "\n");
90 if (strcmp(token, "@EOF@") == 0)
97 token = strtok(NULL, "\n");
99 graphics.showLoading(1, 20);
102 loadSound(SND_WATERIN, "sound/waterIn");
103 loadSound(SND_WATEROUT, "sound/waterOut");
104 loadSound(SND_ITEM, "sound/item");
105 loadSound(SND_PISTOL, "sound/pistol");
106 loadSound(SND_RICO1, "sound/rico1");
107 loadSound(SND_RICO2, "sound/rico2");
108 loadSound(SND_MACHINEGUN, "sound/machinegun");
109 loadSound(SND_DEATH1, "sound/death1");
110 loadSound(SND_DEATH2, "sound/death2");
111 loadSound(SND_DEATH3, "sound/death3");
112 loadSound(SND_GRENADE, "sound/grenade");
113 loadSound(SND_ROCKET, "sound/rocket");
114 loadSound(SND_FIREBALL, "sound/fireball");
115 loadSound(SND_HIT, "sound/punch");
116 loadSound(SND_SPLAT, "sound/splat");
117 loadSound(SND_POP, "sound/pop1");
118 loadSound(SND_TELEPORT1, "sound/teleport1");
119 loadSound(SND_TELEPORT2, "sound/teleport2");
120 loadSound(SND_TELEPORT3, "sound/teleport3");
121 loadSound(SND_GETWEAPON, "sound/weaponPickup");
122 loadSound(SND_LASER, "sound/laser");
123 loadSound(SND_ELECDEATH1, "sound/elecDeath1");
124 loadSound(SND_ELECDEATH2, "sound/elecDeath2");
125 loadSound(SND_ELECDEATH3, "sound/elecDeath3");
126 loadSound(SND_LOCKEDDOOR, "sound/doorLocked");
127 loadSound(SND_OPENDOOR, "sound/doorOpen");
128 loadSound(SND_DOOROPENED, "sound/doorOpened");
129 loadSound(SND_SWITCH1, "sound/switch");
130 loadSound(SND_SWITCH2, "sound/switch");
131 loadSound(SND_DROWNING, "sound/drowning");
132 loadSound(SND_GULP, "sound/gulp");
133 loadSound(SND_EAT, "sound/eat");
134 loadSound(SND_THROW, "sound/throw");
135 loadSound(SND_GRBOUNCE, "sound/grenadeBounce");
136 loadSound(SND_SPREADGUN, "sound/plasma");
137 loadSound(SND_STONEBREAK, "sound/stoneBreak");
138 loadSound(SND_ELECTRICITY1, "sound/electricity1");
139 loadSound(SND_ELECTRICITY2, "sound/electricity2");
140 loadSound(SND_ELECTRICITY3, "sound/electricity3");
141 loadSound(SND_CLANG, "sound/clang");
142 loadSound(SND_FIRECRACKLE, "sound/fireCrackle");
143 loadSound(SND_CLOCK, "sound/clock");
147 graphics.showLoading(35, 35);
151 graphics.showLoading(40, 40);
155 graphics.showLoading(45, 45);
157 graphics.loadMapTiles("gfx/common");
159 player.setSprites(graphics.getSprite("BobRight", true), graphics.getSprite("BobLeft", true), graphics.getSprite("BobSpin", true));
161 graphics.showLoading(50, 50);
163 loadMapData(game.mapName);
165 graphics.showLoading(100, 100);
168 graphics.showLoading(100, 100);
172 createBoss(game.stageName);
174 game.canContinue = 0;
176 // We don't need this anymore. Remove it to free up some memory...
177 engine.defineList.clear();