ecs: fix demo npc wake

isolation_bkp/dynres
Dominik Madarász 2022-08-08 13:19:12 +02:00
parent 16001c24b9
commit 68b57468a4
5 changed files with 64 additions and 63 deletions

View File

@ -8,7 +8,6 @@ float zpl_lerp(float,float,float);
float zpl_to_degrees(float);
void DEBUG_draw_ground(uint64_t key, entity_view * data) {
(void)key;
switch (data->kind) {
case EKIND_CHUNK: {
world_view *view = game_world_view_get_active();

View File

@ -106,7 +106,7 @@ void blocks_build_chunk_tex(uint64_t id, block_id *chunk_blocks, void *raw_view)
float rot = rots[(int32_t)(perlin_fbm(view->seed, x, y, 1.2f, 3) * 4.0f) % 4];
float half_block = blk_dims / 2.0f;
Texture2D blk = *(Texture2D*)blocks_get_img(chunk_blocks[(y*view->chunk_size)+x]);
Rectangle src = {0, 0, WORLD_BLOCK_SIZE, WORLD_BLOCK_SIZE};
static Rectangle src = {0, 0, WORLD_BLOCK_SIZE, WORLD_BLOCK_SIZE};
Rectangle dst = {x*blk_dims + half_block, y*blk_dims + half_block, blk_dims, blk_dims};
DrawTexturePro(blk, src, dst, (Vector2){half_block, half_block}, rot, WHITE);
}

View File

@ -10,5 +10,7 @@ void DemoNPCMoveAround(ecs_iter_t *it) {
float d = zpl_quake_rsqrt(v[i].x*v[i].x + v[i].y*v[i].y);
v[i].x += (v[i].x*d*DEMO_NPC_MOVE_SPEED*safe_dt(it) + zpl_cos(zpl_to_radians((float)(rand()%360)))*DEMO_NPC_STEER_SPEED*safe_dt(it));
v[i].y += (v[i].y*d*DEMO_NPC_MOVE_SPEED*safe_dt(it) + zpl_sin(zpl_to_radians((float)(rand()%360)))*DEMO_NPC_STEER_SPEED*safe_dt(it));
entity_wake(it->entities[i]);
}
}