Curation round 13: grid entities, more enemies, Caves, boss helpers and five bosses, chests and costumes, curses and alt stages, the Lua API
This commit is contained in:
1 parent
f8ce24fc6c
commit
8ae02a8422
160 files changed
+16231
-1689
No files matched your search
+47
-5
@@ -1,16 +1,58 @@
|
||||
#include "grid_entity_web.h"
|
||||
#include "log.h"
|
||||
#include "entity_player.h"
|
||||
#include "game.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
// 00721540 Loads the web.
|
||||
// How often a web slows the players in it, how near they must be, and how much and how long it slows them, tinted
|
||||
// blue. A web turns in quarter turns.
|
||||
constexpr int WEB_CHECK_FRAMES = 4;
|
||||
constexpr float WEB_REACH = 21;
|
||||
constexpr int WEB_SLOW_FRAMES = 4;
|
||||
constexpr float WEB_SLOW = 0.75f;
|
||||
constexpr ColorMod WEB_SLOW_COLOR = {{1, 1, 1.3f, 1}, {0, 0, 0, 0}, {0.15686275f, 0.15686275f, 0.15686275f}};
|
||||
constexpr uint32_t WEB_TURNS = 3;
|
||||
constexpr float WEB_TURN_DEGREES = 90;
|
||||
|
||||
// 00721540 Loads the web, burnt on its first bombed frame or swaying from a random frame, flipped and turned at
|
||||
// random.
|
||||
void GridEntity_Web::subclass_init()
|
||||
{
|
||||
reconstruction_missing("GridEntity_Web::subclass_init 00721540");
|
||||
collisionClass = COLLISION_NONE;
|
||||
sprite.Load("gfx/grid/grid_web.anm2", GRAPHICS_LOAD);
|
||||
if (state != WEB_STATE_STANDING) return sprite.SetFrame("Bombed", 0);
|
||||
|
||||
sprite.Play("Swaying");
|
||||
const AnimationData* data = sprite.animState.animData;
|
||||
int length = data ? data->length : 0;
|
||||
int frame = length == 0 ? 0 : (int)(Random() % (uint32_t)length);
|
||||
if (sprite.animState.animData)
|
||||
{
|
||||
sprite.animState.SetFrameFloat((float)frame);
|
||||
sprite.animState.isPlaying = false;
|
||||
}
|
||||
sprite.isFlipX = (Random() & 1) == 0;
|
||||
sprite.rotation = (float)(Random() & WEB_TURNS) * WEB_TURN_DEGREES;
|
||||
}
|
||||
|
||||
// 00721780 Slows the entities in the web.
|
||||
// 00721780 Every fourth frame slows the walking players in a standing web (but not with Evil Charm), tinted blue.
|
||||
void GridEntity_Web::Update()
|
||||
{
|
||||
reconstruction_missing("GridEntity_Web::Update 00721780");
|
||||
if (state == WEB_STATE_STANDING && g_game->frameCount % WEB_CHECK_FRAMES == 0)
|
||||
{
|
||||
Vector position = Position();
|
||||
for (Entity_Player* player : g_game->playerManager.playerList)
|
||||
{
|
||||
if (player->entityGridCollisionClass <= GRIDCOLL_WALLS) continue;
|
||||
bool isCharmed = player->HasCollectible(COLLECTIBLE_EVIL_CHARM) ||
|
||||
player->temporaryEffects.HasCollectibleEffect(COLLECTIBLE_EVIL_CHARM);
|
||||
if (isCharmed && type == GRID_SPIDERWEB) continue;
|
||||
|
||||
float reach = std::max(std::abs(player->pos.y - position.y), std::abs(player->pos.x - position.x));
|
||||
if (reach < WEB_REACH) player->AddSlowing(EntityRef(), WEB_SLOW_FRAMES, WEB_SLOW, WEB_SLOW_COLOR, false);
|
||||
}
|
||||
}
|
||||
sprite.Update();
|
||||
}
|
||||
|
||||
// 00721a10 Burns a standing web away, stopped on its first bombed frame.
|
||||
|
||||
Reference in new issue
Block a user