diff --git a/src/entities/evilBlobs/shotgunBlob.h b/src/entities/evilBlobs/shotgunBlob.h index 87bb9bc..641499f 100644 --- a/src/entities/evilBlobs/shotgunBlob.h +++ b/src/entities/evilBlobs/shotgunBlob.h @@ -24,4 +24,3 @@ extern Unit *createUnit(void); extern void initEvilBlob(Unit *u); extern Sprite *getSprite(char *name); -extern Entity *self; diff --git a/src/entities/structures/cardReader.h b/src/entities/structures/cardReader.h index 927a87e..5107bbd 100644 --- a/src/entities/structures/cardReader.h +++ b/src/entities/structures/cardReader.h @@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../../common.h" #include "../../json/cJSON.h" -extern void initEntity(Entity *e); extern Sprite *getSprite(char *name); extern void removeItem(char *name); extern int hasItem(char *name); diff --git a/src/test/atlasTest.c b/src/test/atlasTest.c index a08ed37..a06e372 100644 --- a/src/test/atlasTest.c +++ b/src/test/atlasTest.c @@ -23,12 +23,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void initAtlasTest(void) { dev.cheatNoEnemies = 1; + dev.cheatKeys = 1; + dev.cheatPower = 1; initGame(); initHub(); - loadWorld("data/maps/beachFront1.json"); + loadWorld("data/maps/beachFront2.json"); initWorld(); diff --git a/src/world/radar.c b/src/world/radar.c new file mode 100644 index 0000000..04570d7 --- /dev/null +++ b/src/world/radar.c @@ -0,0 +1,66 @@ +#define RADAR_TILE_SIZE 32 +#define OFFSET_X ((SCREEN_WIDTH - (RADAR_TILE_SIZE * RADAR_TILE_SIZE)) / 2) +#define OFFSET_Y ((SCREEN_HEIGHT - (RADAR_TILE_SIZE * RADAR_TILE_SIZE)) / 2) + +static void logic(void); +static void draw(void); +static void drawMap(void); + +static SDL_Rect viewRect; + +void initRadar(void) +{ + app.delegate.logic = logic; + app.delegate.logic = draw; + + viewRect.x = (world.bob->x / MAP_TILE_SIZE) - (RADAR_TILE_SIZE / 2); + viewRect.y = (world.bob->y / MAP_TILE_SIZE) - (RADAR_TILE_SIZE / 2); + viewRect.w = RADAR_TILE_SIZE; + viewRect.h = RADAR_TILE_SIZE; +} + +static void logic(void) +{ + +} + +static void draw(void) +{ + drawMap(); +} + +static void drawMap(void) +{ + int x, y, mx, my; + + for (x = 0 ; x < viewRect.w ; x++) + { + for (y = 0 ; y < viewRect.h ; y++) + { + mx = viewRect.x + x; + my = viewRect.y + y; + + if (withinMap(mx, my)) + { + drawRect(OFFSET_X + (x * RADAR_TILE_SIZE), OFFSET_Y + (y * RADAR_TILE_SIZE), RADAR_TILE_SIZE - 1, RADAR_TILE_SIZE - 1, 0, 200, 0, 255); + } + } + } +} + +static void drawEntities(void) +{ + Entity *e; + Entity **candidates; + int i, x, y; + + candidates = getAllEntsWithin(viewRect.x * MAP_TILE_SIZE, viewRect.y * MAP_TILE_SIZE, viewRect.w * MAP_TILE_SIZE, viewRect.h * MAP_TILE_SIZE, NULL); + + for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i]) + { + x = viewRect.x + (e->x / RADAR_TILE_SIZE); + y = viewRect.y + (e->y / RADAR_TILE_SIZE); + + drawRect(OFFSET_X + (x * RADAR_TILE_SIZE), OFFSET_Y + (y * RADAR_TILE_SIZE), RADAR_TILE_SIZE - 1, RADAR_TILE_SIZE - 1, 200, 0, 0, 255); + } +} diff --git a/src/world/world.c b/src/world/world.c index 5de858a..8befdaf 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -88,8 +88,9 @@ void initWorld(void) app.delegate.logic = logic; app.delegate.draw = draw; - world.bob->x = 166 * MAP_TILE_SIZE; - world.bob->y = 103 * MAP_TILE_SIZE; + startMission(); + world.bob->x = 140 * MAP_TILE_SIZE; + world.bob->y = 106 * MAP_TILE_SIZE; } static void logic(void) @@ -436,6 +437,7 @@ static void spawnEnemies(void) world.numToSpawn = 3 + (rand() % 3); world.spawnInterval = 0; } + return; }