Fix demo1 OOB
This commit is contained in:
parent
bb26598418
commit
7c26888a16
1 changed files with 7 additions and 4 deletions
11
demo1.cpp
11
demo1.cpp
|
@ -11,7 +11,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// redefine some parameters
|
// redefine some parameters
|
||||||
#define FPS 40
|
#define FPS 60
|
||||||
#define GRAVITY_ACCELERATION (UNITS_PER_SQUARE * 3)
|
#define GRAVITY_ACCELERATION (UNITS_PER_SQUARE * 3)
|
||||||
#define PLAYER_JUMP_SPEED 700
|
#define PLAYER_JUMP_SPEED 700
|
||||||
#define CAMERA_COLL_HEIGHT_BELOW ((3 * UNITS_PER_SQUARE) / 2)
|
#define CAMERA_COLL_HEIGHT_BELOW ((3 * UNITS_PER_SQUARE) / 2)
|
||||||
|
@ -950,10 +950,13 @@ const unsigned char spriteTorch2[] =
|
||||||
const unsigned char *textures[] = {texture1, texture2, texture3, texture4};
|
const unsigned char *textures[] = {texture1, texture2, texture3, texture4};
|
||||||
|
|
||||||
#define withinMapReturn(what,whatElse)\
|
#define withinMapReturn(what,whatElse)\
|
||||||
int16_t index = (LEVEL_Y_RES - y - 1) * LEVEL_X_RES + x;\
|
if (x >= 0 && x < LEVEL_X_RES && y >= 0 && y < LEVEL_Y_RES)\
|
||||||
if (index > 0 && index < LEVEL_Y_RES * LEVEL_X_RES)\
|
{\
|
||||||
|
int16_t index = (LEVEL_Y_RES - y - 1) * LEVEL_X_RES + x;\
|
||||||
return (what);\
|
return (what);\
|
||||||
return (whatElse);
|
}\
|
||||||
|
else\
|
||||||
|
return (whatElse);
|
||||||
|
|
||||||
Unit textureAt(int16_t x, int16_t y)
|
Unit textureAt(int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue