Skip to content

Commit e8ca683

Browse files
authored
Merge pull request #809 from TurningWheel/develop
merge 4.1.0 (develop) to master
2 parents 388583b + 98d0d98 commit e8ca683

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+14045
-7521
lines changed

lang/en.txt

Lines changed: 1069 additions & 2586 deletions
Large diffs are not rendered by default.

lang/item_names.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,6 +1320,9 @@
13201320
},
13211321
"spell_crab_web": {
13221322
"name": "Spray Web"
1323+
},
1324+
"spell_ghost_bolt": {
1325+
"name": "Ghostbolt"
13231326
}
13241327
}
13251328
}

src/actarrow.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ void actArrow(Entity* my)
309309

310310
bool arrowInGround = false;
311311
int index = (int)(my->y / 16) * MAPLAYERS + (int)(my->x / 16) * MAPLAYERS * map.height;
312+
index = std::clamp(index, 0, (int)(MAPLAYERS * map.width * map.height) - 1);
312313
if ( map.tiles[index] )
313314
{
314315
if ( my->sprite == PROJECTILE_BOLT_SPRITE || my->sprite == PROJECTILE_ROCK_SPRITE ) // bolt/rock

src/actbeartrap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,12 +629,12 @@ void bombDoEffect(Entity* my, Entity* triggered, real_t entityDistance, bool spa
629629
if ( !strcmp(stat->name, "") )
630630
{
631631
updateEnemyBar(parent, triggered, getMonsterLocalizedName(stat->type).c_str(), stat->HP, stat->MAXHP,
632-
false, DamageGib::DMG_TODO);
632+
false, DamageGib::DMG_DEFAULT);
633633
}
634634
else
635635
{
636636
updateEnemyBar(parent, triggered, stat->name, stat->HP, stat->MAXHP,
637-
false, DamageGib::DMG_TODO);
637+
false, DamageGib::DMG_DEFAULT);
638638
}
639639
Entity* gib = spawnGib(triggered);
640640
serverSpawnGibForClient(gib);

src/actboulder.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,15 +1296,27 @@ void actBoulder(Entity* my)
12961296

12971297
#define BOULDERTRAP_FIRED my->skill[0]
12981298
#define BOULDERTRAP_AMBIENCE my->skill[6]
1299+
#define BOULDERTRAPHOLE_INIT my->skill[0]
12991300

13001301
void actBoulderTrapHole(Entity* my)
13011302
{
13021303
if ( multiplayer == CLIENT )
13031304
{
1305+
if ( !BOULDERTRAPHOLE_INIT )
1306+
{
1307+
BOULDERTRAPHOLE_INIT = 1;
1308+
my->createWorldUITooltip();
1309+
}
13041310
return;
13051311
}
13061312
if ( !my ) { return; }
13071313

1314+
if ( !BOULDERTRAPHOLE_INIT )
1315+
{
1316+
BOULDERTRAPHOLE_INIT = 1;
1317+
my->createWorldUITooltip();
1318+
}
1319+
13081320
if ( my->z > -11.0 && my->z < -10 )
13091321
{
13101322
// in ceiling, delete self if ceiling no longer exists

src/actdoor.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,21 +137,22 @@ void actDoor(Entity* my)
137137
{
138138
if ( selectedEntity[i] == my || client_selected[i] == my )
139139
{
140-
if ( players[i]->entity && inrange[i])
140+
if ( Player::getPlayerInteractEntity(i) && inrange[i])
141141
{
142+
Entity* playerEntity = Player::getPlayerInteractEntity(i);
142143
if ( !my->doorLocked ) // door unlocked
143144
{
144145
if ( !my->doorDir && !my->doorStatus )
145146
{
146147
// open door
147-
my->doorStatus = 1 + (players[i]->entity->x > my->x);
148+
my->doorStatus = 1 + (playerEntity->x > my->x);
148149
playSoundEntity(my, 21, 96);
149150
messagePlayer(i, MESSAGE_INTERACTION, Language::get(464));
150151
}
151152
else if ( my->doorDir && !my->doorStatus )
152153
{
153154
// open door
154-
my->doorStatus = 1 + (players[i]->entity->y < my->y);
155+
my->doorStatus = 1 + (playerEntity->y < my->y);
155156
playSoundEntity(my, 21, 96);
156157
messagePlayer(i, MESSAGE_INTERACTION, Language::get(464));
157158
}
@@ -239,7 +240,8 @@ void actDoor(Entity* my)
239240
for ( node = currentList->first; node != nullptr; node = node->next )
240241
{
241242
Entity* entity = (Entity*)node->element;
242-
if ( entity == my || entity->flags[PASSABLE] || entity->behavior == &actDoorFrame )
243+
if ( entity == my || (entity->flags[PASSABLE] && entity->behavior != &actDeathGhost)
244+
|| entity->behavior == &actDoorFrame )
243245
{
244246
continue;
245247
}

src/actgate.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ void Entity::actGate()
187187
for ( node = currentList->first; node != nullptr; node = node->next )
188188
{
189189
Entity* entity = (Entity*)node->element;
190-
if ( entity == this || entity->flags[PASSABLE] || entity->behavior == &actDoorFrame )
190+
if ( entity == this || (entity->flags[PASSABLE] && entity->behavior != &actDeathGhost)
191+
|| entity->behavior == &actDoorFrame )
191192
{
192193
continue;
193194
}

src/actgeneral.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,11 @@ void actColliderDecoration(Entity* my)
739739

740740
if ( my->isDamageableCollider() )
741741
{
742+
if ( my->ticks == 1 )
743+
{
744+
my->createWorldUITooltip();
745+
}
746+
742747
auto& colliderData = EditorEntityData_t::colliderData[my->colliderDamageTypes];
743748
if ( my->flags[BURNING] && my->flags[BURNABLE] )
744749
{

src/actitem.cpp

Lines changed: 97 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void actItem(Entity* my)
124124
net_packet->len = 9;
125125
sendPacketSafe(net_sock, -1, net_packet, 0);
126126
}
127-
else if ( my->skill[10] == 0 && my->itemReceivedDetailsFromServer == 0 && players[clientnum] && players[clientnum]->entity )
127+
else if ( my->skill[10] == 0 && my->itemReceivedDetailsFromServer == 0 && players[clientnum] )
128128
{
129129
// request itemtype and beatitude
130130
if ( ticks % (TICKS_PER_SECOND * 6) == my->getUID() % (TICKS_PER_SECOND * 6) )
@@ -265,7 +265,39 @@ void actItem(Entity* my)
265265
{
266266
if ( selectedEntity[i] == my || client_selected[i] == my )
267267
{
268-
if ( inrange[i] && players[i] && players[i]->entity )
268+
if ( inrange[i] && players[i] && players[i]->ghost.isActive() )
269+
{
270+
my->vel_x += 1.0 * cos(players[i]->ghost.my->yaw);
271+
my->vel_y += 1.0 * sin(players[i]->ghost.my->yaw);
272+
my->z = std::max(my->z - 0.1, 0.0);
273+
my->vel_z = 2 * (-10 - local_rng.rand() % 20) * .01;
274+
my->itemNotMoving = 0;
275+
my->itemNotMovingClient = 0;
276+
my->flags[USERFLAG1] = false; // enable collision
277+
if ( multiplayer == SERVER )
278+
{
279+
for ( int c = 1; c < MAXPLAYERS; c++ )
280+
{
281+
if ( client_disconnected[c] || players[c]->isLocalPlayer() )
282+
{
283+
continue;
284+
}
285+
strcpy((char*)net_packet->data, "GHOI");
286+
SDLNet_Write32(my->getUID(), &net_packet->data[4]);
287+
SDLNet_Write16((Sint16)(my->x * 32), &net_packet->data[8]);
288+
SDLNet_Write16((Sint16)(my->y * 32), &net_packet->data[10]);
289+
SDLNet_Write16((Sint16)(my->z * 32), &net_packet->data[12]);
290+
SDLNet_Write16((Sint16)(my->vel_x * 32), &net_packet->data[14]);
291+
SDLNet_Write16((Sint16)(my->vel_y * 32), &net_packet->data[16]);
292+
SDLNet_Write16((Sint16)(my->vel_z * 32), &net_packet->data[18]);
293+
net_packet->address.host = net_clients[c - 1].host;
294+
net_packet->address.port = net_clients[c - 1].port;
295+
net_packet->len = 20;
296+
sendPacketSafe(net_sock, -1, net_packet, c - 1);
297+
}
298+
}
299+
}
300+
else if ( inrange[i] && players[i] && players[i]->entity )
269301
{
270302
bool trySalvage = false;
271303
if ( static_cast<Uint32>(my->itemAutoSalvageByPlayer) == players[i]->entity->getUID() )
@@ -365,68 +397,83 @@ void actItem(Entity* my)
365397
}
366398
}
367399

400+
my->removeLightField();
401+
switch ( my->sprite )
402+
{
403+
case 610: // orbs (blue)
404+
if ( !my->light )
405+
{
406+
my->light = addLight(my->x / 16, my->y / 16, "orb_blue");
407+
}
408+
break;
409+
case 611: // red
410+
if ( !my->light )
411+
{
412+
my->light = addLight(my->x / 16, my->y / 16, "orb_red");
413+
}
414+
break;
415+
case 612: // purple
416+
if ( !my->light )
417+
{
418+
my->light = addLight(my->x / 16, my->y / 16, "orb_purple");
419+
}
420+
break;
421+
case 613: // green
422+
if ( !my->light )
423+
{
424+
my->light = addLight(my->x / 16, my->y / 16, "orb_green");
425+
}
426+
break;
427+
case 1206: // loot bags (yellow)
428+
if ( !my->light )
429+
{
430+
my->light = addLight(my->x / 16, my->y / 16, "lootbag_yellow");
431+
}
432+
break;
433+
case 1207: // green
434+
if ( !my->light )
435+
{
436+
my->light = addLight(my->x / 16, my->y / 16, "lootbag_green");
437+
}
438+
break;
439+
case 1208: // red
440+
if ( !my->light )
441+
{
442+
my->light = addLight(my->x / 16, my->y / 16, "lootbag_red");
443+
}
444+
break;
445+
case 1209: // pink
446+
if ( !my->light )
447+
{
448+
my->light = addLight(my->x / 16, my->y / 16, "lootbag_pink");
449+
}
450+
break;
451+
case 1210: // white
452+
if ( !my->light )
453+
{
454+
my->light = addLight(my->x / 16, my->y / 16, "lootbag_white");
455+
}
456+
break;
457+
default:
458+
break;
459+
}
460+
368461
if ( my->itemNotMoving )
369462
{
370463
switch ( my->sprite )
371464
{
372465
case 610: // orbs (blue)
373466
my->spawnAmbientParticles(80, my->sprite - 4, 10 + local_rng.rand() % 40, 1.0, false);
374-
if ( !my->light )
375-
{
376-
my->light = addLight(my->x / 16, my->y / 16, "orb_blue");
377-
}
378467
break;
379468
case 611: // red
380469
my->spawnAmbientParticles(80, my->sprite - 4, 10 + local_rng.rand() % 40, 1.0, false);
381-
if ( !my->light )
382-
{
383-
my->light = addLight(my->x / 16, my->y / 16, "orb_red");
384-
}
385470
break;
386471
case 612: // purple
387472
my->spawnAmbientParticles(80, my->sprite - 4, 10 + local_rng.rand() % 40, 1.0, false);
388-
if ( !my->light )
389-
{
390-
my->light = addLight(my->x / 16, my->y / 16, "orb_purple");
391-
}
392473
break;
393474
case 613: // green
394475
my->spawnAmbientParticles(80, my->sprite - 4, 10 + local_rng.rand() % 40, 1.0, false);
395-
if ( !my->light )
396-
{
397-
my->light = addLight(my->x / 16, my->y / 16, "orb_green");
398-
}
399476
break;
400-
case 1206: // loot bags (yellow)
401-
if ( !my->light )
402-
{
403-
my->light = addLight(my->x / 16, my->y / 16, "lootbag_yellow");
404-
}
405-
break;
406-
case 1207: // green
407-
if ( !my->light )
408-
{
409-
my->light = addLight(my->x / 16, my->y / 16, "lootbag_green");
410-
}
411-
break;
412-
case 1208: // red
413-
if ( !my->light )
414-
{
415-
my->light = addLight(my->x / 16, my->y / 16, "lootbag_red");
416-
}
417-
break;
418-
case 1209: // pink
419-
if ( !my->light )
420-
{
421-
my->light = addLight(my->x / 16, my->y / 16, "lootbag_pink");
422-
}
423-
break;
424-
case 1210: // white
425-
if ( !my->light )
426-
{
427-
my->light = addLight(my->x / 16, my->y / 16, "lootbag_white");
428-
}
429-
break;
430477
default:
431478
break;
432479
}
@@ -482,6 +529,8 @@ void actItem(Entity* my)
482529
}
483530
}
484531

532+
my->flags[BURNING] = false;
533+
485534
if ( my->z < groundheight )
486535
{
487536
// fall

src/actmagictrap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ void Entity::actTeleportShrine()
389389
{
390390
if ( selectedEntity[i] == this || client_selected[i] == this )
391391
{
392-
if ( inrange[i] && players[i]->entity )
392+
if ( inrange[i] && Player::getPlayerInteractEntity(i) )
393393
{
394394
if ( shrineActivateDelay > 0 )
395395
{
@@ -438,7 +438,7 @@ void Entity::actTeleportShrine()
438438
spellTimer->particleTimerCountdownSprite = 625;
439439
spellTimer->particleTimerTarget = static_cast<Sint32>(selectedShrine->getUID()); // get the target to teleport around.
440440
spellTimer->particleTimerVariable1 = 1; // distance of teleport in tiles
441-
spellTimer->particleTimerVariable2 = players[i]->entity->getUID(); // which player to teleport
441+
spellTimer->particleTimerVariable2 = Player::getPlayerInteractEntity(i)->getUID(); // which player to teleport
442442
if ( multiplayer == SERVER )
443443
{
444444
serverSpawnMiscParticles(this, PARTICLE_EFFECT_SHRINE_TELEPORT, 625);

0 commit comments

Comments
 (0)