Skip to content

Commit

Permalink
Merge pull request #809 from TurningWheel/develop
Browse files Browse the repository at this point in the history
merge 4.1.0 (develop) to master
  • Loading branch information
SheridanR authored Oct 20, 2023
2 parents 388583b + 98d0d98 commit e8ca683
Show file tree
Hide file tree
Showing 85 changed files with 14,045 additions and 7,521 deletions.
3,655 changes: 1,069 additions & 2,586 deletions lang/en.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lang/item_names.json
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,9 @@
},
"spell_crab_web": {
"name": "Spray Web"
},
"spell_ghost_bolt": {
"name": "Ghostbolt"
}
}
}
1 change: 1 addition & 0 deletions src/actarrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ void actArrow(Entity* my)

bool arrowInGround = false;
int index = (int)(my->y / 16) * MAPLAYERS + (int)(my->x / 16) * MAPLAYERS * map.height;
index = std::clamp(index, 0, (int)(MAPLAYERS * map.width * map.height) - 1);
if ( map.tiles[index] )
{
if ( my->sprite == PROJECTILE_BOLT_SPRITE || my->sprite == PROJECTILE_ROCK_SPRITE ) // bolt/rock
Expand Down
4 changes: 2 additions & 2 deletions src/actbeartrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,12 +629,12 @@ void bombDoEffect(Entity* my, Entity* triggered, real_t entityDistance, bool spa
if ( !strcmp(stat->name, "") )
{
updateEnemyBar(parent, triggered, getMonsterLocalizedName(stat->type).c_str(), stat->HP, stat->MAXHP,
false, DamageGib::DMG_TODO);
false, DamageGib::DMG_DEFAULT);
}
else
{
updateEnemyBar(parent, triggered, stat->name, stat->HP, stat->MAXHP,
false, DamageGib::DMG_TODO);
false, DamageGib::DMG_DEFAULT);
}
Entity* gib = spawnGib(triggered);
serverSpawnGibForClient(gib);
Expand Down
12 changes: 12 additions & 0 deletions src/actboulder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,15 +1296,27 @@ void actBoulder(Entity* my)

#define BOULDERTRAP_FIRED my->skill[0]
#define BOULDERTRAP_AMBIENCE my->skill[6]
#define BOULDERTRAPHOLE_INIT my->skill[0]

void actBoulderTrapHole(Entity* my)
{
if ( multiplayer == CLIENT )
{
if ( !BOULDERTRAPHOLE_INIT )
{
BOULDERTRAPHOLE_INIT = 1;
my->createWorldUITooltip();
}
return;
}
if ( !my ) { return; }

if ( !BOULDERTRAPHOLE_INIT )
{
BOULDERTRAPHOLE_INIT = 1;
my->createWorldUITooltip();
}

if ( my->z > -11.0 && my->z < -10 )
{
// in ceiling, delete self if ceiling no longer exists
Expand Down
10 changes: 6 additions & 4 deletions src/actdoor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,21 +137,22 @@ void actDoor(Entity* my)
{
if ( selectedEntity[i] == my || client_selected[i] == my )
{
if ( players[i]->entity && inrange[i])
if ( Player::getPlayerInteractEntity(i) && inrange[i])
{
Entity* playerEntity = Player::getPlayerInteractEntity(i);
if ( !my->doorLocked ) // door unlocked
{
if ( !my->doorDir && !my->doorStatus )
{
// open door
my->doorStatus = 1 + (players[i]->entity->x > my->x);
my->doorStatus = 1 + (playerEntity->x > my->x);
playSoundEntity(my, 21, 96);
messagePlayer(i, MESSAGE_INTERACTION, Language::get(464));
}
else if ( my->doorDir && !my->doorStatus )
{
// open door
my->doorStatus = 1 + (players[i]->entity->y < my->y);
my->doorStatus = 1 + (playerEntity->y < my->y);
playSoundEntity(my, 21, 96);
messagePlayer(i, MESSAGE_INTERACTION, Language::get(464));
}
Expand Down Expand Up @@ -239,7 +240,8 @@ void actDoor(Entity* my)
for ( node = currentList->first; node != nullptr; node = node->next )
{
Entity* entity = (Entity*)node->element;
if ( entity == my || entity->flags[PASSABLE] || entity->behavior == &actDoorFrame )
if ( entity == my || (entity->flags[PASSABLE] && entity->behavior != &actDeathGhost)
|| entity->behavior == &actDoorFrame )
{
continue;
}
Expand Down
3 changes: 2 additions & 1 deletion src/actgate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ void Entity::actGate()
for ( node = currentList->first; node != nullptr; node = node->next )
{
Entity* entity = (Entity*)node->element;
if ( entity == this || entity->flags[PASSABLE] || entity->behavior == &actDoorFrame )
if ( entity == this || (entity->flags[PASSABLE] && entity->behavior != &actDeathGhost)
|| entity->behavior == &actDoorFrame )
{
continue;
}
Expand Down
5 changes: 5 additions & 0 deletions src/actgeneral.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,11 @@ void actColliderDecoration(Entity* my)

if ( my->isDamageableCollider() )
{
if ( my->ticks == 1 )
{
my->createWorldUITooltip();
}

auto& colliderData = EditorEntityData_t::colliderData[my->colliderDamageTypes];
if ( my->flags[BURNING] && my->flags[BURNABLE] )
{
Expand Down
145 changes: 97 additions & 48 deletions src/actitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void actItem(Entity* my)
net_packet->len = 9;
sendPacketSafe(net_sock, -1, net_packet, 0);
}
else if ( my->skill[10] == 0 && my->itemReceivedDetailsFromServer == 0 && players[clientnum] && players[clientnum]->entity )
else if ( my->skill[10] == 0 && my->itemReceivedDetailsFromServer == 0 && players[clientnum] )
{
// request itemtype and beatitude
if ( ticks % (TICKS_PER_SECOND * 6) == my->getUID() % (TICKS_PER_SECOND * 6) )
Expand Down Expand Up @@ -265,7 +265,39 @@ void actItem(Entity* my)
{
if ( selectedEntity[i] == my || client_selected[i] == my )
{
if ( inrange[i] && players[i] && players[i]->entity )
if ( inrange[i] && players[i] && players[i]->ghost.isActive() )
{
my->vel_x += 1.0 * cos(players[i]->ghost.my->yaw);
my->vel_y += 1.0 * sin(players[i]->ghost.my->yaw);
my->z = std::max(my->z - 0.1, 0.0);
my->vel_z = 2 * (-10 - local_rng.rand() % 20) * .01;
my->itemNotMoving = 0;
my->itemNotMovingClient = 0;
my->flags[USERFLAG1] = false; // enable collision
if ( multiplayer == SERVER )
{
for ( int c = 1; c < MAXPLAYERS; c++ )
{
if ( client_disconnected[c] || players[c]->isLocalPlayer() )
{
continue;
}
strcpy((char*)net_packet->data, "GHOI");
SDLNet_Write32(my->getUID(), &net_packet->data[4]);
SDLNet_Write16((Sint16)(my->x * 32), &net_packet->data[8]);
SDLNet_Write16((Sint16)(my->y * 32), &net_packet->data[10]);
SDLNet_Write16((Sint16)(my->z * 32), &net_packet->data[12]);
SDLNet_Write16((Sint16)(my->vel_x * 32), &net_packet->data[14]);
SDLNet_Write16((Sint16)(my->vel_y * 32), &net_packet->data[16]);
SDLNet_Write16((Sint16)(my->vel_z * 32), &net_packet->data[18]);
net_packet->address.host = net_clients[c - 1].host;
net_packet->address.port = net_clients[c - 1].port;
net_packet->len = 20;
sendPacketSafe(net_sock, -1, net_packet, c - 1);
}
}
}
else if ( inrange[i] && players[i] && players[i]->entity )
{
bool trySalvage = false;
if ( static_cast<Uint32>(my->itemAutoSalvageByPlayer) == players[i]->entity->getUID() )
Expand Down Expand Up @@ -365,68 +397,83 @@ void actItem(Entity* my)
}
}

my->removeLightField();
switch ( my->sprite )
{
case 610: // orbs (blue)
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "orb_blue");
}
break;
case 611: // red
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "orb_red");
}
break;
case 612: // purple
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "orb_purple");
}
break;
case 613: // green
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "orb_green");
}
break;
case 1206: // loot bags (yellow)
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_yellow");
}
break;
case 1207: // green
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_green");
}
break;
case 1208: // red
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_red");
}
break;
case 1209: // pink
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_pink");
}
break;
case 1210: // white
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_white");
}
break;
default:
break;
}

if ( my->itemNotMoving )
{
switch ( my->sprite )
{
case 610: // orbs (blue)
my->spawnAmbientParticles(80, my->sprite - 4, 10 + local_rng.rand() % 40, 1.0, false);
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "orb_blue");
}
break;
case 611: // red
my->spawnAmbientParticles(80, my->sprite - 4, 10 + local_rng.rand() % 40, 1.0, false);
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "orb_red");
}
break;
case 612: // purple
my->spawnAmbientParticles(80, my->sprite - 4, 10 + local_rng.rand() % 40, 1.0, false);
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "orb_purple");
}
break;
case 613: // green
my->spawnAmbientParticles(80, my->sprite - 4, 10 + local_rng.rand() % 40, 1.0, false);
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "orb_green");
}
break;
case 1206: // loot bags (yellow)
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_yellow");
}
break;
case 1207: // green
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_green");
}
break;
case 1208: // red
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_red");
}
break;
case 1209: // pink
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_pink");
}
break;
case 1210: // white
if ( !my->light )
{
my->light = addLight(my->x / 16, my->y / 16, "lootbag_white");
}
break;
default:
break;
}
Expand Down Expand Up @@ -482,6 +529,8 @@ void actItem(Entity* my)
}
}

my->flags[BURNING] = false;

if ( my->z < groundheight )
{
// fall
Expand Down
4 changes: 2 additions & 2 deletions src/actmagictrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void Entity::actTeleportShrine()
{
if ( selectedEntity[i] == this || client_selected[i] == this )
{
if ( inrange[i] && players[i]->entity )
if ( inrange[i] && Player::getPlayerInteractEntity(i) )
{
if ( shrineActivateDelay > 0 )
{
Expand Down Expand Up @@ -438,7 +438,7 @@ void Entity::actTeleportShrine()
spellTimer->particleTimerCountdownSprite = 625;
spellTimer->particleTimerTarget = static_cast<Sint32>(selectedShrine->getUID()); // get the target to teleport around.
spellTimer->particleTimerVariable1 = 1; // distance of teleport in tiles
spellTimer->particleTimerVariable2 = players[i]->entity->getUID(); // which player to teleport
spellTimer->particleTimerVariable2 = Player::getPlayerInteractEntity(i)->getUID(); // which player to teleport
if ( multiplayer == SERVER )
{
serverSpawnMiscParticles(this, PARTICLE_EFFECT_SHRINE_TELEPORT, 625);
Expand Down
24 changes: 22 additions & 2 deletions src/actmonster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6918,12 +6918,32 @@ void actMonster(Entity* my)
{
if ( myStats->type == LICH_FIRE )
{
playSoundPlayer(c, 376, 128);
if ( multiplayer == SINGLE )
{
if ( c == clientnum )
{
playSoundPlayer(c, 376, 128); // only play sfx once in splitscreen
}
}
else
{
playSoundPlayer(c, 376, 128);
}
messagePlayerColor(c, MESSAGE_WORLD, uint32ColorOrange, Language::get(2646));
}
else if ( myStats->type == LICH_ICE )
{
playSoundPlayer(c, 381, 128);
if ( multiplayer == SINGLE )
{
if ( c == clientnum )
{
playSoundPlayer(c, 381, 128); // only play sfx once in splitscreen
}
}
else
{
playSoundPlayer(c, 381, 128);
}
messagePlayerColor(c, MESSAGE_WORLD, uint32ColorBaronyBlue, Language::get(2648));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/actpedestal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ void Entity::actPedestalBase()
for ( node2 = map.entities->first; node2 != nullptr; node2 = node2->next )
{
Entity* entity = (Entity*)node2->element;
if ( entity == this || entity->flags[PASSABLE]
if ( entity == this || (entity->flags[PASSABLE] && entity->behavior != &actDeathGhost)
|| entity->behavior == &actDoorFrame || entity == orbEntity )
{
continue;
Expand Down
Loading

0 comments on commit e8ca683

Please sign in to comment.