mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #2242
2242: Use CSaveTee for rescue (fixes #2241) r=heinrich5991 a=def- Untested. Edit: Tested, seems to work. Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
09f60fc919
|
@ -2185,16 +2185,8 @@ void CCharacter::DDRaceTick()
|
|||
int index = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
||||
int tile = GameServer()->Collision()->GetTileIndex(index);
|
||||
int ftile = GameServer()->Collision()->GetFTileIndex(index);
|
||||
if(IsGrounded() && tile != TILE_FREEZE && tile != TILE_DFREEZE && ftile != TILE_FREEZE && ftile != TILE_DFREEZE) {
|
||||
m_PrevSavePos = m_Pos;
|
||||
for(int i = 0; i< NUM_WEAPONS; i++)
|
||||
{
|
||||
m_aPrevSaveWeapons[i].m_AmmoRegenStart = m_aWeapons[i].m_AmmoRegenStart;
|
||||
m_aPrevSaveWeapons[i].m_Ammo = m_aWeapons[i].m_Ammo;
|
||||
m_aPrevSaveWeapons[i].m_Ammocost = m_aWeapons[i].m_Ammocost;
|
||||
m_aPrevSaveWeapons[i].m_Got = m_aWeapons[i].m_Got;
|
||||
}
|
||||
m_PrevSaveActiveWeapon = m_Core.m_ActiveWeapon;
|
||||
if(IsGrounded() && tile != TILE_FREEZE && tile != TILE_DFREEZE && ftile != TILE_FREEZE && ftile != TILE_DFREEZE && !m_DeepFreeze) {
|
||||
m_RescueTee.save(this);
|
||||
m_SetSavePos = true;
|
||||
}
|
||||
}
|
||||
|
@ -2414,26 +2406,12 @@ void CCharacter::Rescue()
|
|||
return;
|
||||
}
|
||||
|
||||
m_LastRescue = Server()->Tick();
|
||||
m_Core.m_Pos = m_PrevSavePos;
|
||||
m_Pos = m_PrevSavePos;
|
||||
m_PrevPos = m_PrevSavePos;
|
||||
m_Core.m_Vel = vec2(0, 0);
|
||||
m_Core.m_HookedPlayer = -1;
|
||||
m_Core.m_HookState = HOOK_RETRACTED;
|
||||
m_Core.m_TriggeredEvents |= COREEVENT_HOOK_RETRACT;
|
||||
GameWorld()->ReleaseHooked(GetPlayer()->GetCID());
|
||||
m_Core.m_HookPos = m_Core.m_Pos;
|
||||
m_DeepFreeze = false;
|
||||
UnFreeze();
|
||||
|
||||
for(int i = 0; i< NUM_WEAPONS; i++)
|
||||
{
|
||||
m_aWeapons[i].m_AmmoRegenStart = m_aPrevSaveWeapons[i].m_AmmoRegenStart;
|
||||
m_aWeapons[i].m_Ammo = m_aPrevSaveWeapons[i].m_Ammo;
|
||||
m_aWeapons[i].m_Ammocost = m_aPrevSaveWeapons[i].m_Ammocost;
|
||||
m_aWeapons[i].m_Got = m_aPrevSaveWeapons[i].m_Got;
|
||||
}
|
||||
m_Core.m_ActiveWeapon = m_PrevSaveActiveWeapon;
|
||||
float StartTime = m_StartTime;
|
||||
m_RescueTee.load(this, Team());
|
||||
// Don't load these from saved tee:
|
||||
m_Core.m_Vel = vec2(0, 0);
|
||||
m_Core.m_HookState = HOOK_IDLE;
|
||||
m_StartTime = StartTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <engine/antibot.h>
|
||||
#include <game/server/entity.h>
|
||||
#include <game/server/save.h>
|
||||
#include <game/generated/server_data.h>
|
||||
#include <game/generated/protocol.h>
|
||||
|
||||
|
@ -12,6 +13,7 @@
|
|||
|
||||
class CAntibot;
|
||||
class CGameTeams;
|
||||
class CSaveTee;
|
||||
struct CAntibotCharacterData;
|
||||
|
||||
enum
|
||||
|
@ -112,9 +114,6 @@ private:
|
|||
|
||||
} m_aWeapons[NUM_WEAPONS];
|
||||
|
||||
struct WeaponStat m_aPrevSaveWeapons[NUM_WEAPONS];
|
||||
int m_PrevSaveActiveWeapon;
|
||||
|
||||
int m_LastWeapon;
|
||||
int m_QueuedWeapon;
|
||||
|
||||
|
@ -181,7 +180,7 @@ private:
|
|||
IAntibot *Antibot();
|
||||
|
||||
bool m_SetSavePos;
|
||||
vec2 m_PrevSavePos;
|
||||
CSaveTee m_RescueTee;
|
||||
bool m_Solo;
|
||||
|
||||
public:
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
#ifndef GAME_SERVER_SAVE_H
|
||||
#define GAME_SERVER_SAVE_H
|
||||
|
||||
#include "entities/character.h"
|
||||
#include <engine/shared/protocol.h>
|
||||
#include <game/generated/protocol.h>
|
||||
#include <game/server/gamecontroller.h>
|
||||
|
||||
class IGameController;
|
||||
class CGameContext;
|
||||
class CCharacter;
|
||||
|
||||
class CSaveTee
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#define GAME_SERVER_SCORE_SQL_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <engine/map.h>
|
||||
#include <engine/server/sql_string_helpers.h>
|
||||
|
|
Loading…
Reference in a new issue