Fixed NPCs path alignement and importation (thanks Lephé)

This commit is contained in:
SlyVTT 2023-08-20 10:29:10 +02:00
parent 8a7a09d960
commit db2880dc8f
2 changed files with 3 additions and 4 deletions

View file

@ -32,7 +32,7 @@ extern Map *worldRPG[];
/* Game data (defined in "game.h")*/ /* Game data (defined in "game.h")*/
Game game = { Game game = {
NULL, NULL,
{12*PXSIZE, 36*PXSIZE, 0, 0, 10*PXSIZE, 48*PXSIZE, 100, SPEED, false, 0, false}, {12*PXSIZE, 36*PXSIZE, 0, 0, 12*PXSIZE, 36*PXSIZE, 100, SPEED, false, 0, false},
false, false, false, 0 false, false, false, 0
/* debug variables*/ /* debug variables*/

View file

@ -40,11 +40,10 @@ void npc_draw(Game *game) {
int16_t deltaX1=((int16_t) (Data->x + Data->xpath[v % NbPoints]) * PXSIZE)-(int16_t) player->wx; int16_t deltaX1=((int16_t) (Data->x + Data->xpath[v % NbPoints]) * PXSIZE)-(int16_t) player->wx;
int16_t deltaY1=((int16_t) (Data->x + Data->ypath[v % NbPoints]) * PXSIZE)-(int16_t) player->wy; int16_t deltaY1=((int16_t) (Data->y + Data->ypath[v % NbPoints]) * PXSIZE)-(int16_t) player->wy;
/*DEBUG*/ dprint(0, 0, 0xFAFA, "coucou 43 : %d", v); dupdate(); getkey(); //plante avant ici (le v % NbPoints est sus)
int16_t deltaX2=((int16_t) (Data->x + Data->xpath[(v+1) % NbPoints]) * PXSIZE)-(int16_t) player->wx; int16_t deltaX2=((int16_t) (Data->x + Data->xpath[(v+1) % NbPoints]) * PXSIZE)-(int16_t) player->wx;
int16_t deltaY2=((int16_t) (Data->x + Data->ypath[(v+1) % NbPoints]) * PXSIZE)-(int16_t) player->wy; int16_t deltaY2=((int16_t) (Data->y + Data->ypath[(v+1) % NbPoints]) * PXSIZE)-(int16_t) player->wy;
dline( player->px + deltaX1, player->py + deltaY1, dline( player->px + deltaX1, player->py + deltaY1,
player->px + deltaX2, player->py + deltaY2, player->px + deltaX2, player->py + deltaY2,