mirror of
https://git.planet-casio.com/Slyvtt/Collab_RPG.git
synced 2025-05-28 14:35:18 +02:00
npc : remove_npc() parfait
This commit is contained in:
parent
1c978dbefa
commit
35e1d498f9
2 changed files with 4 additions and 12 deletions
|
@ -279,15 +279,9 @@ void game_get_inputs(Game *game) {
|
||||||
mynpc->xpath = NULL;
|
mynpc->xpath = NULL;
|
||||||
mynpc->ypath = NULL;
|
mynpc->ypath = NULL;
|
||||||
}
|
}
|
||||||
while(keydown(KEY_F1)) {
|
|
||||||
clearevents();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(keydown(KEY_F2)) {
|
if(keydown(KEY_F2)) {
|
||||||
npc_remove_pos(0);
|
npc_remove_pos(0);
|
||||||
while(keydown(KEY_F2)) {
|
|
||||||
clearevents();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display Debug Information on screen */
|
/* Display Debug Information on screen */
|
||||||
|
|
10
src/npc.c
10
src/npc.c
|
@ -48,8 +48,6 @@ void npc_remove(NPC *npc) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uint32_t move_size = sizeof(NPC) * (npc_count - pos);
|
uint32_t move_size = sizeof(NPC) * (npc_count - pos);
|
||||||
if(move_size + pos > NPC_STACK_SIZE)
|
|
||||||
move_size = NPC_STACK_SIZE - pos;
|
|
||||||
|
|
||||||
memmove(npc, &npc_stack[++pos], move_size);
|
memmove(npc, &npc_stack[++pos], move_size);
|
||||||
if(npc_count)
|
if(npc_count)
|
||||||
|
@ -132,8 +130,8 @@ int npc_pathfind(int32_t dest_x, int32_t dest_y, Map *full_map, NPC *npc) {
|
||||||
dest_x /= PXSIZE;
|
dest_x /= PXSIZE;
|
||||||
dest_y /= PXSIZE;
|
dest_y /= PXSIZE;
|
||||||
|
|
||||||
if(dest_x < 0 || dest_y < 0 || dest_x >= w * T_WIDTH ||
|
if(dest_x < 0 || dest_y < 0 || dest_x >= (int32_t)(w * T_WIDTH) ||
|
||||||
dest_y >= h * T_HEIGHT)
|
dest_y >= (int32_t)(h * T_HEIGHT))
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
/*if(map[(dest_y/T_HEIGHT)*w + dest_x/T_WIDTH])
|
/*if(map[(dest_y/T_HEIGHT)*w + dest_x/T_WIDTH])
|
||||||
|
@ -179,9 +177,9 @@ int as_reconstruct_path(int16_t *came_from, int w, int h, int16_t start,
|
||||||
goto as_recons_fail;
|
goto as_recons_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t tx, ty;
|
/*uint16_t tx, ty;*/
|
||||||
|
|
||||||
// Flip the path because it started from the end
|
/* Flip the path because it started from the end */
|
||||||
|
|
||||||
/*for(i = 0; i < npc->path_length / 2; i++) {
|
/*for(i = 0; i < npc->path_length / 2; i++) {
|
||||||
tx = npc->xpath[i];
|
tx = npc->xpath[i];
|
||||||
|
|
Loading…
Add table
Reference in a new issue