Merge remote-tracking branch 'origin'
This commit is contained in:
@@ -2,11 +2,9 @@
|
||||
#include "game/bandit.h"
|
||||
|
||||
void UpdateBandit(F32 delta, Bandit *bandit, World *world) {
|
||||
if(
|
||||
world->player.controls.shot
|
||||
&& AABB_Point(bandit->collision, world->player.shotPos)
|
||||
&& bandit->currentArea == world->player.currentArea
|
||||
) {
|
||||
if (
|
||||
world->player.controls.shot && AABB_Slab(world->player.pos, world->player.shotPos, bandit->collision) && bandit->currentArea == world->player.currentArea)
|
||||
{
|
||||
printf("You shot the bandit %*.s\n", Sv(bandit->name));
|
||||
bandit->health--;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL_oldnames.h>
|
||||
#include "../map.h"
|
||||
|
||||
void UpdateWorld(F32 delta, World *world)
|
||||
{
|
||||
@@ -19,11 +20,9 @@ void UpdateNPCs(F32 delta, World *world)
|
||||
{
|
||||
NPC *npc = &world->npcs[i];
|
||||
UpdateNPC(delta, npc, world);
|
||||
if(
|
||||
world->player.controls.shot
|
||||
&& AABB_Point(npc->collision, world->player.shotPos)
|
||||
&& npc->currentArea == world->player.currentArea
|
||||
) {
|
||||
if (
|
||||
world->player.controls.shot && AABB_Slab(world->player.pos, world->player.shotPos, npc->collision) && npc->currentArea == world->player.currentArea)
|
||||
{
|
||||
printf("You shot %*.s\n", Sv(world->npcs[i].name));
|
||||
}
|
||||
}
|
||||
@@ -38,6 +37,11 @@ void ProcessEvents(SDL_Event *event, World *world)
|
||||
}
|
||||
|
||||
void RenderWorld(World *world, D_Context *draw) {
|
||||
World_Tile tileTypes[] = {dirt, middlePath, middlePathEdgeTop, middlePathEdgeRight, middlePathEdgeBottom, middlePathEdgeLeft, middlePathCornerTopLeft, middlePathCornerTopRight, middlePathCornerBottomRight, middlePathCornerTurnBottomLeft};
|
||||
for (int i = 0; i < 4800; i++)
|
||||
{
|
||||
D_Rect(draw, (F32) (i % 96), (F32) (i / 96), .texture = tileTypes[map[i]].tile, .angle = (F32) tileTypes[map[i]].rotation);
|
||||
}
|
||||
for(U32 i = 0; i < world->npcCount; i++) {
|
||||
NPC npc = world->npcs[i];
|
||||
if(npc.currentArea == world->player.currentArea) {
|
||||
@@ -59,15 +63,17 @@ void G_WorldDraw(G_State *game, World *world) {
|
||||
|
||||
(void) world;
|
||||
|
||||
for (F32 y = -128; y < 128; y += 1.1f) {
|
||||
for (F32 x = -128; x < 128; x += 1.1f) {
|
||||
U32 id = D_ImageHandle(&game->draw, S("tile_dirt_0"));
|
||||
U32 alt_id = D_ImageHandle(&game->draw, S("tile_dirt_1"));
|
||||
|
||||
for (F32 y = -128; y < 128; y += 1.0f) {
|
||||
for (F32 x = -128; x < 128; x += 1.0f) {
|
||||
U32 ux = (U32) x;
|
||||
U32 uy = (U32) y;
|
||||
|
||||
U32 tid = 15;
|
||||
U32 tid = id;
|
||||
if ((ux % 11) == 0 || ((uy % 7) == 0)) {
|
||||
tid = 16;
|
||||
tid = alt_id;
|
||||
}
|
||||
|
||||
D_Rect(draw, x, y, .texture = tid);
|
||||
|
||||
Reference in New Issue
Block a user