Compare commits
No commits in common. "0c52718695ad368ceb6f051b167411926444cf55" and "f6c5fa10fd0326ae4ef102c13b14af6108fa5240" have entirely different histories.
0c52718695
...
f6c5fa10fd
|
@ -115,14 +115,15 @@ static void level_scene_render_func(Scene_t* scene)
|
|||
|
||||
if (
|
||||
bot <= tilemap.n_tiles
|
||||
&& tilemap.tiles[bot].water_level < MAX_WATER_LEVEL
|
||||
&& tilemap.tiles[i].water_level == 0
|
||||
)
|
||||
{
|
||||
if (i % tilemap.width != 0 && tilemap.tiles[left].wet && (tilemap.tiles[bot].solid == SOLID || tilemap.tiles[bot-1].solid == SOLID))
|
||||
if (i % tilemap.width != 0 && tilemap.tiles[left].wet)
|
||||
{
|
||||
DrawLineEx((Vector2){x, bot_line}, (Vector2){x + TILE_SIZE / 2, bot_line}, SURFACE_THICKNESS, ColorAlpha(BLUE, 0.7));
|
||||
}
|
||||
if (right % tilemap.width != 0 && tilemap.tiles[right].wet && (tilemap.tiles[bot].solid == SOLID || tilemap.tiles[bot+1].solid == SOLID))
|
||||
if (right % tilemap.width != 0 && tilemap.tiles[right].wet)
|
||||
{
|
||||
DrawLineEx((Vector2){x + TILE_SIZE / 2, bot_line}, (Vector2){x + TILE_SIZE, bot_line}, SURFACE_THICKNESS, ColorAlpha(BLUE, 0.7));
|
||||
}
|
||||
|
@ -561,8 +562,7 @@ static void toggle_block_system(Scene_t* scene)
|
|||
new_type = tilemap.tiles[tile_idx].tile_type;
|
||||
if (tilemap.tiles[tile_idx].water_level < MAX_WATER_LEVEL)
|
||||
{
|
||||
tilemap.tiles[tile_idx].water_level = MAX_WATER_LEVEL;
|
||||
tilemap.tiles[tile_idx].wet = false;
|
||||
tilemap.tiles[tile_idx].water_level++;
|
||||
}
|
||||
break;
|
||||
case TOGGLE_AIR_POCKET:
|
||||
|
|
|
@ -48,7 +48,6 @@ typedef struct _CTransform_t {
|
|||
Vector2 velocity;
|
||||
Vector2 accel;
|
||||
Vector2 fric_coeff;
|
||||
Vector2 shape_factor;
|
||||
int8_t grav_delay;
|
||||
int8_t grav_timer;
|
||||
MovementMode_t movement_mode;
|
||||
|
|
|
@ -896,7 +896,7 @@ void global_external_forces_system(Scene_t* scene)
|
|||
|
||||
if (point_in_AABB(player_center, box))
|
||||
{
|
||||
p_ctransform->accel = Vector2Multiply(Vector2Add(p_ctransform->accel, UPTHRUST), p_ctransform->shape_factor);
|
||||
p_ctransform->accel = Vector2Add(p_ctransform->accel, UPTHRUST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -906,10 +906,7 @@ void global_external_forces_system(Scene_t* scene)
|
|||
// Friction
|
||||
p_ctransform->accel = Vector2Add(
|
||||
p_ctransform->accel,
|
||||
Vector2Multiply(
|
||||
Vector2Multiply(p_ctransform->fric_coeff, p_ctransform->velocity),
|
||||
p_ctransform->shape_factor
|
||||
)
|
||||
Vector2Multiply(p_ctransform->fric_coeff, p_ctransform->velocity)
|
||||
);
|
||||
|
||||
if (p_bbox == NULL) continue; //Do not proceed if no bbox
|
||||
|
@ -1028,19 +1025,13 @@ void moveable_update_system(Scene_t* scene)
|
|||
{
|
||||
Entity_t* other_ent = get_entity(&scene->ent_manager, idx_to_check);
|
||||
CBBox_t* p_other_bbox = get_component(other_ent, CBBOX_COMP_T);
|
||||
if (p_other_bbox != NULL)
|
||||
{
|
||||
any_solid |= p_other_bbox->solid;
|
||||
}
|
||||
any_solid |= p_other_bbox->solid;
|
||||
}
|
||||
sc_map_foreach_key(&tilemap.tiles[tile_idx2].entities_set, idx_to_check)
|
||||
{
|
||||
Entity_t* other_ent = get_entity(&scene->ent_manager, idx_to_check);
|
||||
CBBox_t* p_other_bbox = get_component(other_ent, CBBOX_COMP_T);
|
||||
if (p_other_bbox != NULL)
|
||||
{
|
||||
any_solid |= p_other_bbox->solid;
|
||||
}
|
||||
any_solid |= p_other_bbox->solid;
|
||||
}
|
||||
if (!any_solid)
|
||||
{
|
||||
|
@ -1063,19 +1054,13 @@ void moveable_update_system(Scene_t* scene)
|
|||
{
|
||||
Entity_t* other_ent = get_entity(&scene->ent_manager, idx_to_check);
|
||||
CBBox_t* p_other_bbox = get_component(other_ent, CBBOX_COMP_T);
|
||||
if (p_other_bbox != NULL)
|
||||
{
|
||||
any_solid |= p_other_bbox->solid;
|
||||
}
|
||||
any_solid |= p_other_bbox->solid;
|
||||
}
|
||||
sc_map_foreach_key(&tilemap.tiles[tile_idx2].entities_set, idx_to_check)
|
||||
{
|
||||
Entity_t* other_ent = get_entity(&scene->ent_manager, idx_to_check);
|
||||
CBBox_t* p_other_bbox = get_component(other_ent, CBBOX_COMP_T);
|
||||
if (p_other_bbox != NULL)
|
||||
{
|
||||
any_solid |= p_other_bbox->solid;
|
||||
}
|
||||
any_solid |= p_other_bbox->solid;
|
||||
}
|
||||
if (!any_solid)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,6 @@ Entity_t* create_crate(EntityManager_t* ent_manager, Assets_t* assets, bool meta
|
|||
|
||||
CTransform_t* p_ctransform = add_component(p_crate, CTRANSFORM_COMP_T);
|
||||
p_ctransform->grav_delay = 5;
|
||||
p_ctransform->shape_factor = metal ? (Vector2){0.7,0.7} : (Vector2){0.8,0.8} ;
|
||||
add_component(p_crate, CMOVEMENTSTATE_T);
|
||||
add_component(p_crate, CTILECOORD_COMP_T);
|
||||
CHurtbox_t* p_hurtbox = add_component(p_crate, CHURTBOX_T);
|
||||
|
@ -42,7 +41,6 @@ Entity_t* create_boulder(EntityManager_t* ent_manager, Assets_t* assets)
|
|||
CTransform_t* p_ctransform = add_component(p_boulder, CTRANSFORM_COMP_T);
|
||||
p_ctransform->grav_delay = 5;
|
||||
p_ctransform->active = true;
|
||||
p_ctransform->shape_factor = (Vector2){0.6, 0.6};
|
||||
add_component(p_boulder, CMOVEMENTSTATE_T);
|
||||
add_component(p_boulder, CTILECOORD_COMP_T);
|
||||
CMoveable_t* p_cmove = add_component(p_boulder, CMOVEABLE_T);
|
||||
|
@ -109,7 +107,6 @@ Entity_t* create_bomb(EntityManager_t* ent_manager, Assets_t* assets, Vector2 la
|
|||
|
||||
CTransform_t* p_ctransform = add_component(p_bomb, CTRANSFORM_COMP_T);
|
||||
p_ctransform->active = true;
|
||||
p_ctransform->shape_factor = (Vector2){0.1, 0.1};
|
||||
p_ctransform->movement_mode = REGULAR_MOVEMENT;
|
||||
p_ctransform->position.x += (TILE_SIZE - 25) / 2;
|
||||
p_ctransform->position.y += (TILE_SIZE - 25) / 2;
|
||||
|
|
|
@ -61,7 +61,6 @@ Entity_t* create_player(EntityManager_t* ent_manager, Assets_t* assets)
|
|||
set_bbox(p_bbox, PLAYER_WIDTH, PLAYER_HEIGHT);
|
||||
CTransform_t* p_ct = add_component(p_ent, CTRANSFORM_COMP_T);
|
||||
p_ct->active = true;
|
||||
p_ct->shape_factor = (Vector2){1, 1};
|
||||
|
||||
CJump_t* p_cjump = add_component(p_ent, CJUMP_COMP_T);
|
||||
p_cjump->jump_speed = 680;
|
||||
|
|
|
@ -40,9 +40,7 @@ void free_water_runner(Entity_t* ent, EntityManager_t* ent_manager)
|
|||
{
|
||||
CWaterRunner_t* p_crunner = get_component(ent, CWATERRUNNER_T);
|
||||
free(p_crunner->bfs_tilemap.tilemap);
|
||||
p_crunner->bfs_tilemap.tilemap = NULL;
|
||||
free(p_crunner->visited);
|
||||
p_crunner->visited = NULL;
|
||||
sc_queue_term(&p_crunner->bfs_queue);
|
||||
remove_entity(ent_manager, ent->m_id);
|
||||
}
|
||||
|
@ -295,10 +293,6 @@ void update_water_runner_system(Scene_t* scene)
|
|||
{
|
||||
p_crunner->counter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
curr_tile->wet = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue