remove nonstandard type aliases

This commit is contained in:
scawful
2025-01-19 20:16:40 -05:00
parent fa33be3463
commit 809282edad
35 changed files with 367 additions and 357 deletions

View File

@@ -6,11 +6,11 @@
#include <vector>
#include "absl/strings/str_cat.h"
#include "app/core/constants.h"
#include "app/rom.h"
#include "app/zelda3/dungeon/room_object.h"
#include "app/zelda3/dungeon/room_tag.h"
#include "app/zelda3/sprite/sprite.h"
#include "util/macro.h"
namespace yaze {
namespace zelda3 {
@@ -27,8 +27,7 @@ void Room::LoadHeader() {
auto header_location = core::SnesToPc(address);
bg2_ = (background2)((rom()->data()[header_location] >> 5) &
0x07);
bg2_ = (background2)((rom()->data()[header_location] >> 5) & 0x07);
collision_ = (CollisionKey)((rom()->data()[header_location] >> 2) & 0x07);
is_light_ = ((rom()->data()[header_location]) & 0x01) == 1;
@@ -163,12 +162,12 @@ void Room::LoadRoomFromROM() {
b = rom_data[hpos];
pits_.target_layer = (uchar)(b & 0x03);
stair1_.target_layer = (uchar)((b >> 2) & 0x03);
stair2_.target_layer = (uchar)((b >> 4) & 0x03);
stair3_.target_layer = (uchar)((b >> 6) & 0x03);
pits_.target_layer = (uint8_t)(b & 0x03);
stair1_.target_layer = (uint8_t)((b >> 2) & 0x03);
stair2_.target_layer = (uint8_t)((b >> 4) & 0x03);
stair3_.target_layer = (uint8_t)((b >> 6) & 0x03);
hpos++;
stair4_.target_layer = (uchar)(rom_data[hpos] & 0x03);
stair4_.target_layer = (uint8_t)(rom_data[hpos] & 0x03);
hpos++;
pits_.target = rom_data[hpos];
@@ -193,7 +192,7 @@ void Room::LoadRoomFromROM() {
// core::SnesToPc(dungeon_spr_ptrs | spr_ptr + (room_id_ * 2));
}
void Room::LoadRoomGraphics(uchar entrance_blockset) {
void Room::LoadRoomGraphics(uint8_t entrance_blockset) {
const auto &main_gfx = rom()->main_blockset_ids;
const auto &room_gfx = rom()->room_blockset_ids;
const auto &sprite_gfx = rom()->spriteset_ids;
@@ -216,7 +215,7 @@ void Room::LoadRoomGraphics(uchar entrance_blockset) {
blocks_[10] = 115 + 6;
blocks_[11] = 115 + 7;
for (int i = 0; i < 4; i++) {
blocks_[12 + i] = (uchar)(sprite_gfx[spriteset + 64][i] + 115);
blocks_[12 + i] = (uint8_t)(sprite_gfx[spriteset + 64][i] + 115);
} // 12-16 sprites
}
@@ -238,7 +237,7 @@ void Room::CopyRoomGraphicsToBuffer() {
int data = 0;
int block_offset = blocks_[i] * kGfxBufferRoomOffset;
while (data < kGfxBufferRoomOffset) {
uchar map_byte = gfx_buffer_data[data + block_offset];
uint8_t map_byte = gfx_buffer_data[data + block_offset];
if (i < 4) {
map_byte += kGfxBufferRoomSpriteLastLineOffset;
}
@@ -260,7 +259,7 @@ void Room::LoadAnimatedGraphics() {
auto rom_data = rom()->vector();
int data = 0;
while (data < 512) {
uchar map_byte =
uint8_t map_byte =
gfx_buffer_data[data + (92 * 2048) + (512 * animated_frame_)];
current_gfx16_[data + (7 * 2048)] = map_byte;
@@ -382,8 +381,7 @@ void Room::LoadObjects() {
} else {
tile_objects_.back().set_options(ObjectOption::Stairs |
tile_objects_.back().options());
z3_staircases_.push_back(
staircase(posX, posY, "To ???"));
z3_staircases_.push_back(staircase(posX, posY, "To ???"));
}
}
}
@@ -393,7 +391,7 @@ void Room::LoadObjects() {
tile_objects_.back().set_options(ObjectOption::Chest |
tile_objects_.back().options());
// chest_list_.push_back(
// z3_chest(posX, posY, chests_in_room_.front().itemIn, false));
// z3_chest(posX, posY, chests_in_room_.front().itemIn, false));
chests_in_room_.erase(chests_in_room_.begin());
}
} else if (oid == 0xFB1) {
@@ -401,12 +399,14 @@ void Room::LoadObjects() {
tile_objects_.back().set_options(ObjectOption::Chest |
tile_objects_.back().options());
// chest_list_.push_back(
// z3_chest(posX + 1, posY, chests_in_room_.front().item_in, true));
// z3_chest(posX + 1, posY, chests_in_room_.front().item_in,
// true));
chests_in_room_.erase(chests_in_room_.begin());
}
}
} else {
// tile_objects_.push_back(z3_object_door(static_cast<short>((b2 << 8) + b1),
// tile_objects_.push_back(z3_object_door(static_cast<short>((b2 << 8) +
// b1),
// 0, 0, 0,
// static_cast<uint8_t>(layer)));
}

View File

@@ -7,12 +7,12 @@
#include <string_view>
#include <vector>
#include "app/core/constants.h"
#include "app/gfx/bitmap.h"
#include "app/rom.h"
#include "app/zelda3/dungeon/room_object.h"
#include "app/zelda3/dungeon/room_tag.h"
#include "app/zelda3/sprite/sprite.h"
#include "util/macro.h"
namespace yaze {
namespace zelda3 {
@@ -79,7 +79,7 @@ constexpr int dungeon_spr_ptrs = 0x090000;
constexpr int NumberOfRooms = 296;
constexpr ushort stairsObjects[] = {0x139, 0x138, 0x13B, 0x12E, 0x12D};
constexpr uint16_t stairsObjects[] = {0x139, 0x138, 0x13B, 0x12E, 0x12D};
struct LayerMergeType {
uint8_t ID;
@@ -121,7 +121,7 @@ class Room : public SharedRom {
void CalculateRoomSize();
void LoadRoomFromROM();
void LoadRoomGraphics(uchar entrance_blockset = 0xFF);
void LoadRoomGraphics(uint8_t entrance_blockset = 0xFF);
void CopyRoomGraphicsToBuffer();
void LoadAnimatedGraphics();

View File

@@ -104,22 +104,22 @@ class RoomEntrance {
room_ =
static_cast<short>((rom[kEntranceRoom + (entrance_id * 2) + 1] << 8) +
rom[kEntranceRoom + (entrance_id * 2)]);
y_position_ = static_cast<ushort>(
y_position_ = static_cast<uint16_t>(
(rom[kEntranceYPosition + (entrance_id * 2) + 1] << 8) +
rom[kEntranceYPosition + (entrance_id * 2)]);
x_position_ = static_cast<ushort>(
x_position_ = static_cast<uint16_t>(
(rom[kEntranceXPosition + (entrance_id * 2) + 1] << 8) +
rom[kEntranceXPosition + (entrance_id * 2)]);
camera_x_ = static_cast<ushort>(
camera_x_ = static_cast<uint16_t>(
(rom[kEntranceXScroll + (entrance_id * 2) + 1] << 8) +
rom[kEntranceXScroll + (entrance_id * 2)]);
camera_y_ = static_cast<ushort>(
camera_y_ = static_cast<uint16_t>(
(rom[kEntranceYScroll + (entrance_id * 2) + 1] << 8) +
rom[kEntranceYScroll + (entrance_id * 2)]);
camera_trigger_y_ = static_cast<ushort>(
camera_trigger_y_ = static_cast<uint16_t>(
(rom[(kEntranceCameraYTrigger + (entrance_id * 2)) + 1] << 8) +
rom[kEntranceCameraYTrigger + (entrance_id * 2)]);
camera_trigger_x_ = static_cast<ushort>(
camera_trigger_x_ = static_cast<uint16_t>(
(rom[(kEntranceCameraXTrigger + (entrance_id * 2)) + 1] << 8) +
rom[kEntranceCameraXTrigger + (entrance_id * 2)]);
blockset_ = rom[kEntranceBlockset + entrance_id];
@@ -148,27 +148,27 @@ class RoomEntrance {
(rom[kStartingEntranceroom + (entrance_id * 2) + 1] << 8) +
rom[kStartingEntranceroom + (entrance_id * 2)]);
y_position_ = static_cast<ushort>(
y_position_ = static_cast<uint16_t>(
(rom[kStartingEntranceYPosition + (entrance_id * 2) + 1] << 8) +
rom[kStartingEntranceYPosition + (entrance_id * 2)]);
x_position_ = static_cast<ushort>(
x_position_ = static_cast<uint16_t>(
(rom[kStartingEntranceXPosition + (entrance_id * 2) + 1] << 8) +
rom[kStartingEntranceXPosition + (entrance_id * 2)]);
camera_x_ = static_cast<ushort>(
camera_x_ = static_cast<uint16_t>(
(rom[kStartingEntranceXScroll + (entrance_id * 2) + 1] << 8) +
rom[kStartingEntranceXScroll + (entrance_id * 2)]);
camera_y_ = static_cast<ushort>(
camera_y_ = static_cast<uint16_t>(
(rom[kStartingEntranceYScroll + (entrance_id * 2) + 1] << 8) +
rom[kStartingEntranceYScroll + (entrance_id * 2)]);
camera_trigger_y_ = static_cast<ushort>(
camera_trigger_y_ = static_cast<uint16_t>(
(rom[kStartingEntranceCameraYTrigger + (entrance_id * 2) + 1] << 8) +
rom[kStartingEntranceCameraYTrigger + (entrance_id * 2)]);
camera_trigger_x_ = static_cast<ushort>(
camera_trigger_x_ = static_cast<uint16_t>(
(rom[kStartingEntranceCameraXTrigger + (entrance_id * 2) + 1] << 8) +
rom[kStartingEntranceCameraXTrigger + (entrance_id * 2)]);

View File

@@ -52,7 +52,7 @@ void RoomObject::DrawTile(gfx::Tile16 t, int xx, int yy,
std::vector<uint8_t>& current_gfx16,
std::vector<uint8_t>& tiles_bg1_buffer,
std::vector<uint8_t>& tiles_bg2_buffer,
ushort tileUnder) {
uint16_t tileUnder) {
bool preview = false;
if (width_ < xx + 8) {
width_ = xx + 8;
@@ -99,7 +99,7 @@ void RoomObject::DrawTile(gfx::Tile16 t, int xx, int yy,
0x1000 &&
((xx / 8) + nx_ + offset_x_) + ((ny_ + offset_y_ + (yy / 8)) * 0x40) >=
0) {
ushort td = 0; // gfx::GetTilesInfo();
uint16_t td = 0; // gfx::GetTilesInfo();
// collisionPoint.Add(
// new Point(xx + ((nx + offsetX) * 8), yy + ((ny + +offsetY) * 8)));

View File

@@ -81,7 +81,7 @@ class RoomObject : public SharedRom {
std::vector<uint8_t>& current_gfx16,
std::vector<uint8_t>& tiles_bg1_buffer,
std::vector<uint8_t>& tiles_bg2_buffer,
ushort tile_under = 0xFFFF);
uint16_t tile_under = 0xFFFF);
auto options() const { return options_; }
void set_options(ObjectOption options) { options_ = options; }

View File

@@ -13,8 +13,8 @@
#include <cstdio>
#include <vector>
#include "app/core/constants.h"
#include "app/rom.h"
#include "util/macro.h"
namespace yaze {
namespace zelda3 {
@@ -43,8 +43,8 @@ SongSpcBlock *Tracker::AllocSpcBlock(int len, int bank) {
ss_num++;
sbl->start = ss_next;
sbl->len = len;
sbl->buf = (uchar *)malloc(len);
sbl->relocs = (ushort *)malloc(32);
sbl->buf = (uint8_t *)malloc(len);
sbl->relocs = (uint16_t *)malloc(32);
sbl->relsz = 16;
sbl->relnum = 0;
sbl->bank = bank & 7;

View File

@@ -3,8 +3,8 @@
#include <vector>
#include "app/core/constants.h"
#include "app/rom.h"
#include "util/macro.h"
namespace yaze {
namespace zelda3 {
@@ -61,8 +61,8 @@ struct SongRange {
};
struct SongPart {
uchar flag;
uchar inst;
uint8_t flag;
uint8_t inst;
short tbl[8];
unsigned short addr;
};

View File

@@ -6,10 +6,10 @@
#include <vector>
#include "absl/status/status.h"
#include "app/core/constants.h"
#include "app/gfx/compression.h"
#include "app/gfx/snes_tile.h"
#include "app/rom.h"
#include "util/macro.h"
namespace yaze {
namespace zelda3 {

View File

@@ -3,9 +3,9 @@
#include <cstdint>
#include "app/core/constants.h"
#include "app/rom.h"
#include "app/zelda3/common.h"
#include "util/macro.h"
namespace yaze {
namespace zelda3 {
@@ -49,14 +49,14 @@ constexpr int kOverworldHoleEntrance = 0xDB84C;
class OverworldEntrance : public GameEntity {
public:
uint16_t map_pos_;
uchar entrance_id_;
uchar area_x_;
uchar area_y_;
uint8_t entrance_id_;
uint8_t area_x_;
uint8_t area_y_;
bool is_hole_ = false;
bool deleted = false;
OverworldEntrance() = default;
OverworldEntrance(int x, int y, uchar entrance_id, short map_id,
OverworldEntrance(int x, int y, uint8_t entrance_id, short map_id,
uint16_t map_pos, bool hole)
: map_pos_(map_pos), entrance_id_(entrance_id), is_hole_(hole) {
x_ = x;
@@ -67,8 +67,8 @@ class OverworldEntrance : public GameEntity {
int mapX = (map_id_ - ((map_id_ / 8) * 8));
int mapY = (map_id_ / 8);
area_x_ = (uchar)((std::abs(x - (mapX * 512)) / 16));
area_y_ = (uchar)((std::abs(y - (mapY * 512)) / 16));
area_x_ = (uint8_t)((std::abs(x - (mapX * 512)) / 16));
area_y_ = (uint8_t)((std::abs(y - (mapY * 512)) / 16));
}
void UpdateMapProperties(uint16_t map_id) override {
@@ -81,8 +81,8 @@ class OverworldEntrance : public GameEntity {
int mapX = (map_id_ - ((map_id_ / 8) * 8));
int mapY = (map_id_ / 8);
area_x_ = (uchar)((std::abs(x_ - (mapX * 512)) / 16));
area_y_ = (uchar)((std::abs(y_ - (mapY * 512)) / 16));
area_x_ = (uint8_t)((std::abs(x_ - (mapX * 512)) / 16));
area_y_ = (uint8_t)((std::abs(y_ - (mapY * 512)) / 16));
map_pos_ = (uint16_t)((((area_y_) << 6) | (area_x_ & 0x3F)) << 1);
}

View File

@@ -4,8 +4,8 @@
#include <cstdint>
#include <iostream>
#include "app/core/constants.h"
#include "app/zelda3/common.h"
#include "util/macro.h"
namespace yaze {
namespace zelda3 {
@@ -44,30 +44,31 @@ class OverworldExit : public GameEntity {
public:
uint16_t y_scroll_;
uint16_t x_scroll_;
uchar y_player_;
uchar x_player_;
uchar y_camera_;
uchar x_camera_;
uchar scroll_mod_y_;
uchar scroll_mod_x_;
uint8_t y_player_;
uint8_t x_player_;
uint8_t y_camera_;
uint8_t x_camera_;
uint8_t scroll_mod_y_;
uint8_t scroll_mod_x_;
uint16_t door_type_1_;
uint16_t door_type_2_;
uint16_t room_id_;
uint16_t map_pos_; // Position in the vram
uchar entrance_id_;
uchar area_x_;
uchar area_y_;
uint8_t entrance_id_;
uint8_t area_x_;
uint8_t area_y_;
bool is_hole_ = false;
bool deleted_ = false;
bool is_automatic_ = false;
bool large_map_ = false;
OverworldExit() = default;
OverworldExit(uint16_t room_id, uchar map_id, uint16_t vram_location,
OverworldExit(uint16_t room_id, uint8_t map_id, uint16_t vram_location,
uint16_t y_scroll, uint16_t x_scroll, uint16_t player_y,
uint16_t player_x, uint16_t camera_y, uint16_t camera_x,
uchar scroll_mod_y, uchar scroll_mod_x, uint16_t door_type_1,
uint16_t door_type_2, bool deleted = false)
uint8_t scroll_mod_y, uint8_t scroll_mod_x,
uint16_t door_type_1, uint16_t door_type_2,
bool deleted = false)
: map_pos_(vram_location),
entrance_id_(0),
area_x_(0),
@@ -94,19 +95,19 @@ class OverworldExit : public GameEntity {
int mapX = (map_id_ - ((map_id_ / 8) * 8));
int mapY = (map_id_ / 8);
area_x_ = (uchar)((std::abs(x_ - (mapX * 512)) / 16));
area_y_ = (uchar)((std::abs(y_ - (mapY * 512)) / 16));
area_x_ = (uint8_t)((std::abs(x_ - (mapX * 512)) / 16));
area_y_ = (uint8_t)((std::abs(y_ - (mapY * 512)) / 16));
if (door_type_1 != 0) {
int p = (door_type_1 & 0x7FFF) >> 1;
entrance_id_ = (uchar)(p % 64);
area_y_ = (uchar)(p >> 6);
entrance_id_ = (uint8_t)(p % 64);
area_y_ = (uint8_t)(p >> 6);
}
if (door_type_2 != 0) {
int p = (door_type_2 & 0x7FFF) >> 1;
entrance_id_ = (uchar)(p % 64);
area_y_ = (uchar)(p >> 6);
entrance_id_ = (uint8_t)(p % 64);
area_y_ = (uint8_t)(p >> 6);
}
if (map_id_ >= 64) {
@@ -116,8 +117,8 @@ class OverworldExit : public GameEntity {
mapX = (map_id_ - ((map_id_ / 8) * 8));
mapY = (map_id_ / 8);
area_x_ = (uchar)((std::abs(x_ - (mapX * 512)) / 16));
area_y_ = (uchar)((std::abs(y_ - (mapY * 512)) / 16));
area_x_ = (uint8_t)((std::abs(x_ - (mapX * 512)) / 16));
area_y_ = (uint8_t)((std::abs(y_ - (mapY * 512)) / 16));
map_pos_ = (uint16_t)((((area_y_) << 6) | (area_x_ & 0x3F)) << 1);
}
@@ -139,8 +140,8 @@ class OverworldExit : public GameEntity {
int mapX = map_id - ((map_id / 8) * 8);
int mapY = map_id / 8;
area_x_ = (uchar)((std::abs(x_ - (mapX * 512)) / 16));
area_y_ = (uchar)((std::abs(y_ - (mapY * 512)) / 16));
area_x_ = (uint8_t)((std::abs(x_ - (mapX * 512)) / 16));
area_y_ = (uint8_t)((std::abs(y_ - (mapY * 512)) / 16));
if (map_id >= 64) {
map_id -= 64;

View File

@@ -423,7 +423,7 @@ void OverworldMap::DrawAnimatedTiles() {
void OverworldMap::LoadAreaGraphicsBlocksets() {
for (int i = 0; i < 4; i++) {
uchar value = rom_[rom_.version_constants().kOverworldGfxGroups1 +
uint8_t value = rom_[rom_.version_constants().kOverworldGfxGroups1 +
(area_graphics_ * 4) + i];
if (value != 0) {
static_graphics_[3 + i] = value;
@@ -595,16 +595,16 @@ absl::Status OverworldMap::LoadPalette() {
area_palette_ = std::min((int)area_palette_, 0xA3);
uchar pal0 = 0;
uchar pal1 = rom_[rom_.version_constants().kOverworldMapPaletteGroup +
uint8_t pal0 = 0;
uint8_t pal1 = rom_[rom_.version_constants().kOverworldMapPaletteGroup +
(area_palette_ * 4)];
uchar pal2 = rom_[rom_.version_constants().kOverworldMapPaletteGroup +
uint8_t pal2 = rom_[rom_.version_constants().kOverworldMapPaletteGroup +
(area_palette_ * 4) + 1];
uchar pal3 = rom_[rom_.version_constants().kOverworldMapPaletteGroup +
uint8_t pal3 = rom_[rom_.version_constants().kOverworldMapPaletteGroup +
(area_palette_ * 4) + 2];
uchar pal4 =
uint8_t pal4 =
rom_[kOverworldSpritePaletteGroup + (sprite_palette_[game_state_] * 2)];
uchar pal5 = rom_[kOverworldSpritePaletteGroup +
uint8_t pal5 = rom_[kOverworldSpritePaletteGroup +
(sprite_palette_[game_state_] * 2) + 1];
auto grass_pal_group = rom_.palette_group().grass;

View File

@@ -18,7 +18,7 @@ void TitleScreen::Create() {
}
void TitleScreen::BuildTileset() {
uchar staticgfx[16] = {0};
uint8_t staticgfx[16] = {0};
// Main Blocksets
@@ -37,13 +37,13 @@ void TitleScreen::BuildTileset() {
staticgfx[15] = 112;
// Loaded gfx for the current screen (empty at this point)
uchar* currentmapgfx8Data = tiles8Bitmap.mutable_data().data();
uint8_t* currentmapgfx8Data = tiles8Bitmap.mutable_data().data();
// All gfx of the game pack of 2048 bytes (4bpp)
uchar* allgfxData = nullptr;
uint8_t* allgfxData = nullptr;
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 2048; j++) {
uchar mapByte = allgfxData[j + (staticgfx[i] * 2048)];
uint8_t mapByte = allgfxData[j + (staticgfx[i] * 2048)];
switch (i) {
case 0:
case 3:
@@ -83,7 +83,7 @@ void TitleScreen::LoadTitleScreen() {
int jj = 0;
int posB = pos;
while (j < (length / 2) + 1) {
ushort tiledata = (ushort)pos;
uint16_t tiledata = (uint16_t)pos;
if (dest_addr >= 0x1000) {
// destAddr -= 0x1000;
if (dest_addr < 0x2000) {

View File

@@ -43,12 +43,12 @@ class TitleScreen {
int addressesgfx[7] = {0x53ee0, 0x53f04, 0x53ef2, 0x53f16,
0x53f28, 0x53f3a, 0x53f4c};
ushort bossRoom = 0x000F;
ushort selected_tile = 0;
ushort tilesBG1Buffer[0x1000]; // 0x1000
ushort tilesBG2Buffer[0x1000]; // 0x1000
uchar mapdata; // 64 * 64
uchar dwmapdata; // 64 * 64
uint16_t bossRoom = 0x000F;
uint16_t selected_tile = 0;
uint16_t tilesBG1Buffer[0x1000]; // 0x1000
uint16_t tilesBG2Buffer[0x1000]; // 0x1000
uint8_t mapdata; // 64 * 64
uint8_t dwmapdata; // 64 * 64
bool mDown = false;
bool swordSelected = false;