|
4 | 4 | #include "gameworld.h" |
5 | 5 | #include "entities/character.h" |
6 | 6 | #include "entities/dragger.h" |
| 7 | +#include "entities/ic_placed_object.h" |
7 | 8 | #include "entities/laser.h" |
8 | 9 | #include "entities/pickup.h" |
9 | 10 | #include "entities/projectile.h" |
|
12 | 13 | #include <game/client/laser_data.h> |
13 | 14 | #include <game/client/pickup_data.h> |
14 | 15 | #include <game/client/projectile_data.h> |
| 16 | +#include <game/generated/protocol.h> |
15 | 17 | #include <game/mapbugs.h> |
16 | 18 | #include <game/mapitems.h> |
17 | 19 |
|
@@ -124,6 +126,11 @@ void CGameWorld::InsertEntity(CEntity *pEnt, bool Last) |
124 | 126 | } |
125 | 127 | } |
126 | 128 |
|
| 129 | +void CGameWorld::DestroyEntity(CEntity *pEnt) |
| 130 | +{ |
| 131 | + pEnt->MarkForDestroy(); |
| 132 | +} |
| 133 | + |
127 | 134 | void CGameWorld::RemoveEntity(CEntity *pEnt) |
128 | 135 | { |
129 | 136 | // not in the list |
@@ -549,7 +556,32 @@ void CGameWorld::NetObjAdd(int ObjId, int ObjType, const void *pObjData, const C |
549 | 556 | } |
550 | 557 | else if(ObjType == NETOBJTYPE_INFCLASSOBJECT) |
551 | 558 | { |
| 559 | + const CNetObj_InfClassObject *pObject = static_cast<const CNetObj_InfClassObject *>(pObjData); |
| 560 | + vec2 Pos(pObject->m_X, pObject->m_Y); |
| 561 | + float Radius = fx2f(pObject->m_ProximityRadius); |
| 562 | + EIcObjectType IcObjectType = GetIcObjectTypeFromInt(pObject->m_Type); |
| 563 | + |
| 564 | + CIcPlacedObject NetObject(this, ObjId, IcObjectType, Pos, pObject->m_Owner, Radius); |
| 565 | + if(pObject->m_Flags & INFCLASS_OBJECT_FLAG_HAS_SECOND_POSITION) |
| 566 | + { |
| 567 | + vec2 Pos2(pObject->m_X2, pObject->m_Y2); |
| 568 | + NetObject.SetSecondPosition(Pos2); |
| 569 | + } |
| 570 | + NetObject.SetStartTick(pObject->m_StartTick); |
| 571 | + NetObject.SetEndTick(pObject->m_EndTick); |
| 572 | + NetObject.SetSnapData1(pObject->m_Data1); |
552 | 573 |
|
| 574 | + CIcPlacedObject *pExisting = static_cast<CIcPlacedObject *>(GetEntity(ObjId, ENTTYPE_IC_PLACED_OBJECT)); |
| 575 | + if (pExisting && pExisting->Match(&NetObject)) |
| 576 | + { |
| 577 | + pExisting->Keep(); |
| 578 | + pExisting->Read(NetObject); |
| 579 | + } |
| 580 | + else |
| 581 | + { |
| 582 | + CIcPlacedObject *pEnt = new CIcPlacedObject(NetObject); |
| 583 | + InsertEntity(pEnt); |
| 584 | + } |
553 | 585 | } |
554 | 586 | } |
555 | 587 |
|
@@ -632,6 +664,8 @@ void CGameWorld::CopyWorld(CGameWorld *pFrom) |
632 | 664 | pCopy = new CCharacter(*((CCharacter *)pEnt)); |
633 | 665 | else if(Type == ENTTYPE_PICKUP) |
634 | 666 | pCopy = new CPickup(*((CPickup *)pEnt)); |
| 667 | + else if(Type == ENTTYPE_IC_PLACED_OBJECT) |
| 668 | + pCopy = new CIcPlacedObject(*((CIcPlacedObject *)pEnt)); |
635 | 669 | if(pCopy) |
636 | 670 | { |
637 | 671 | pCopy->m_pParent = pEnt; |
|
0 commit comments