Skip to content

Commit

Permalink
Merge pull request #152 from TheFakeMontyOnTheRun/ui-ux-tweaks
Browse files Browse the repository at this point in the history
UI ux tweaks
  • Loading branch information
TheFakeMontyOnTheRun authored Jul 1, 2024
2 parents 5c094b4 + 0164108 commit bf4f544
Show file tree
Hide file tree
Showing 151 changed files with 12,144 additions and 3,521 deletions.
Binary file added art/Blaec-gw22P.ttf
Binary file not shown.
160 changes: 160 additions & 0 deletions art/ending.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions art/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 12 additions & 2 deletions common/include/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,25 @@ struct StaticBuffer {
size_t size;
};

#ifndef USE_CUSTOM_MEMORY_HANDLER
#ifndef NO_DYNAMIC_MEMORY_ALLOC
void *allocMem(size_t sizeInBytes, enum MemoryType type, uint8_t clearAfterAlloc);

void disposeMem(void* ptr);
#endif

void memCopyToFrom(void* dst, void* src, size_t sizeInBytes);

void memFill(void* dst, uint8_t val, size_t sizeInBytes);
#endif

#ifdef ENDIANESS_AWARE
uint8_t isBigEndian(void);

void initFileReader(const char * dataFilePath);

uint32_t toNativeEndianess(const uint32_t val);
#endif

int countLines(const char* text);

extern const char *mainText;
extern char *textBuffer;
Expand All @@ -70,6 +75,9 @@ extern size_t biggestOption;

#define TEXT_BUFFER_SIZE (40 * 25)


#ifndef USE_OWN_MIN_MAX

#ifndef SMD
#ifndef WIN32
#ifndef LEAN_BUILD
Expand All @@ -80,3 +88,5 @@ extern size_t biggestOption;
#endif

#endif

#endif
2 changes: 1 addition & 1 deletion common/include/Dungeon.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct GameSnapshot {
struct Vec2i playerTarget;
};

struct GameSnapshot dungeon_tick(const enum ECommand cmd);
struct GameSnapshot dungeonTick(const enum ECommand command);

void dungeon_loadMap(
const uint8_t *__restrict__ mapData,
Expand Down
2 changes: 0 additions & 2 deletions common/include/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ enum EGameMenuState HackingScreen_tickCallback(enum ECommand, void* data);

void HackingScreen_unloadStateCallback(enum EGameMenuState newState);

int countLines(void);

void enterState(enum EGameMenuState State);

int loopTick(enum ECommand cmd);
Expand Down
3 changes: 2 additions & 1 deletion common/include/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ enum EDirection {
enum CrawlerState {
kCrawlerGameOver = -1,
kCrawlerQuit = 0,
kCrawlerGameInProgress = 1
kCrawlerGameInProgress = 1,
kCrawlerGameFinished = 2
};

enum ECommand {
Expand Down
2 changes: 1 addition & 1 deletion common/include/UI.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum EGameMenuState handleCursor(const enum EGameMenuState* options,
const enum ECommand cmd,
enum EGameMenuState backState);

void drawGraphic(const uint8_t *shapes);
void drawGraphic(uint16_t x, uint8_t y, uint16_t dx, uint8_t dy, const uint8_t *shapes);

extern int8_t cursorPosition;

Expand Down
2 changes: 1 addition & 1 deletion common/src/CTile3DProperties.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void loadPropertyList(const char *propertyFile, struct MapWithCharKey *map, stru
uint8_t len = *(bufferHead++);

char* meshName = (char*)allocMem(len + 1, GENERAL_MEMORY, 1);
memcpy(meshName, bufferHead, len);
memCopyToFrom(meshName, (char*)bufferHead, len);
mesh = (struct Mesh*)allocMem(sizeof(struct Mesh), GENERAL_MEMORY, 1);
sprintf(&meshNameWithExtension[0], "%s.mdl", meshName);
loadMesh(mesh, &meshNameWithExtension[0]);
Expand Down
30 changes: 27 additions & 3 deletions common/src/Common.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@


#ifndef USE_CUSTOM_MEMORY_HANDLER

#ifndef NO_DYNAMIC_MEMORY_ALLOC
void *allocMem(size_t sizeInBytes, enum MemoryType type, uint8_t clearAfterAlloc) {
/*
For the general allocator, we're not worried about the type of memory. It all comes from the
Expand All @@ -60,7 +60,7 @@ void *allocMem(size_t sizeInBytes, enum MemoryType type, uint8_t clearAfterAlloc
if (clearAfterAlloc) {
memset(ptr, 0, sizeInBytes);
}

(void)type;

return ptr;
Expand All @@ -74,7 +74,7 @@ void disposeMem(void *ptr) {
#endif

}

#endif
void memCopyToFrom(void *dst, void *src, size_t sizeInBytes) {
memcpy(dst, src, sizeInBytes);
}
Expand Down Expand Up @@ -112,3 +112,27 @@ uint32_t toNativeEndianess(const uint32_t val) {
return val2;
}
#endif


int countLines(const char* text) {
int lines = 1;
int chars = 0;

while(*text) {
++chars;

if (
#ifdef XRES_FRAMEBUFFER
(chars >= (XRES_FRAMEBUFFER / 8)) ||
#endif
*text == '\n') {
++lines;
chars = 0;
}

++text;
}


return lines;
}
4 changes: 2 additions & 2 deletions common/src/Crawler.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ void Crawler_repaintCallback(void) {
/* The dithered filter on top of the 3D rendering*/
fillRect(0, 0, XRES_FRAMEBUFFER, YRES_FRAMEBUFFER, getPaletteEntry(0xFF000000), TRUE);

drawWindowWithOptions((XRES_FRAMEBUFFER / 8) - biggestOption - 3,
((YRES_FRAMEBUFFER / 8) + 1) - (optionsHeight / 8) - 3,
drawWindowWithOptions((XRES_FRAMEBUFFER / 8) - biggestOption - 4,
((YRES_FRAMEBUFFER / 8) + 1) - (optionsHeight / 8) - 4,
biggestOption + 2,
(optionsHeight / 8) + 2,
AbandonMission_Title,
Expand Down
Loading

0 comments on commit bf4f544

Please sign in to comment.