mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2024-12-28 20:43:42 +01:00
Merge pull request 'Merge' (#40) from Fcalva/Collab_RPG_Fcalva:master into master
Reviewed-on: https://gitea.planet-casio.com/Slyvtt/Collab_RPG/pulls/40
This commit is contained in:
commit
37f9eb213b
2 changed files with 12 additions and 10 deletions
|
@ -4,12 +4,14 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <gint/keyboard.h>
|
#include <gint/keyboard.h>
|
||||||
#include <gint/cpu.h>
|
#include <gint/cpu.h>
|
||||||
#include <gint/display.h>
|
#include <gint/display.h>
|
||||||
|
|
||||||
#include "npc.h"
|
#include "npc.h"
|
||||||
#include "stdlib.h"
|
|
||||||
|
|
||||||
extern bopti_image_t SignAction_img;
|
extern bopti_image_t SignAction_img;
|
||||||
|
|
||||||
|
@ -25,7 +27,7 @@ void game_logic(Game *game) {
|
||||||
update_npc( game );
|
update_npc( game );
|
||||||
|
|
||||||
/* we check if interactions are possible close to the player */
|
/* we check if interactions are possible close to the player */
|
||||||
for( int i=0; i<game->map_level->nbextradata; i++ )
|
for( uint32_t i=0; i<game->map_level->nbextradata; i++ )
|
||||||
{
|
{
|
||||||
/* simple distance check along X and Y axis */
|
/* simple distance check along X and Y axis */
|
||||||
/* Be careful to use world coordinates, not local (i.e.map) ones */
|
/* Be careful to use world coordinates, not local (i.e.map) ones */
|
||||||
|
@ -47,7 +49,7 @@ void game_logic(Game *game) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int i=0; i<nbNPC; i++ )
|
for( uint32_t i=0; i<nbNPC; i++ )
|
||||||
{
|
{
|
||||||
/* simple distance check along X and Y axis */
|
/* simple distance check along X and Y axis */
|
||||||
/* Be careful to use world coordinates, not local (i.e.map) ones */
|
/* Be careful to use world coordinates, not local (i.e.map) ones */
|
||||||
|
|
14
src/map.c
14
src/map.c
|
@ -199,8 +199,8 @@ short int get_tile(Game *game, int x, int y, int l) {
|
||||||
Map *map_level = game->map_level;
|
Map *map_level = game->map_level;
|
||||||
|
|
||||||
/* Get the tile at (x, y) on layer l. Returns the tile ID or MAP_OUTSIDE if
|
/* Get the tile at (x, y) on layer l. Returns the tile ID or MAP_OUTSIDE if
|
||||||
* she's not found. */
|
* it's not found. */
|
||||||
return (x>=0 && x < map_level->w && y>=0 && y < map_level->h) ?
|
return (x>=0 && x < (int) map_level->w && y>=0 && y < (int) map_level->h) ?
|
||||||
map_level->layers[l][y * map_level->w + x] : MAP_OUTSIDE;
|
map_level->layers[l][y * map_level->w + x] : MAP_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ short int get_walkable(Game *game, int x, int y) {
|
||||||
Map *map_level = game->map_level;
|
Map *map_level = game->map_level;
|
||||||
/* Get the tile at (x, y). Returns the tile ID or MAP_OUTSIDE if she's not
|
/* Get the tile at (x, y). Returns the tile ID or MAP_OUTSIDE if she's not
|
||||||
* found. */
|
* found. */
|
||||||
return (x>=0 && x < map_level->w && y>=0 && y < map_level->h) ?
|
return (x>=0 && x < (int) map_level->w && y>=0 && y < (int) map_level->h) ?
|
||||||
map_level->walkable[y * map_level->w + x] : MAP_OUTSIDE;
|
map_level->walkable[y * map_level->w + x] : MAP_OUTSIDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +217,8 @@ short int get_walkable(Game *game, int x, int y) {
|
||||||
Map *get_map_for_coordinates( Game *game, int x, int y )
|
Map *get_map_for_coordinates( Game *game, int x, int y )
|
||||||
{
|
{
|
||||||
/* check if the current map contains the point */
|
/* check if the current map contains the point */
|
||||||
if (x>=game->map_level->xmin && x<game->map_level->xmax &&
|
if (x>= (int)game->map_level->xmin && x< (int)game->map_level->xmax &&
|
||||||
y>=game->map_level->ymin && y<game->map_level->ymax)
|
y>= (int)game->map_level->ymin && y< (int)game->map_level->ymax)
|
||||||
return game->map_level;
|
return game->map_level;
|
||||||
|
|
||||||
/* else we check in worldRPG if there is a mal containing that point */
|
/* else we check in worldRPG if there is a mal containing that point */
|
||||||
|
@ -226,8 +226,8 @@ Map *get_map_for_coordinates( Game *game, int x, int y )
|
||||||
Map *current = worldRPG[i];
|
Map *current = worldRPG[i];
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (x>=current->xmin && x<current->xmax &&
|
if (x>= (int)current->xmin && x< (int)current->xmax &&
|
||||||
y>=current->ymin && y<current->ymax)
|
y>= (int)current->ymin && y< (int)current->ymax)
|
||||||
return current;
|
return current;
|
||||||
i++;
|
i++;
|
||||||
current = worldRPG[i];
|
current = worldRPG[i];
|
||||||
|
|
Loading…
Reference in a new issue