51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "grid_entity.h"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// A rock standing, broken, primed to blow (a bomb rock hit by an explosion) and cracked (a super secret rock).
|
|
enum RockState : int
|
|
{
|
|
ROCK_STATE_NONE,
|
|
ROCK_STATE_STANDING,
|
|
ROCK_STATE_BROKEN,
|
|
ROCK_STATE_PRIMED,
|
|
ROCK_STATE_CRACKED
|
|
};
|
|
|
|
// Destruction (0070b950) is the default. The rubble animation's getter (005cd820) is the public field. A rock of any
|
|
// kind (Lua's GridEntityRock):
|
|
// plain, tinted, bomb, super secret, spiked, gold, metal blocks and pillars. A big rock spans four cells. Broken, it
|
|
// leaves rubble and its drops.
|
|
struct GridEntity_Rock : GridEntity
|
|
{
|
|
std::string anim;
|
|
std::string rubbleAnim;
|
|
std::vector<Vector> rubbleOffsets;
|
|
int fuseFrames = 0;
|
|
int previousState = 0;
|
|
|
|
void subclass_init() override;
|
|
void PostInit() override;
|
|
void Update() override;
|
|
void Render(const Vector& offset) override;
|
|
bool Destroy(bool isImmediate, const EntityRef& source) override;
|
|
WaterClipInfo GetWaterClipInfo() override;
|
|
|
|
void update_collision();
|
|
void RenderTop(const Vector& position);
|
|
void SetBigRockFrame(int frame);
|
|
int GetBigRockFrame();
|
|
void UpdateAnimFrame();
|
|
void UpdateNeighbors();
|
|
static void RegisterRockDestroyed(GridEntityType type);
|
|
void TrySpawnWorms();
|
|
static void PlayBreakSound(GridEntityType type, int backdropType);
|
|
bool TrySpawnLadder();
|
|
static void SpawnDrops(const Vector& position, GridEntityType type, int variant, uint32_t seed, int backdropType,
|
|
Entity* source);
|
|
};
|
|
|
|
void grid_mark_neighbors_dirty(int gridIndex);
|