Skip to content

Commit 6a9835f

Browse files
committed
various bug fixes
1 parent f5bee22 commit 6a9835f

34 files changed

Lines changed: 301 additions & 147 deletions

bin/sync.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def sync_pixels(sync_list):
5959
"data/pixels/sheet1.obl",
6060
"data/pixels/tiles.obl",
6161
"data/pixels/uisheet.png",
62+
"data/pixels/cs3layers.png",
6263
]
6364
for f in paths:
6465
sync_list.append([f, DEST_PIXELS + ntpath.basename(f), False])

data/levels.mapz

-40 KB
Binary file not shown.

data/pixels/animz.obl

1.16 KB
Binary file not shown.

data/pixels/cs3layers.png

49 Bytes
Loading

data/pixels/tiles.obl

80 Bytes
Binary file not shown.

external/SDL3

Submodule SDL3 updated 814 files

src/ai_path.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -346,11 +346,7 @@ std::vector<JoyAim> LineOfSight::findPath(ISprite &sprite, const Pos &playerPos)
346346
}
347347
}
348348
if (!moved)
349-
{
350-
// LOGE("Cannot move from (%d,%d) toward (%d,%d) on line %d",
351-
// x, y, goalPos.x, goalPos.y, __LINE__);
352349
return {};
353-
}
354350
}
355351

356352
return directions;
@@ -498,14 +494,6 @@ std::vector<JoyAim> AStarSmooth::findPath(ISprite &sprite, const Pos &playerPos)
498494
////////////////////////////////////////////////
499495
CPath::Result CPath::followPath(ISprite &sprite, const Pos &playerPos, const IPath &astar)
500496
{
501-
/*
502-
if (!sprite.isBoss())
503-
LOGI("sprite: %p[%d,%d] aim:%d p[%d,%d] ptr=%lu timeout=%lu cache:%lu ttl:%d",
504-
&sprite, sprite.x(), sprite.y(), sprite.getAim(),
505-
playerPos.x, playerPos.y,
506-
m_pathIndex, m_pathTimeout, m_cachedDirections.size(), sprite.getTTL());
507-
*/
508-
509497
// Check if path is invalid or timed out
510498
if (m_pathIndex >= m_cachedDirections.size() || m_pathTimeout <= 0)
511499
{

src/animator.cpp

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@
2424
#include <vector>
2525
#include <set>
2626
#include <array>
27+
#include "shared/IFile.h"
2728

2829
constexpr uint8_t NO_SPECIAL_ID = 0;
2930
constexpr const size_t SEQ_COUNT = 30;
3031

31-
const std::array<CAnimator::animzSeq_t, SEQ_COUNT> g_animzSeq = {{
32+
constexpr const std::array<CAnimator::animzSeq_t, SEQ_COUNT> g_animzSeq = {{
3233
{TILES_DIAMOND, ANIMZ_DIAMOND, ANIMZ_DIAMOND_LEN, NO_SPECIAL_ID},
3334
{TILES_INSECT1, ANIMZ_INSECT1_DN, ANIMZ_INSECT1_LEN, ANIMZ_INSECT1},
3435
{TILES_SWAMP, ANIMZ_SWAMP, ANIMZ_SWAMP_LEN, NO_SPECIAL_ID},
@@ -61,14 +62,6 @@ const std::array<CAnimator::animzSeq_t, SEQ_COUNT> g_animzSeq = {{
6162
{SFX_FLAME, ANIMZ_FLAME, ANIMZ_FLAME_LEN, ANIMZ_FLAME}, // barrel flame
6263
}};
6364

64-
const std::set<uint8_t> g_specialCases = {
65-
TILES_INSECT1,
66-
TILES_MUSH_IDLE,
67-
TILES_DRAGO,
68-
TILES_ETURTLE,
69-
TILES_WHTEWORM,
70-
};
71-
7265
CAnimator::CAnimator() : m_seqIndex(g_animzSeq.size(), 0)
7366
{
7467
memset(m_tileMainLayer, NO_ANIMZ, sizeof(m_tileMainLayer));
@@ -83,7 +76,6 @@ CAnimator::CAnimator() : m_seqIndex(g_animzSeq.size(), 0)
8376
++i;
8477
}
8578

86-
// std::fill(m_tileMainLayer.begin(), m_tileReplacement.end(), NO_ANIMZ);
8779
for (const auto &seq : g_animzSeq)
8880
{
8981
m_seqLookUp[seq.srcTile] = animzInfo_t{
@@ -125,11 +117,6 @@ uint16_t CAnimator::offset() const
125117
return m_offset;
126118
}
127119

128-
bool CAnimator::isSpecialCase(uint8_t tileID) const
129-
{
130-
return g_specialCases.find(tileID) != g_specialCases.end();
131-
}
132-
133120
animzInfo_t CAnimator::getSpecialInfo(const int tileID) const
134121
{
135122
const auto &it = m_seqLookUp.find(tileID);
@@ -142,4 +129,30 @@ animzInfo_t CAnimator::getSpecialInfo(const int tileID) const
142129
};
143130
}
144131
return animzInfo_t{};
145-
}
132+
}
133+
134+
bool CAnimator::read(IFile &sfile)
135+
{
136+
if (sfile.read(m_tileMainLayer, sizeof(m_tileMainLayer)) != IFILE_OK)
137+
{
138+
return false;
139+
}
140+
if (sfile.read(m_tileLayer, sizeof(m_tileLayer)) != IFILE_OK)
141+
{
142+
return false;
143+
}
144+
return false;
145+
}
146+
147+
bool CAnimator::write(IFile &sfile) const
148+
{
149+
if (sfile.write(m_tileMainLayer, sizeof(m_tileMainLayer)) != IFILE_OK)
150+
{
151+
return false;
152+
}
153+
if (sfile.write(m_tileLayer, sizeof(m_tileLayer)) != IFILE_OK)
154+
{
155+
return false;
156+
}
157+
return false;
158+
}

src/animator.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,16 @@
1717
*/
1818
#pragma once
1919

20+
#include "tilesdata.h"
2021
#include <cstdint>
2122
#include <unordered_map>
2223
#include <vector>
2324
#include <array>
2425

26+
extern const uint8_t g_specialCases[];
27+
28+
class IFile;
29+
2530
struct animzInfo_t
2631
{
2732
uint8_t frames;
@@ -46,9 +51,18 @@ class CAnimator
4651
}
4752

4853
uint16_t offset() const;
49-
bool isSpecialCase(uint8_t tileID) const;
54+
constexpr bool isSpecialCase(uint8_t tileID) const
55+
{
56+
for (const auto &val : m_specialCases)
57+
if (val == tileID)
58+
return true;
59+
return false;
60+
}
5061
animzInfo_t getSpecialInfo(const int tileID) const;
5162

63+
bool read(IFile &sfile);
64+
bool write(IFile &sfile) const;
65+
5266
struct animzSeq_t
5367
{
5468
uint16_t srcTile; ///< Source tile ID.
@@ -58,6 +72,14 @@ class CAnimator
5872
};
5973

6074
private:
75+
static inline constexpr const uint8_t m_specialCases[] = {
76+
TILES_INSECT1,
77+
TILES_MUSH_IDLE,
78+
TILES_DRAGO,
79+
TILES_ETURTLE,
80+
TILES_WHTEWORM,
81+
};
82+
6183
enum : uint32_t
6284
{
6385
NO_ANIMZ = 255,

src/animzdata.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,18 @@ enum Animz
189189
ANIMZ_EXPLOSION0_5 = 0xa3,
190190
ANIMZ_EXPLOSION0_6 = 0xa4,
191191
ANIMZ_EXPLOSION0_7 = 0xa5,
192+
ANIMZ_SKELETON = 0xa6,
193+
ANIMZ_SKELETON_2 = 0xa7,
194+
ANIMZ_SKELETON_3 = 0xa8,
195+
ANIMZ_SKELETONDN = 0xa9,
196+
ANIMZ_SKELETONDN_2 = 0xaa,
197+
ANIMZ_SKELETONDN_3 = 0xab,
198+
ANIMZ_SKELETONLF = 0xac,
199+
ANIMZ_SKELETONLF_2 = 0xad,
200+
ANIMZ_SKELETONLF_3 = 0xae,
201+
ANIMZ_SKELETONRG = 0xaf,
202+
ANIMZ_SKELETONRG_2 = 0xb0,
203+
ANIMZ_SKELETONRG_3 = 0xb1,
192204
ANIMZ_SWAMP_LEN = 0x02,
193205
ANIMZ_DIAMOND_LEN = 0x06,
194206
ANIMZ_FLAME_LEN = 0x03,
@@ -226,5 +238,9 @@ enum Animz
226238
ANIMZ_EXPLOSION7_LEN = 0x04,
227239
ANIMZ_EXPLOSION5_LEN = 0x07,
228240
ANIMZ_EXPLOSION0_LEN = 0x07,
229-
ANIMZ_TOTAL_COUNT = 0xa6,
241+
ANIMZ_SKELETON_LEN = 0x03,
242+
ANIMZ_SKELETONDN_LEN = 0x03,
243+
ANIMZ_SKELETONLF_LEN = 0x03,
244+
ANIMZ_SKELETONRG_LEN = 0x03,
245+
ANIMZ_TOTAL_COUNT = 0xb2,
230246
};

0 commit comments

Comments
 (0)