Files
fallout2-ce/src/map.h
T
Vlad Kandgithub-actions[bot] e42d8021c1 WIP Mapper implementation (#438)
* Add mapper CMakeTarget, tool for mapping function names to originals, load/save toolbar & update_art implemented

* edit_mapper function + stubs

* Rename exe to mapper-ce

* load_lbm_to_buf

* Add comments for read/write functions in db.h

* load_dialog, save_dialog, save_as, info_dialog and some other functions

* Fix LBM loading

* Fix mouse input not working on initial empty map, changed error in partyMemberRecoverLoadInstance to print to log, matching vanilla

* mapper.cc: basic hi-res support, NULL->nullptr

* load_lbm_to_buf rewrite, print_toolbar_name background fix

* Stubs for enter/exit playmode, art slot indexes fix, map_scr_toggle_hexes

* Fix memory corruption on screen_width > 640, fix various UI offset bugs

* mapper.cc: UI code style, toggle button fixes, rotation keys, edit button placeholders, PAGEUP key fix

* Elevation display fix, object type switching

* Spatial script placement and display, basic object selection

* Fixed dragging objects, block object showing, add all missing cases in edit_mapper with stubs, move all keys codes to constants

* chore: auto-format with clang-format

* Fix non-win builds

* Add stub calls from edit_mapper, fix objects being incorrectly deleted when unselected, fix tile number display

* Fix compile on Linux

* Attempt to fix iOS signing error

* Placing of objects and tiles, F12 to erase map, bug fixes

* Fixed block object toggling logic and add missing switch cases to edit_mapper

* Object editing added, 'p' to scroll palette fixed

* Add new files to CMakeLists

* Attempt to fix some colors + alignment in critter edit window

* chore: auto-format with clang-format

* Linux build fix attempt

* Critter inventory editing

* Vanilla grid-based inventory item picker

* Review fixes

* More review fixes and const correctness

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-05-05 18:47:16 +00:00

119 lines
2.6 KiB
C++

#ifndef MAP_H
#define MAP_H
#include "combat_defs.h"
#include "db.h"
#include "geometry.h"
#include "interpreter.h"
#include "map_defs.h"
#include "message.h"
#include "platform_compat.h"
namespace fallout {
#define ORIGINAL_ISO_WINDOW_WIDTH 640
#define ORIGINAL_ISO_WINDOW_HEIGHT 380
// TODO: Probably not needed -> replace with array?
typedef struct TileData {
int field_0[SQUARE_GRID_SIZE];
} TileData;
typedef struct MapHeader {
// map_ver
int version;
// map_name
char name[16];
// map_ent_tile
int enteringTile;
// map_ent_elev
int enteringElevation;
// map_ent_rot
int enteringRotation;
// map_num_loc_vars
int localVariablesCount;
// 0map_script_idx
int scriptIndex;
// map_flags
int flags;
// map_darkness
int darkness;
// map_num_glob_vars
int globalVariablesCount;
// map_number
int index;
// Time in game ticks when PC last visited this map.
unsigned int lastVisitTime;
int field_3C[44];
} MapHeader;
typedef struct MapTransition {
int map;
int elevation;
int tile;
int rotation;
} MapTransition;
typedef void IsoWindowRefreshProc(Rect* rect);
extern int gMapSid;
extern int* gMapLocalVars;
extern int* gMapGlobalVars;
extern int gMapLocalVarsLength;
extern int gMapGlobalVarsLength;
extern int gElevation;
extern MessageList gMapMessageList;
extern MapHeader gMapHeader;
extern TileData* _square[ELEVATION_COUNT];
extern int gIsoWindow;
int isoInit();
void isoReset();
void isoExit();
void mapInit();
void mapExit();
void isoEnable();
bool isoDisable();
bool isoIsDisabled();
int mapSetElevation(int elevation);
int mapSetGlobalVar(int var, ProgramValue& value);
int mapGetGlobalVar(int var, ProgramValue& value);
int mapSetLocalVar(int var, ProgramValue& value);
int mapGetLocalVar(int var, ProgramValue& value);
int mapAllocLocalVars(int numNewVars);
void mapSetStart(int tile, int elevation, int rotation);
char* mapGetName(int map_num, int elev);
bool mapAreSameArea(int map_num1, int map_num2);
int _get_map_idx_same(int map_num1, int map_num2);
char* mapGetCityName(int map_num);
char* mapDescriptionById(int map_index);
int mapGetCurrentMap();
int mapScroll(int dx, int dy);
int mapSetEnteringLocation(int elevation, int tile, int rotation);
void mapNewMap();
int mapLoadByName(char* fileName);
int mapLoadById(int map_index);
const char* mapBuildPath(const char* name);
int mapLoadSaved(char* fileName);
int mapGetLoadedAreaId();
int mapSetTransition(MapTransition* transition);
int mapHandleTransition();
int _map_save_in_game(bool isLeavingMap);
int _map_save();
} // namespace fallout
#endif /* MAP_H */