Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Decompilation] [th04/th05] Player position clamping
Completes P0148, funded by [Anonymous].
- Loading branch information
Showing
8 changed files
with
55 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma option -zPmain_01 | ||
|
||
extern "C" { | ||
#include "platform.h" | ||
#include "pc98.h" | ||
#include "th01/math/subpixel.hpp" | ||
#include "th04/math/motion.hpp" | ||
#include "th04/main/playfld.hpp" | ||
#include "th04/main/player/player.h" | ||
|
||
static const pixel_t MOVE_MARGIN_LEFT = 8; | ||
static const pixel_t MOVE_MARGIN_TOP = 8; | ||
static const pixel_t MOVE_MARGIN_RIGHT = 8; | ||
static const pixel_t MOVE_MARGIN_BOTTOM = 16; | ||
|
||
#define clamp(v, min, max) \ | ||
/* Sneaky! That's how we can pretend this is an actual function that */ \ | ||
/* returns a value. */ \ | ||
v; \ | ||
if(static_cast<subpixel_t>(v) < to_sp(min)) { \ | ||
v = to_sp(min); \ | ||
} else if(static_cast<subpixel_t>(v) > to_sp(max)) { \ | ||
v = to_sp(max); \ | ||
} | ||
|
||
void near player_pos_update_and_clamp(void) | ||
{ | ||
/* _DX:_AX = */ motion_update_seg1(player_pos); | ||
_AX = clamp(_AX, (0 + MOVE_MARGIN_LEFT), (PLAYFIELD_W - MOVE_MARGIN_RIGHT)); | ||
_DX = clamp(_DX, (0 + MOVE_MARGIN_TOP), (PLAYFIELD_H - MOVE_MARGIN_BOTTOM)); | ||
player_pos.cur.x.v = _AX; | ||
player_pos.cur.y.v = _DX; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "th04/main/player/pos.cpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters