GOT: Added setup_player, setup_level methods

This commit is contained in:
Paul Gilbert authored and Filippos Karapetis committed 2025-01-12 18:11:27 +02:00
1 parent 269df0f92b
commit 02acac8a2d
5 files changed
+108 -12

No files matched your search

+67
View File
@@ -0,0 +1,67 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "got/game/init.h"
#include "got/utils/file.h"
#include "got/events.h"
#include "got/vars.h"
namespace Got {
int setup_level() {
_G(bgPics).setArea(_G(area));
if (_G(load_game_flag) != 1) {
if (!load_sd_data())
return 0;
}
return 1;
}
int setup_player() {
memset(&_G(thor_info), 0, sizeof(_G(thor_info)));
_G(thor_info).inventory = 0;
if (_G(area) > 1) _G(thor_info).inventory |= APPLE_MAGIC + LIGHTNING_MAGIC;
if (_G(area) > 2) _G(thor_info).inventory |= BOOTS_MAGIC + WIND_MAGIC;
_G(thor)->health = 150;
_G(thor_info).magic = 0;
_G(thor_info).jewels = 0;
_G(thor_info).score = 0;
_G(thor_info).keys = 0;
_G(thor_info).last_item = 0;
_G(thor_info).object = 0;
_G(thor_info).object_name = nullptr;
_G(thor)->x = 152;
_G(thor)->y = 96;
_G(thor)->last_x[0] = _G(thor)->x;
_G(thor)->last_x[1] = _G(thor)->x;
_G(thor)->last_y[0] = _G(thor)->y;
_G(thor)->last_y[1] = _G(thor)->y;
_G(thor_info).last_icon = (6 * 20) + 8;
_G(thor_info).last_screen = 23;
_G(thor)->dir = 1;
return 1;
}
} // namespace Got
+34
View File
@@ -0,0 +1,34 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef GOT_GAME_INIT_H
#define GOT_GAME_INIT_H
#include "got/defines.h"
namespace Got {
extern int setup_level();
extern int setup_player();
} // namespace Got
#endif
+1
View File
@@ -8,6 +8,7 @@ MODULE_OBJS = \
metaengine.o \
sound.o \
vars.o \
game/init.o \
game/status.o \
gfx/font.o \
gfx/gfx_chunks.o \
-12
View File
@@ -158,18 +158,6 @@ void remove_objects(int y, int x);
void place_tile(int x, int y, int tile);
int bgtile(int x, int y);
//G_IMAGE.C
unsigned int make_mask(MASK_IMAGE *image,
unsigned int page_start, char *Image, int image_width,
int image_height);
int load_standard_actors(void);
void setup_actor(ACTOR *actr, char num, char dir, int x, int y);
void show_enemies(void);
int load_enemy(int type);
int actor_visible(int invis_num);
void setup_magic_item(int item);
void load_new_thor(void);
//G_MOVE.C
void next_frame(ACTOR *actr);
int point_within(int x, int y, int x1, int y1, int x2, int y2);
+6
View File
@@ -20,6 +20,7 @@
*/
#include "got/views/game.h"
#include "got/game/init.h"
#include "got/gfx/image.h"
#include "got/metaengine.h"
#include "got/vars.h"
@@ -34,6 +35,11 @@ Game::Game() : View("Game") {
void Game::initialize() {
load_standard_actors();
if (!setup_player())
error("setup_player failed");
if (!setup_level())
error("setup_level failed");
// TODO
}
bool Game::msgFocus(const FocusMessage &msg) {