Skip to content

Commit

Permalink
Biggest update in a decade, removed homework from assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Matqyou committed Dec 5, 2024
1 parent feb8ea5 commit add21c8
Show file tree
Hide file tree
Showing 13 changed files with 506 additions and 681 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 4 additions & 2 deletions src/client/Decals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ Decals::Decals(SDL_Renderer* renderer): m_InvalidTexture(nullptr)

// Load the texture
SDL_Surface* TempSurface = IMG_Load(file_path.string().c_str());
if (!TempSurface)
throw std::runtime_error(FString("Failed to load texture '%s'\n", file_path.string().c_str()));
if (!TempSurface) {
std::cout << FString("Failed to load texture '%s'", file_path.string().c_str()) << std::endl;
continue;
}

SDL_Texture* NewSDLTexture = SDL_CreateTextureFromSurface(renderer, TempSurface);
SDL_FreeSurface(TempSurface);
Expand Down
4 changes: 3 additions & 1 deletion src/game/GameWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@ void GameWorld::TickDestroy()

void GameWorld::Tick()
{
// todo: remove m_paused for real
if (m_Paused || m_GameOver)
return;

if (!m_ShowNames)
m_ShowNamesVisibility *= 0.98;

Expand Down
1 change: 1 addition & 0 deletions src/game/GameWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class GameWorld {
[[nodiscard]] Player *FirstPlayer() const { return m_FirstPlayer; }
[[nodiscard]] Character* FirstCharacter() const { return (Character*)(FirstEntityType(CHARACTER_ENTITY)); }
[[nodiscard]] Crate* FirstCrate() const { return (Crate*)(FirstEntityType(CRATE_ENTITY)); }
[[nodiscard]] bool GetDelay() const { return m_LevelUpDelay; }
// void GetPointInWorld(double relative_x, double relative_y, double& out_x, double& out_y) const;

// Setting
Expand Down
4 changes: 3 additions & 1 deletion src/game/entities/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ Entity::Entity(GameWorld* world,
m_pLastUnknownCore(form_factor == DIRECTIONAL_ENTITY ? new DirectionalEntityCore() : new EntityCore()),
m_Core(*m_pUnknownCore),
m_LastCore(*m_pLastUnknownCore),
m_HasHealthComponent(has_health_component), m_HealthComponent(*this, max_health) {
m_HasHealthComponent(has_health_component),
m_HealthComponent(*this, max_health) {
m_World = world;

m_PrevType = nullptr;
m_NextType = nullptr;
m_Prev = nullptr;
Expand Down
10 changes: 5 additions & 5 deletions src/game/entities/Projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ void Projectile::TickCollision() {
if (!Entity->HasHealthComponent()) continue;

// Ignore npc friendly fire for now
// if (HasHealthComponent->GetType() == CHARACTER) {
// auto ShootableCharacter = (Character*)HasHealthComponent;
// if (ShooterIsCharacter && ShooterCharacter->IsNPC() == ShootableCharacter->IsNPC())
// continue;
// }
if (Entity->GetType() == CHARACTER_ENTITY) {
auto ShootableCharacter = (Character*)Entity;
if (ShooterIsCharacter && ShooterCharacter->IsNPC() == ShootableCharacter->IsNPC())
continue;
}

// Check for (Projectile <-> Entity) collision at the position
bool Collides = Entity->PointCollides(m_Core.Pos);
Expand Down
Loading

0 comments on commit add21c8

Please sign in to comment.