This commit is contained in:
2026-09-24 15:30:45 -03:00
commit a5af824c91
306 changed files with 58603 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
#include "Server.h"
#include <entities/Act9Wall.h>
bool act9wall_init(Server* server, Entity* entity)
{
Act9Wall* wall = (Act9Wall*)entity;
wall->start_time = 0.0;
wall->init_elapsed = server->game.elapsed;
wall->shrink_started = false;
return true;
}
bool act9wall_tick(Server* server, Entity* entity)
{
Act9Wall* wall = (Act9Wall*)entity;
if (!server->game.started)
return true;
double time = (server->game.time_sec * TICKSPERSEC + server->game.time);
if (!wall->shrink_started)
{
if (server->game.elapsed - wall->init_elapsed < 5.0 * TICKSPERSEC ||
time > 150.0 * TICKSPERSEC)
return true;
wall->start_time = time;
wall->shrink_started = true;
}
if (wall->start_time <= 0.0)
return true;
double off = (double)(wall->start_time - time) / (double)wall->start_time;
double x = wall->pos.x * off;
double y = wall->pos.y * off;
Packet pack;
PacketCreate(&pack, SERVER_ACT9WALL_STATE);
PacketWrite(&pack, packet_write8, wall->wid);
PacketWrite(&pack, packet_write16, (uint16_t)x);
PacketWrite(&pack, packet_write16, (uint16_t)y);
server_broadcast(server, &pack, false);
switch(wall->wid)
{
case 0:
{
x = -2240;
y = y - 768;
break;
}
case 1:
{
x = x - 2240;
break;
}
case 2:
{
x = (3072 - x) + 64;
break;
}
default:
{
Err("Invalid wall id!");
return false;
}
}
return true;
}