mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Remove dead code
This commit is contained in:
parent
7f24922b35
commit
7474ca201f
|
@ -571,21 +571,11 @@ void CServer::Ban(int ClientID, int Seconds, const char *pReason)
|
|||
m_NetServer.NetBan()->BanAddr(&Addr, Seconds, pReason);
|
||||
}
|
||||
|
||||
/*int CServer::Tick()
|
||||
{
|
||||
return m_CurrentGameTick;
|
||||
}*/
|
||||
|
||||
int64_t CServer::TickStartTime(int Tick)
|
||||
{
|
||||
return m_GameStartTime + (time_freq() * Tick) / SERVER_TICK_SPEED;
|
||||
}
|
||||
|
||||
/*int CServer::TickSpeed()
|
||||
{
|
||||
return SERVER_TICK_SPEED;
|
||||
}*/
|
||||
|
||||
int CServer::Init()
|
||||
{
|
||||
for(auto &Client : m_aClients)
|
||||
|
|
|
@ -226,42 +226,6 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
|
|||
|
||||
dbg_msg("datafile", "loading done. datafile='%s'", pFilename);
|
||||
|
||||
if(DEBUG)
|
||||
{
|
||||
/*
|
||||
for(int i = 0; i < m_pDataFile->data.num_raw_data; i++)
|
||||
{
|
||||
void *p = datafile_get_data(df, i);
|
||||
dbg_msg("datafile", "%d %d", (int)((char*)p - (char*)(&m_pDataFile->data)), size);
|
||||
}
|
||||
|
||||
for(int i = 0; i < datafile_num_items(df); i++)
|
||||
{
|
||||
int type, id;
|
||||
void *data = datafile_get_item(df, i, &type, &id);
|
||||
dbg_msg("map", "\t%d: type=%x id=%x p=%p offset=%d", i, type, id, data, m_pDataFile->info.item_offsets[i]);
|
||||
int *idata = (int*)data;
|
||||
for(int k = 0; k < 3; k++)
|
||||
dbg_msg("datafile", "\t\t%d=%d (%x)", k, idata[k], idata[k]);
|
||||
}
|
||||
|
||||
for(int i = 0; i < m_pDataFile->data.num_m_aItemTypes; i++)
|
||||
{
|
||||
dbg_msg("map", "\t%d: type=%x start=%d num=%d", i,
|
||||
m_pDataFile->info.m_aItemTypes[i].type,
|
||||
m_pDataFile->info.m_aItemTypes[i].start,
|
||||
m_pDataFile->info.m_aItemTypes[i].num);
|
||||
for(int k = 0; k < m_pDataFile->info.m_aItemTypes[i].num; k++)
|
||||
{
|
||||
int type, id;
|
||||
datafile_get_item(df, m_pDataFile->info.m_aItemTypes[i].start+k, &type, &id);
|
||||
if(type != m_pDataFile->info.m_aItemTypes[i].type)
|
||||
dbg_msg("map", "\tERROR");
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -682,12 +682,7 @@ void CDemoPlayer::Pause()
|
|||
|
||||
void CDemoPlayer::Unpause()
|
||||
{
|
||||
if(m_Info.m_Info.m_Paused)
|
||||
{
|
||||
/*m_Info.start_tick = m_Info.current_tick;
|
||||
m_Info.start_time = time_get();*/
|
||||
m_Info.m_Info.m_Paused = false;
|
||||
}
|
||||
m_Info.m_Info.m_Paused = false;
|
||||
#if defined(CONF_VIDEORECORDER)
|
||||
if(IVideo::Current() && g_Config.m_ClVideoPauseWithDemo)
|
||||
IVideo::Current()->Pause(false);
|
||||
|
@ -909,8 +904,6 @@ int CDemoPlayer::Play()
|
|||
DoTick();
|
||||
|
||||
// set start info
|
||||
/*m_Info.start_tick = m_Info.previous_tick;
|
||||
m_Info.start_time = time_get();*/
|
||||
m_Info.m_CurrentTime = m_Info.m_PreviousTick * time_freq() / SERVER_TICK_SPEED;
|
||||
m_Info.m_LastUpdate = time();
|
||||
return 0;
|
||||
|
|
|
@ -101,13 +101,7 @@ int CNetServer::Close()
|
|||
int CNetServer::Drop(int ClientID, const char *pReason)
|
||||
{
|
||||
// TODO: insert lots of checks here
|
||||
/*NETADDR Addr = ClientAddr(ClientID);
|
||||
|
||||
dbg_msg("net_server", "client dropped. cid=%d ip=%d.%d.%d.%d reason=\"%s\"",
|
||||
ClientID,
|
||||
Addr.ip[0], Addr.ip[1], Addr.ip[2], Addr.ip[3],
|
||||
pReason
|
||||
);*/
|
||||
if(m_pfnDelClient)
|
||||
m_pfnDelClient(ClientID, pReason, m_pUser);
|
||||
|
||||
|
|
|
@ -906,11 +906,8 @@ void CGameConsole::Toggle(int Type)
|
|||
|
||||
if(m_ConsoleState == CONSOLE_CLOSED || m_ConsoleState == CONSOLE_CLOSING)
|
||||
{
|
||||
/*Input()->MouseModeAbsolute();*/
|
||||
UI()->SetEnabled(false);
|
||||
m_ConsoleState = CONSOLE_OPENING;
|
||||
/*// reset controls
|
||||
m_pClient->m_Controls.OnReset();*/
|
||||
|
||||
Input()->SetIMEState(true);
|
||||
}
|
||||
|
|
|
@ -20,9 +20,6 @@ void CDebugHud::RenderNetCorrections()
|
|||
float Width = 300 * Graphics()->ScreenAspect();
|
||||
Graphics()->MapScreen(0, 0, Width, 300);
|
||||
|
||||
/*float speed = distance(vec2(netobjects.local_prev_character->x, netobjects.local_prev_character->y),
|
||||
vec2(netobjects.local_character->x, netobjects.local_character->y));*/
|
||||
|
||||
const float TicksPerSecond = 50.0f;
|
||||
float Velspeed = length(vec2(m_pClient->m_Snap.m_pLocalCharacter->m_VelX / 256.0f, m_pClient->m_Snap.m_pLocalCharacter->m_VelY / 256.0f)) * TicksPerSecond;
|
||||
float VelspeedX = m_pClient->m_Snap.m_pLocalCharacter->m_VelX / 256.0f * TicksPerSecond;
|
||||
|
|
|
@ -307,10 +307,6 @@ IGraphics::CTextureHandle CMapImages::GetEntities(EMapImageEntityLayerType Entit
|
|||
{
|
||||
ValidTile = false;
|
||||
}
|
||||
/*else if((EntitiesModType == MAP_IMAGE_MOD_TYPE_RACE_BLOCKWORLD) && ...)
|
||||
{
|
||||
ValidTile = false;
|
||||
}*/
|
||||
}
|
||||
|
||||
if(EntitiesModType == MAP_IMAGE_MOD_TYPE_DDNET || EntitiesModType == MAP_IMAGE_MOD_TYPE_DDRACE)
|
||||
|
|
|
@ -2694,42 +2694,6 @@ int CMenus::MenuImageScan(const char *pName, int IsDir, int DirType, void *pUser
|
|||
d[i * Step + 2] = v;
|
||||
}
|
||||
|
||||
/* same grey like sinks
|
||||
int Freq[256] = {0};
|
||||
int OrgWeight = 0;
|
||||
int NewWeight = 192;
|
||||
|
||||
// find most common frequence
|
||||
for(int y = 0; y < Info.m_Height; y++)
|
||||
for(int x = 0; x < Info.m_Width; x++)
|
||||
{
|
||||
if(d[y*Pitch+x*4+3] > 128)
|
||||
Freq[d[y*Pitch+x*4]]++;
|
||||
}
|
||||
|
||||
for(int i = 1; i < 256; i++)
|
||||
{
|
||||
if(Freq[OrgWeight] < Freq[i])
|
||||
OrgWeight = i;
|
||||
}
|
||||
|
||||
// reorder
|
||||
int InvOrgWeight = 255-OrgWeight;
|
||||
int InvNewWeight = 255-NewWeight;
|
||||
for(int y = 0; y < Info.m_Height; y++)
|
||||
for(int x = 0; x < Info.m_Width; x++)
|
||||
{
|
||||
int v = d[y*Pitch+x*4];
|
||||
if(v <= OrgWeight)
|
||||
v = (int)(((v/(float)OrgWeight) * NewWeight));
|
||||
else
|
||||
v = (int)(((v-OrgWeight)/(float)InvOrgWeight)*InvNewWeight + NewWeight);
|
||||
d[y*Pitch+x*4] = v;
|
||||
d[y*Pitch+x*4+1] = v;
|
||||
d[y*Pitch+x*4+2] = v;
|
||||
}
|
||||
*/
|
||||
|
||||
MenuImage.m_GreyTexture = pSelf->Graphics()->LoadTextureRaw(Info.m_Width, Info.m_Height, Info.m_Format, Info.m_pData, Info.m_Format, 0);
|
||||
pSelf->Graphics()->FreePNG(&Info);
|
||||
|
||||
|
|
|
@ -361,56 +361,6 @@ void CMenus::RenderPlayers(CUIRect MainView)
|
|||
}
|
||||
|
||||
UiDoListboxEnd(&s_ScrollValue, 0);
|
||||
/*
|
||||
CUIRect bars;
|
||||
votearea.HSplitTop(10.0f, 0, &votearea);
|
||||
votearea.HSplitTop(25.0f + 10.0f*3 + 25.0f, &votearea, &bars);
|
||||
|
||||
RenderTools()->DrawUIRect(&votearea, color_tabbar_active, CUI::CORNER_ALL, 10.0f);
|
||||
|
||||
votearea.VMargin(20.0f, &votearea);
|
||||
votearea.HMargin(10.0f, &votearea);
|
||||
|
||||
votearea.HSplitBottom(35.0f, &votearea, &bars);
|
||||
|
||||
if(gameclient.voting->is_voting())
|
||||
{
|
||||
// do yes button
|
||||
votearea.VSplitLeft(50.0f, &button, &votearea);
|
||||
static int yes_button = 0;
|
||||
if(UI()->DoButton(&yes_button, "Yes", 0, &button, ui_draw_menu_button, 0))
|
||||
gameclient.voting->vote(1);
|
||||
|
||||
// do no button
|
||||
votearea.VSplitLeft(5.0f, 0, &votearea);
|
||||
votearea.VSplitLeft(50.0f, &button, &votearea);
|
||||
static int no_button = 0;
|
||||
if(UI()->DoButton(&no_button, "No", 0, &button, ui_draw_menu_button, 0))
|
||||
gameclient.voting->vote(-1);
|
||||
|
||||
// do time left
|
||||
votearea.VSplitRight(50.0f, &votearea, &button);
|
||||
char buf[256];
|
||||
str_format(buf, sizeof(buf), "%d", gameclient.voting->seconds_left());
|
||||
UI()->DoLabel(&button, buf, 24.0f, TEXTALIGN_CENTER);
|
||||
|
||||
// do description and command
|
||||
votearea.VSplitLeft(5.0f, 0, &votearea);
|
||||
UI()->DoLabel(&votearea, gameclient.voting->vote_description(), 14.0f, TEXTALIGN_LEFT);
|
||||
votearea.HSplitTop(16.0f, 0, &votearea);
|
||||
UI()->DoLabel(&votearea, gameclient.voting->vote_command(), 10.0f, TEXTALIGN_LEFT);
|
||||
|
||||
// do bars
|
||||
bars.HSplitTop(10.0f, 0, &bars);
|
||||
bars.HMargin(5.0f, &bars);
|
||||
|
||||
gameclient.voting->render_bars(bars, true);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
UI()->DoLabel(&votearea, "No vote in progress", 18.0f, TEXTALIGN_LEFT);
|
||||
}*/
|
||||
}
|
||||
|
||||
void CMenus::RenderServerInfo(CUIRect MainView)
|
||||
|
|
|
@ -11,13 +11,11 @@ public: \
|
|||
void *operator new(size_t Size) \
|
||||
{ \
|
||||
void *p = malloc(Size); \
|
||||
/*dbg_msg("", "++ %p %d", p, size);*/ \
|
||||
mem_zero(p, Size); \
|
||||
return p; \
|
||||
} \
|
||||
void operator delete(void *pPtr) \
|
||||
{ \
|
||||
/*dbg_msg("", "-- %p", p);*/ \
|
||||
free(pPtr); \
|
||||
} \
|
||||
\
|
||||
|
|
|
@ -5049,15 +5049,11 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
|
||||
static int s_aChannelButtons[4] = {0};
|
||||
int Bit = 1;
|
||||
//ui_draw_button_func draw_func;
|
||||
|
||||
for(int i = 0; i < pEnvelope->m_Channels; i++, Bit <<= 1)
|
||||
{
|
||||
ToolBar.VSplitLeft(15.0f, &Button, &ToolBar);
|
||||
|
||||
/*if(i == 0) draw_func = draw_editor_button_l;
|
||||
else if(i == envelope->channels-1) draw_func = draw_editor_button_r;
|
||||
else draw_func = draw_editor_button_m;*/
|
||||
if(DoButton_Env(&s_aChannelButtons[i], s_paNames[pEnvelope->m_Channels - 1][i], s_ActiveChannels & Bit, &Button, paDescriptions[pEnvelope->m_Channels - 1][i], aColors[i]))
|
||||
s_ActiveChannels ^= Bit;
|
||||
}
|
||||
|
@ -5356,7 +5352,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
|
|||
pEnvelope->m_lPoints[i].m_aValues[c] = f2fx(str_tofloat(s_aStrCurValue));
|
||||
}
|
||||
|
||||
if(UI()->CheckActiveItem(pID) /* || UI()->HotItem() == pID*/)
|
||||
if(UI()->CheckActiveItem(pID))
|
||||
{
|
||||
CurrentTime = pEnvelope->m_lPoints[i].m_Time;
|
||||
CurrentValue = pEnvelope->m_lPoints[i].m_aValues[c];
|
||||
|
@ -5695,24 +5691,12 @@ int CEditor::PopupMenuFile(CEditor *pEditor, CUIRect View, void *pContext)
|
|||
|
||||
void CEditor::RenderMenubar(CUIRect MenuBar)
|
||||
{
|
||||
static CUIRect s_File /*, view, help*/;
|
||||
static CUIRect s_File;
|
||||
|
||||
MenuBar.VSplitLeft(60.0f, &s_File, &MenuBar);
|
||||
if(DoButton_Menu(&s_File, "File", 0, &s_File, 0, 0))
|
||||
UiInvokePopupMenu(&s_File, 1, s_File.x, s_File.y + s_File.h - 1.0f, 120, 160, PopupMenuFile, this);
|
||||
|
||||
/*
|
||||
menubar.VSplitLeft(5.0f, 0, &menubar);
|
||||
menubar.VSplitLeft(60.0f, &view, &menubar);
|
||||
if(do_editor_button(&view, "View", 0, &view, draw_editor_button_menu, 0, 0))
|
||||
(void)0;
|
||||
|
||||
menubar.VSplitLeft(5.0f, 0, &menubar);
|
||||
menubar.VSplitLeft(60.0f, &help, &menubar);
|
||||
if(do_editor_button(&help, "Help", 0, &help, draw_editor_button_menu, 0, 0))
|
||||
(void)0;
|
||||
*/
|
||||
|
||||
CUIRect Info, Close;
|
||||
MenuBar.VSplitLeft(40.0f, 0, &MenuBar);
|
||||
MenuBar.VSplitRight(20.0f, &MenuBar, &Close);
|
||||
|
|
|
@ -18,189 +18,6 @@ static int MakeVersion(int i, const T &v)
|
|||
return (i << 16) + sizeof(T);
|
||||
}
|
||||
|
||||
// backwards compatibility
|
||||
/*
|
||||
void editor_load_old(DATAFILE *df, MAP *map)
|
||||
{
|
||||
class mapres_image
|
||||
{
|
||||
public:
|
||||
int width;
|
||||
int height;
|
||||
int image_data;
|
||||
};
|
||||
|
||||
struct mapres_tilemap
|
||||
{
|
||||
int image;
|
||||
int width;
|
||||
int height;
|
||||
int x, y;
|
||||
int scale;
|
||||
int data;
|
||||
int main;
|
||||
};
|
||||
|
||||
struct mapres_entity
|
||||
{
|
||||
int x, y;
|
||||
int data[1];
|
||||
};
|
||||
|
||||
struct mapres_spawnpoint
|
||||
{
|
||||
int x, y;
|
||||
};
|
||||
|
||||
struct mapres_item
|
||||
{
|
||||
int x, y;
|
||||
int type;
|
||||
};
|
||||
|
||||
struct mapres_flagstand
|
||||
{
|
||||
int x, y;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MAPRES_ENTS_START=1,
|
||||
MAPRES_SPAWNPOINT=1,
|
||||
MAPRES_ITEM=2,
|
||||
MAPRES_SPAWNPOINT_RED=3,
|
||||
MAPRES_SPAWNPOINT_BLUE=4,
|
||||
MAPRES_FLAGSTAND_RED=5,
|
||||
MAPRES_FLAGSTAND_BLUE=6,
|
||||
MAPRES_ENTS_END,
|
||||
|
||||
ITEM_NULL=0,
|
||||
ITEM_WEAPON_GUN=0x00010001,
|
||||
ITEM_WEAPON_SHOTGUN=0x00010002,
|
||||
ITEM_WEAPON_ROCKET=0x00010003,
|
||||
ITEM_WEAPON_SNIPER=0x00010004,
|
||||
ITEM_WEAPON_HAMMER=0x00010005,
|
||||
ITEM_HEALTH =0x00020001,
|
||||
ITEM_ARMOR=0x00030001,
|
||||
ITEM_NINJA=0x00040001,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MAPRES_REGISTERED=0x8000,
|
||||
MAPRES_IMAGE=0x8001,
|
||||
MAPRES_TILEMAP=0x8002,
|
||||
MAPRES_COLLISIONMAP=0x8003,
|
||||
MAPRES_TEMP_THEME=0x8fff,
|
||||
};
|
||||
|
||||
// load tilemaps
|
||||
int game_width = 0;
|
||||
int game_height = 0;
|
||||
{
|
||||
int start, num;
|
||||
datafile_get_type(df, MAPRES_TILEMAP, &start, &num);
|
||||
for(int t = 0; t < num; t++)
|
||||
{
|
||||
mapres_tilemap *tmap = (mapres_tilemap *)datafile_get_item(df, start+t,0,0);
|
||||
|
||||
CLayerTiles *l = new CLayerTiles(tmap->width, tmap->height);
|
||||
|
||||
if(tmap->main)
|
||||
{
|
||||
// move game layer to correct position
|
||||
for(int i = 0; i < map->groups[0]->layers.len()-1; i++)
|
||||
{
|
||||
if(map->groups[0]->layers[i] == pEditor->map.game_layer)
|
||||
map->groups[0]->swap_layers(i, i+1);
|
||||
}
|
||||
|
||||
game_width = tmap->width;
|
||||
game_height = tmap->height;
|
||||
}
|
||||
|
||||
// add new layer
|
||||
map->groups[0]->add_layer(l);
|
||||
|
||||
// process the data
|
||||
unsigned char *src_data = (unsigned char *)datafile_get_data(df, tmap->data);
|
||||
CTile *dst_data = l->tiles;
|
||||
|
||||
for(int y = 0; y < tmap->height; y++)
|
||||
for(int x = 0; x < tmap->width; x++, dst_data++, src_data+=2)
|
||||
{
|
||||
dst_data->index = src_data[0];
|
||||
dst_data->flags = src_data[1];
|
||||
}
|
||||
|
||||
l->image = tmap->image;
|
||||
}
|
||||
}
|
||||
|
||||
// load images
|
||||
{
|
||||
int start, count;
|
||||
datafile_get_type(df, MAPRES_IMAGE, &start, &count);
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
mapres_image *imgres = (mapres_image *)datafile_get_item(df, start+i, 0, 0);
|
||||
void *data = datafile_get_data(df, imgres->image_data);
|
||||
|
||||
EDITOR_IMAGE *img = new EDITOR_IMAGE;
|
||||
img->width = imgres->width;
|
||||
img->height = imgres->height;
|
||||
img->format = CImageInfo::FORMAT_RGBA;
|
||||
|
||||
// copy image data
|
||||
img->data = mem_alloc(img->width*img->height*4, 1);
|
||||
mem_copy(img->data, data, img->width*img->height*4);
|
||||
img->tex_id = Graphics()->LoadTextureRaw(img->width, img->height, img->format, img->data, CImageInfo::FORMAT_AUTO, 0);
|
||||
map->images.add(img);
|
||||
|
||||
// unload image
|
||||
datafile_unload_data(df, imgres->image_data);
|
||||
}
|
||||
}
|
||||
|
||||
// load entities
|
||||
{
|
||||
CLayerGame *g = map->game_layer;
|
||||
g->resize(game_width, game_height);
|
||||
for(int t = MAPRES_ENTS_START; t < MAPRES_ENTS_END; t++)
|
||||
{
|
||||
// fetch entities of this class
|
||||
int start, num;
|
||||
datafile_get_type(df, t, &start, &num);
|
||||
|
||||
|
||||
for(int i = 0; i < num; i++)
|
||||
{
|
||||
mapres_entity *e = (mapres_entity *)datafile_get_item(df, start+i,0,0);
|
||||
int x = e->x/32;
|
||||
int y = e->y/32;
|
||||
int id = -1;
|
||||
|
||||
if(t == MAPRES_SPAWNPOINT) id = ENTITY_SPAWN;
|
||||
else if(t == MAPRES_SPAWNPOINT_RED) id = ENTITY_SPAWN_RED;
|
||||
else if(t == MAPRES_SPAWNPOINT_BLUE) id = ENTITY_SPAWN_BLUE;
|
||||
else if(t == MAPRES_FLAGSTAND_RED) id = ENTITY_FLAGSTAND_RED;
|
||||
else if(t == MAPRES_FLAGSTAND_BLUE) id = ENTITY_FLAGSTAND_BLUE;
|
||||
else if(t == MAPRES_ITEM)
|
||||
{
|
||||
if(e->data[0] == ITEM_WEAPON_SHOTGUN) id = ENTITY_WEAPON_SHOTGUN;
|
||||
else if(e->data[0] == ITEM_WEAPON_ROCKET) id = ENTITY_WEAPON_GRENADE;
|
||||
else if(e->data[0] == ITEM_NINJA) id = ENTITY_POWERUP_NINJA;
|
||||
else if(e->data[0] == ITEM_ARMOR) id = ENTITY_ARMOR_1;
|
||||
else if(e->data[0] == ITEM_HEALTH) id = ENTITY_HEALTH_1;
|
||||
}
|
||||
|
||||
if(id > 0 && x >= 0 && x < g->width && y >= 0 && y < g->height)
|
||||
g->tiles[y*g->width+x].index = id+ENTITY_OFFSET;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// compatibility with old sound layers
|
||||
struct CSoundSource_DEPRECATED
|
||||
{
|
||||
|
@ -594,7 +411,6 @@ int CEditor::Load(const char *pFileName, int StorageType)
|
|||
int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int StorageType)
|
||||
{
|
||||
CDataFileReader DataFile;
|
||||
//DATAFILE *df = datafile_load(filename);
|
||||
if(!DataFile.Open(pStorage, pFileName, StorageType))
|
||||
return 0;
|
||||
|
||||
|
@ -604,17 +420,10 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
CMapItemVersion *pItemVersion = (CMapItemVersion *)DataFile.FindItem(MAPITEMTYPE_VERSION, 0);
|
||||
if(!pItemVersion)
|
||||
{
|
||||
// import old map
|
||||
/*MAP old_mapstuff;
|
||||
editor->reset();
|
||||
editor_load_old(df, this);
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
else if(pItemVersion->m_Version == 1)
|
||||
{
|
||||
//editor.reset(false);
|
||||
|
||||
// load map info
|
||||
{
|
||||
int Start, Num;
|
||||
|
@ -1034,121 +843,6 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
|
|||
}
|
||||
|
||||
DataFile.UnloadData(pTilemapItem->m_Data);
|
||||
|
||||
// Remove unused tiles on game and front layers
|
||||
/*if(pTiles->m_Game)
|
||||
{
|
||||
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
|
||||
{
|
||||
if(!IsValidGameTile(pTiles->m_pTiles[i].m_Index))
|
||||
{
|
||||
if(pTiles->m_pTiles[i].m_Index) {
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "game layer, tile %d", pTiles->m_pTiles[i].m_Index);
|
||||
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
|
||||
Changed = true;
|
||||
}
|
||||
pTiles->m_pTiles[i].m_Index = 0;
|
||||
pTiles->m_pTiles[i].m_Flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(pTiles->m_Front)
|
||||
{
|
||||
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
|
||||
{
|
||||
if(!IsValidFrontTile(pTiles->m_pTiles[i].m_Index))
|
||||
{
|
||||
if(pTiles->m_pTiles[i].m_Index) {
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "front layer, tile %d", pTiles->m_pTiles[i].m_Index);
|
||||
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
|
||||
Changed = true;
|
||||
}
|
||||
pTiles->m_pTiles[i].m_Index = 0;
|
||||
pTiles->m_pTiles[i].m_Flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(pTiles->m_Tele)
|
||||
{
|
||||
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
|
||||
{
|
||||
if(!IsValidTeleTile(pTiles->m_pTiles[i].m_Index))
|
||||
{
|
||||
if(pTiles->m_pTiles[i].m_Index) {
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "tele layer, tile %d", pTiles->m_pTiles[i].m_Index);
|
||||
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
|
||||
Changed = true;
|
||||
}
|
||||
pTiles->m_pTiles[i].m_Index = 0;
|
||||
pTiles->m_pTiles[i].m_Flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(pTiles->m_Speedup)
|
||||
{
|
||||
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
|
||||
{
|
||||
if(!IsValidSpeedupTile(pTiles->m_pTiles[i].m_Index))
|
||||
{
|
||||
if(pTiles->m_pTiles[i].m_Index) {
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "speedup layer, tile %d", pTiles->m_pTiles[i].m_Index);
|
||||
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
|
||||
Changed = true;
|
||||
}
|
||||
pTiles->m_pTiles[i].m_Index = 0;
|
||||
pTiles->m_pTiles[i].m_Flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(pTiles->m_Switch)
|
||||
{
|
||||
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
|
||||
{
|
||||
if(!IsValidSwitchTile(pTiles->m_pTiles[i].m_Index))
|
||||
{
|
||||
if(pTiles->m_pTiles[i].m_Index) {
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "switch layer, tile %d", pTiles->m_pTiles[i].m_Index);
|
||||
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "editor", aBuf);
|
||||
Changed = true;
|
||||
}
|
||||
pTiles->m_pTiles[i].m_Index = 0;
|
||||
pTiles->m_pTiles[i].m_Flags = 0;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Convert race stoppers to ddrace stoppers
|
||||
/*if(pTiles->m_Game)
|
||||
{
|
||||
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
|
||||
{
|
||||
if(pTiles->m_pTiles[i].m_Index == 29)
|
||||
{
|
||||
pTiles->m_pTiles[i].m_Index = 60;
|
||||
pTiles->m_pTiles[i].m_Flags = TILEFLAG_HFLIP|TILEFLAG_VFLIP|TILEFLAG_ROTATE;
|
||||
}
|
||||
else if(pTiles->m_pTiles[i].m_Index == 30)
|
||||
{
|
||||
pTiles->m_pTiles[i].m_Index = 60;
|
||||
pTiles->m_pTiles[i].m_Flags = TILEFLAG_ROTATE;
|
||||
}
|
||||
else if(pTiles->m_pTiles[i].m_Index == 31)
|
||||
{
|
||||
pTiles->m_pTiles[i].m_Index = 60;
|
||||
pTiles->m_pTiles[i].m_Flags = TILEFLAG_HFLIP|TILEFLAG_VFLIP;
|
||||
}
|
||||
else if(pTiles->m_pTiles[i].m_Index == 32)
|
||||
{
|
||||
pTiles->m_pTiles[i].m_Index = 60;
|
||||
pTiles->m_pTiles[i].m_Flags = 0;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else if(pLayerItem->m_Type == LAYERTYPE_QUADS)
|
||||
{
|
||||
|
|
|
@ -116,12 +116,6 @@ CSoundSource *CLayerSounds::NewSource(int x, int y)
|
|||
pSource->m_Shape.m_Type = CSoundShape::SHAPE_CIRCLE;
|
||||
pSource->m_Shape.m_Circle.m_Radius = 1500;
|
||||
|
||||
/*
|
||||
pSource->m_Shape.m_Type = CSoundShape::SHAPE_RECTANGLE;
|
||||
pSource->m_Shape.m_Rectangle.m_Width = f2fx(1500.0f);
|
||||
pSource->m_Shape.m_Rectangle.m_Height = f2fx(1000.0f);
|
||||
*/
|
||||
|
||||
return pSource;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ private:
|
|||
{ \
|
||||
dbg_assert(sizeof(POOLTYPE) >= Size, "size error"); \
|
||||
dbg_assert(!gs_PoolUsed##POOLTYPE[id], "already used"); \
|
||||
/*dbg_msg("pool", "++ %s %d", #POOLTYPE, id);*/ \
|
||||
ASAN_UNPOISON_MEMORY_REGION(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
gs_PoolUsed##POOLTYPE[id] = 1; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
|
@ -73,7 +72,6 @@ private:
|
|||
{ \
|
||||
dbg_assert(gs_PoolUsed##POOLTYPE[id], "not used"); \
|
||||
dbg_assert(id == (POOLTYPE *)p - (POOLTYPE *)gs_PoolData##POOLTYPE, "invalid id"); \
|
||||
/*dbg_msg("pool", "-- %s %d", #POOLTYPE, id);*/ \
|
||||
gs_PoolUsed##POOLTYPE[id] = 0; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
|
@ -82,7 +80,6 @@ private:
|
|||
{ \
|
||||
int id = (POOLTYPE *)p - (POOLTYPE *)gs_PoolData##POOLTYPE; \
|
||||
dbg_assert(gs_PoolUsed##POOLTYPE[id], "not used"); \
|
||||
/*dbg_msg("pool", "-- %s %d", #POOLTYPE, id);*/ \
|
||||
gs_PoolUsed##POOLTYPE[id] = 0; \
|
||||
mem_zero(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
ASAN_POISON_MEMORY_REGION(gs_PoolData##POOLTYPE[id], sizeof(gs_PoolData##POOLTYPE[id])); \
|
||||
|
|
|
@ -577,8 +577,6 @@ void CGameContext::ConTimeout(IConsole::IResult *pResult, void *pUserData)
|
|||
{
|
||||
if(pSelf->m_apPlayers[i]->GetCharacter())
|
||||
pSelf->SendTuningParams(i, pSelf->m_apPlayers[i]->GetCharacter()->m_TuneZone);
|
||||
/*if(pSelf->Server()->IsSixup(i))
|
||||
pSelf->SendClientInfo(i, i);*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,12 +391,7 @@ void CCharacter::FireWeapon()
|
|||
|
||||
// check for ammo
|
||||
if(!m_Core.m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo)
|
||||
{
|
||||
/*// 125ms is a magical limit of how fast a human can click
|
||||
m_ReloadTimer = 125 * Server()->TickSpeed() / 1000;
|
||||
GameServer()->CreateSound(m_Pos, SOUND_WEAPON_NOAMMO);*/
|
||||
return;
|
||||
}
|
||||
|
||||
vec2 ProjStartPos = m_Pos + Direction * GetProximityRadius() * 0.75f;
|
||||
|
||||
|
@ -437,8 +432,6 @@ void CCharacter::FireWeapon()
|
|||
Dir = normalize(pTarget->m_Pos - m_Pos);
|
||||
else
|
||||
Dir = vec2(0.f, -1.f);
|
||||
/*pTarget->TakeDamage(vec2(0.f, -1.f) + normalize(Dir + vec2(0.f, -1.1f)) * 10.0f, g_pData->m_Weapons.m_Hammer.m_pBase->m_Damage,
|
||||
m_pPlayer->GetCID(), m_Core.m_ActiveWeapon);*/
|
||||
|
||||
float Strength;
|
||||
if(!m_TuneZone)
|
||||
|
@ -504,24 +497,6 @@ void CCharacter::FireWeapon()
|
|||
|
||||
case WEAPON_SHOTGUN:
|
||||
{
|
||||
/*int ShotSpread = 2;
|
||||
|
||||
for(int i = -ShotSpread; i <= ShotSpread; ++i)
|
||||
{
|
||||
float Spreading[] = {-0.185f, -0.070f, 0, 0.070f, 0.185f};
|
||||
float a = angle(Direction);
|
||||
a += Spreading[i+2];
|
||||
float v = 1-(absolute(i)/(float)ShotSpread);
|
||||
float Speed = mix((float)GameServer()->Tuning()->m_ShotgunSpeeddiff, 1.0f, v);
|
||||
CProjectile *pProj = new CProjectile(GameWorld(), WEAPON_SHOTGUN,
|
||||
m_pPlayer->GetCID(),
|
||||
ProjStartPos,
|
||||
vec2(cosf(a), sinf(a))*Speed,
|
||||
(int)(Server()->TickSpeed()*GameServer()->Tuning()->m_ShotgunLifetime),
|
||||
1, 0, 0, -1);
|
||||
}
|
||||
|
||||
GameServer()->CreateSound(m_Pos, SOUND_SHOTGUN_FIRE);*/
|
||||
float LaserReach;
|
||||
if(!m_TuneZone)
|
||||
LaserReach = GameServer()->Tuning()->m_LaserReach;
|
||||
|
@ -587,9 +562,6 @@ void CCharacter::FireWeapon()
|
|||
|
||||
m_AttackTick = Server()->Tick();
|
||||
|
||||
/*if(m_Core.m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo > 0) // -1 == unlimited
|
||||
m_Core.m_aWeapons[m_Core.m_ActiveWeapon].m_Ammo--;*/
|
||||
|
||||
if(!m_ReloadTimer)
|
||||
{
|
||||
float FireDelay;
|
||||
|
@ -698,7 +670,6 @@ void CCharacter::ResetHook()
|
|||
void CCharacter::ResetInput()
|
||||
{
|
||||
m_Input.m_Direction = 0;
|
||||
//m_Input.m_Hook = 0;
|
||||
// simulate releasing the fire button
|
||||
if((m_Input.m_Fire & 1) != 0)
|
||||
m_Input.m_Fire++;
|
||||
|
@ -709,15 +680,6 @@ void CCharacter::ResetInput()
|
|||
|
||||
void CCharacter::Tick()
|
||||
{
|
||||
/*if(m_pPlayer->m_ForceBalanced)
|
||||
{
|
||||
char Buf[128];
|
||||
str_format(Buf, sizeof(Buf), "You were moved to %s due to team balancing", GameServer()->m_pController->GetTeamName(m_pPlayer->GetTeam()));
|
||||
GameServer()->SendBroadcast(Buf, m_pPlayer->GetCID());
|
||||
|
||||
m_pPlayer->m_ForceBalanced = false;
|
||||
}*/
|
||||
|
||||
if(m_StartTime > Server()->Tick())
|
||||
{
|
||||
// Prevent the player from getting a negative time
|
||||
|
@ -937,92 +899,6 @@ void CCharacter::Die(int Killer, int Weapon)
|
|||
|
||||
bool CCharacter::TakeDamage(vec2 Force, int Dmg, int From, int Weapon)
|
||||
{
|
||||
/*m_Core.m_Vel += Force;
|
||||
|
||||
if(GameServer()->m_pController->IsFriendlyFire(m_pPlayer->GetCID(), From) && !g_Config.m_SvTeamdamage)
|
||||
return false;
|
||||
|
||||
// m_pPlayer only inflicts half damage on self
|
||||
if(From == m_pPlayer->GetCID())
|
||||
Dmg = maximum(1, Dmg/2);
|
||||
|
||||
m_DamageTaken++;
|
||||
|
||||
// create healthmod indicator
|
||||
if(Server()->Tick() < m_DamageTakenTick+25)
|
||||
{
|
||||
// make sure that the damage indicators doesn't group together
|
||||
GameServer()->CreateDamageInd(m_Pos, m_DamageTaken*0.25f, Dmg);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DamageTaken = 0;
|
||||
GameServer()->CreateDamageInd(m_Pos, 0, Dmg);
|
||||
}
|
||||
|
||||
if(Dmg)
|
||||
{
|
||||
if(m_Armor)
|
||||
{
|
||||
if(Dmg > 1)
|
||||
{
|
||||
m_Health--;
|
||||
Dmg--;
|
||||
}
|
||||
|
||||
if(Dmg > m_Armor)
|
||||
{
|
||||
Dmg -= m_Armor;
|
||||
m_Armor = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Armor -= Dmg;
|
||||
Dmg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
m_Health -= Dmg;
|
||||
}
|
||||
|
||||
m_DamageTakenTick = Server()->Tick();
|
||||
|
||||
// do damage Hit sound
|
||||
if(From >= 0 && From != m_pPlayer->GetCID() && GameServer()->m_apPlayers[From])
|
||||
{
|
||||
int64_t Mask = CmaskOne(From);
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS && GameServer()->m_apPlayers[i]->m_SpectatorID == From)
|
||||
Mask |= CmaskOne(i);
|
||||
}
|
||||
GameServer()->CreateSound(GameServer()->m_apPlayers[From]->m_ViewPos, SOUND_HIT, Mask);
|
||||
}
|
||||
|
||||
// check for death
|
||||
if(m_Health <= 0)
|
||||
{
|
||||
Die(From, Weapon);
|
||||
|
||||
// set attacker's face to happy (taunt!)
|
||||
if (From >= 0 && From != m_pPlayer->GetCID() && GameServer()->m_apPlayers[From])
|
||||
{
|
||||
CCharacter *pChr = GameServer()->m_apPlayers[From]->GetCharacter();
|
||||
if (pChr)
|
||||
{
|
||||
pChr->m_EmoteType = EMOTE_HAPPY;
|
||||
pChr->m_EmoteStop = Server()->Tick() + Server()->TickSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Dmg > 2)
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PLAYER_PAIN_LONG);
|
||||
else
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PLAYER_PAIN_SHORT);*/
|
||||
|
||||
if(Dmg)
|
||||
{
|
||||
m_EmoteType = EMOTE_PAIN;
|
||||
|
|
|
@ -27,29 +27,12 @@ CPickup::CPickup(CGameWorld *pGameWorld, int Type, int SubType, int Layer, int N
|
|||
|
||||
void CPickup::Reset()
|
||||
{
|
||||
/*if (g_pData->m_aPickups[m_Type].m_Spawndelay > 0)
|
||||
m_SpawnTick = Server()->Tick() + Server()->TickSpeed() * g_pData->m_aPickups[m_Type].m_Spawndelay;
|
||||
else
|
||||
m_SpawnTick = -1;*/
|
||||
}
|
||||
|
||||
void CPickup::Tick()
|
||||
{
|
||||
Move();
|
||||
/*// wait for respawn
|
||||
if(m_SpawnTick > 0)
|
||||
{
|
||||
if(Server()->Tick() > m_SpawnTick)
|
||||
{
|
||||
// respawn
|
||||
m_SpawnTick = -1;
|
||||
|
||||
if(m_Type == POWERUP_WEAPON)
|
||||
GameServer()->CreateSound(m_Pos, SOUND_WEAPON_SPAWN);
|
||||
}
|
||||
else
|
||||
return;
|
||||
}*/
|
||||
// Check if a player intersected us
|
||||
CCharacter *apEnts[MAX_CLIENTS];
|
||||
int Num = GameWorld()->FindEntities(m_Pos, 20.0f, (CEntity **)apEnts, MAX_CLIENTS, CGameWorld::ENTTYPE_CHARACTER);
|
||||
|
@ -150,8 +133,6 @@ void CPickup::Tick()
|
|||
{
|
||||
pChr->GiveWeapon(m_Subtype);
|
||||
|
||||
//RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
|
||||
|
||||
if(m_Subtype == WEAPON_GRENADE)
|
||||
GameServer()->CreateSound(m_Pos, SOUND_PICKUP_GRENADE, pChr->TeamMask());
|
||||
else if(m_Subtype == WEAPON_SHOTGUN)
|
||||
|
@ -168,37 +149,17 @@ void CPickup::Tick()
|
|||
{
|
||||
// activate ninja on target player
|
||||
pChr->GiveNinja();
|
||||
//RespawnTime = g_pData->m_aPickups[m_Type].m_Respawntime;
|
||||
|
||||
/*// loop through all players, setting their emotes
|
||||
CCharacter *pC = static_cast<CCharacter *>(GameServer()->m_World.FindFirst(CGameWorld::ENTTYPE_CHARACTER));
|
||||
for(; pC; pC = (CCharacter *)pC->TypeNext())
|
||||
{
|
||||
if (pC != pChr)
|
||||
pC->SetEmote(EMOTE_SURPRISE, Server()->Tick() + Server()->TickSpeed());
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
/*if(RespawnTime >= 0)
|
||||
{
|
||||
char aBuf[256];
|
||||
str_format(aBuf, sizeof(aBuf), "pickup player='%d:%s' item=%d/%d",
|
||||
pChr->GetPlayer()->GetCID(), Server()->ClientName(pChr->GetPlayer()->GetCID()), m_Type, m_Subtype);
|
||||
GameServer()->Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
|
||||
m_SpawnTick = Server()->Tick() + Server()->TickSpeed() * RespawnTime;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPickup::TickPaused()
|
||||
{
|
||||
/*if(m_SpawnTick != -1)
|
||||
++m_SpawnTick;*/
|
||||
}
|
||||
|
||||
void CPickup::Snap(int SnappingClient)
|
||||
|
|
|
@ -2584,10 +2584,6 @@ void CGameContext::ConToggleTuneParam(IConsole::IResult *pResult, void *pUserDat
|
|||
void CGameContext::ConTuneReset(IConsole::IResult *pResult, void *pUserData)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
/*CTuningParams TuningParams;
|
||||
*pSelf->Tuning() = TuningParams;
|
||||
pSelf->SendTuningParams(-1);
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", "Tuning reset");*/
|
||||
pSelf->ResetTuning();
|
||||
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "tuning", "Tuning reset");
|
||||
}
|
||||
|
|
|
@ -138,9 +138,6 @@ void Run(unsigned short Port, NETADDR Dest)
|
|||
}
|
||||
}
|
||||
|
||||
//
|
||||
/*while(1)
|
||||
{*/
|
||||
CPacket *p = 0;
|
||||
CPacket *pNext = m_pFirst;
|
||||
while(true)
|
||||
|
@ -170,15 +167,7 @@ void Run(unsigned short Port, NETADDR Dest)
|
|||
else
|
||||
m_pFirst = p->m_pNext;
|
||||
|
||||
/*CPacket *cur = first;
|
||||
while(cur)
|
||||
{
|
||||
dbg_assert(cur != p, "p still in list");
|
||||
cur = cur->next;
|
||||
}*/
|
||||
|
||||
// send and remove packet
|
||||
//if((rand()%20) != 0) // heavy packetloss
|
||||
net_udp_send(Socket, &p->m_SendTo, p->m_aData, p->m_DataSize);
|
||||
|
||||
// update lag
|
||||
|
|
Loading…
Reference in a new issue