forked from Mirrors/openclonk
C4Landscape: Pull everything private out of the header
Since LTCG is enabled now, we don't have to define every function inside the headers for ~xXx super speed xXx~, which means we can strip the headers down to their bare minimum and reduce interdependencies and therefore recompilation times by a lot.liquid_container
parent
9e9c5d0c06
commit
735f9cc06b
|
@ -1373,7 +1373,7 @@ void C4ControlEMMoveObject::CompileFunc(StdCompiler *pComp)
|
|||
|
||||
// *** C4ControlEMDrawTool
|
||||
|
||||
C4ControlEMDrawTool::C4ControlEMDrawTool(C4ControlEMDrawAction eAction, int32_t iMode,
|
||||
C4ControlEMDrawTool::C4ControlEMDrawTool(C4ControlEMDrawAction eAction, LandscapeMode iMode,
|
||||
int32_t iX, int32_t iY, int32_t iX2, int32_t iY2, int32_t iGrade,
|
||||
const char *szMaterial, const char *szTexture, const char *szBackMaterial, const char *szBackTexture)
|
||||
: eAction(eAction), iMode(iMode), iX(iX), iY(iY), iX2(iX2), iY2(iY2), iGrade(iGrade),
|
||||
|
@ -1392,8 +1392,8 @@ void C4ControlEMDrawTool::Execute() const
|
|||
return;
|
||||
}
|
||||
// check current mode
|
||||
assert(::Landscape.Mode == iMode);
|
||||
if (::Landscape.Mode != iMode) return;
|
||||
assert(::Landscape.GetMode() == iMode);
|
||||
if (::Landscape.GetMode() != iMode) return;
|
||||
// assert validity of parameters
|
||||
if (!Material.getSize()) return;
|
||||
const char *szMaterial = Material.getData(),
|
||||
|
@ -1436,7 +1436,7 @@ void C4ControlEMDrawTool::Execute() const
|
|||
void C4ControlEMDrawTool::CompileFunc(StdCompiler *pComp)
|
||||
{
|
||||
pComp->Value(mkNamingAdapt(mkIntAdaptT<uint8_t>(eAction), "Action"));
|
||||
pComp->Value(mkNamingAdapt(mkIntPackAdapt(iMode), "Mode", 0));
|
||||
pComp->Value(mkNamingAdapt(mkIntAdaptT<uint8_t>(iMode), "Mode", LandscapeMode::Undefined));
|
||||
pComp->Value(mkNamingAdapt(iX, "X", 0));
|
||||
pComp->Value(mkNamingAdapt(iY, "Y", 0));
|
||||
pComp->Value(mkNamingAdapt(iX2, "X2", 0));
|
||||
|
|
|
@ -486,17 +486,18 @@ enum C4ControlEMDrawAction
|
|||
EMDT_Rect // drawing tool
|
||||
};
|
||||
|
||||
enum class LandscapeMode;
|
||||
class C4ControlEMDrawTool : public C4ControlPacket // sync
|
||||
{
|
||||
public:
|
||||
C4ControlEMDrawTool() : eAction(EMDT_SetMode), iX(0), iY(0), iX2(0), iY2(0), iGrade(0) { }
|
||||
C4ControlEMDrawTool(C4ControlEMDrawAction eAction, int32_t iMode,
|
||||
C4ControlEMDrawTool(C4ControlEMDrawAction eAction, LandscapeMode iMode,
|
||||
int32_t iX=-1, int32_t iY=-1, int32_t iX2=-1, int32_t iY2=-1, int32_t iGrade=-1,
|
||||
const char *szMaterial=NULL, const char *szTexture=NULL,
|
||||
const char *szBackMaterial=NULL, const char *szBackTexture=NULL);
|
||||
protected:
|
||||
C4ControlEMDrawAction eAction; // action to be performed
|
||||
int32_t iMode; // new mode, or mode action was performed in (action will fail if changed)
|
||||
LandscapeMode iMode; // new mode, or mode action was performed in (action will fail if changed)
|
||||
int32_t iX,iY,iX2,iY2,iGrade; // drawing parameters
|
||||
StdStrBuf Material; // used material
|
||||
StdStrBuf Texture; // used texture
|
||||
|
|
|
@ -139,12 +139,12 @@ bool C4GameSave::SaveScenarioSections()
|
|||
bool C4GameSave::SaveLandscape()
|
||||
{
|
||||
// exact?
|
||||
if (::Landscape.Mode == C4LSC_Exact || GetForceExactLandscape())
|
||||
if (::Landscape.GetMode() == LandscapeMode::Exact || GetForceExactLandscape())
|
||||
{
|
||||
C4DebugRecOff DBGRECOFF;
|
||||
// Landscape
|
||||
bool fSuccess;
|
||||
if (::Landscape.Mode == C4LSC_Exact)
|
||||
if (::Landscape.GetMode() == LandscapeMode::Exact)
|
||||
fSuccess = !!::Landscape.Save(*pSaveGroup);
|
||||
else
|
||||
fSuccess = !!::Landscape.SaveDiff(*pSaveGroup, !IsSynced());
|
||||
|
@ -160,7 +160,7 @@ bool C4GameSave::SaveLandscape()
|
|||
if (!::MaterialMap.SaveEnumeration(*pSaveGroup)) return false;
|
||||
}
|
||||
// static / dynamic
|
||||
if (::Landscape.Mode == C4LSC_Static)
|
||||
if (::Landscape.GetMode() == LandscapeMode::Static)
|
||||
{
|
||||
// static map
|
||||
// remove old-style landscape.bmp
|
||||
|
@ -174,7 +174,7 @@ bool C4GameSave::SaveLandscape()
|
|||
if (!::Landscape.SaveTextures(*pSaveGroup)) return false;
|
||||
}
|
||||
}
|
||||
else if (::Landscape.Mode != C4LSC_Exact)
|
||||
else if (::Landscape.GetMode() != LandscapeMode::Exact)
|
||||
{
|
||||
// dynamic map by landscape.txt or scenario core: nothing to save
|
||||
// in fact, it doesn't even make much sense to save the Objects.txt
|
||||
|
|
|
@ -189,7 +189,7 @@ bool C4Console::SaveScenario(const char * path)
|
|||
SetCursor(C4ConsoleGUI::CURSOR_Wait);
|
||||
|
||||
bool fOkay=true;
|
||||
C4GameSave *pGameSave = new C4GameSaveScenario(!Console.Active || ::Landscape.Mode==C4LSC_Exact, false);
|
||||
C4GameSave *pGameSave = new C4GameSaveScenario(!Console.Active || ::Landscape.GetMode() == LandscapeMode::Exact, false);
|
||||
if (!pGameSave->Save(Game.ScenarioFile, false))
|
||||
{ Out("Game::Save failed"); fOkay=false; }
|
||||
delete pGameSave;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <C4Language.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4Landscape.h>
|
||||
#include "landscape/C4Sky.h"
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4GameControl.h>
|
||||
|
@ -221,7 +222,7 @@ void C4ToolsDlg::UpdateTextures()
|
|||
[texturesPopup removeAllItems];
|
||||
// bottom-most: any invalid textures
|
||||
bool fAnyEntry = false; int32_t cnt; const char *szTexture;
|
||||
if (::Landscape.Mode!=C4LSC_Exact)
|
||||
if (::Landscape.GetMode()!=LandscapeMode::Exact)
|
||||
for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++)
|
||||
{
|
||||
if (!::TextureMap.GetIndex(Material, szTexture, false))
|
||||
|
@ -240,7 +241,7 @@ void C4ToolsDlg::UpdateTextures()
|
|||
for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++)
|
||||
{
|
||||
// Current material-texture valid? Always valid for exact mode
|
||||
if (::TextureMap.GetIndex(Material,szTexture,false) || ::Landscape.Mode==C4LSC_Exact)
|
||||
if (::TextureMap.GetIndex(Material,szTexture,false) || ::Landscape.GetMode()==LandscapeMode::Exact)
|
||||
{
|
||||
[texturesPopup insertItemWithTitle:[NSString stringWithUTF8String:szTexture] atIndex:0];
|
||||
}
|
||||
|
@ -295,7 +296,7 @@ CGImageRef C4ToolsDlg::State::CreatePreviewImage()
|
|||
// Sky material: sky as pattern only
|
||||
if (SEqual(GetOwner()->Material,C4TLS_MatSky))
|
||||
{
|
||||
Pattern.Set(::Landscape.Sky.Surface, 0);
|
||||
Pattern.Set(::Landscape.GetSky().Surface, 0);
|
||||
}
|
||||
// Material-Texture
|
||||
else
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <C4Object.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4Landscape.h>
|
||||
#include "landscape/C4Sky.h"
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4GameControl.h>
|
||||
|
@ -1266,7 +1267,7 @@ void C4ToolsDlg::UpdateTextures()
|
|||
|
||||
// bottom-most: any invalid textures
|
||||
bool fAnyEntry = false; int32_t cnt; const char *szTexture;
|
||||
if (::Landscape.Mode!=C4LSC_Exact)
|
||||
if (::Landscape.GetMode()!=LandscapeMode::Exact)
|
||||
for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++)
|
||||
{
|
||||
if (!::TextureMap.GetIndex(material, szTexture, false))
|
||||
|
@ -1285,7 +1286,7 @@ void C4ToolsDlg::UpdateTextures()
|
|||
for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++)
|
||||
{
|
||||
// Current material-texture valid? Always valid for exact mode
|
||||
if (::TextureMap.GetIndex(material,szTexture,false) || ::Landscape.Mode==C4LSC_Exact)
|
||||
if (::TextureMap.GetIndex(material,szTexture,false) || ::Landscape.GetMode()==LandscapeMode::Exact)
|
||||
{
|
||||
gtk_combo_box_text_prepend_text(GTK_COMBO_BOX_TEXT(box), szTexture);
|
||||
}
|
||||
|
@ -1324,7 +1325,7 @@ void C4ToolsDlg::State::UpdatePreview()
|
|||
// Sky material: sky as pattern only
|
||||
if (SEqual(dlg->Material,C4TLS_MatSky))
|
||||
{
|
||||
Pattern.Set(::Landscape.Sky.Surface, 0);
|
||||
Pattern.Set(::Landscape.GetSky().Surface, 0);
|
||||
}
|
||||
// Material-Texture
|
||||
else
|
||||
|
@ -1373,24 +1374,24 @@ void C4ToolsDlg::UpdateLandscapeModeCtrls()
|
|||
|
||||
void C4ToolsDlg::State::UpdateLandscapeModeCtrls()
|
||||
{
|
||||
int32_t iMode = ::Landscape.Mode;
|
||||
LandscapeMode iMode = ::Landscape.GetMode();
|
||||
g_signal_handler_block(landscape_dynamic, handlerDynamic);
|
||||
g_signal_handler_block(landscape_static, handlerStatic);
|
||||
g_signal_handler_block(landscape_exact, handlerExact);
|
||||
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(landscape_dynamic), iMode==C4LSC_Dynamic);
|
||||
gtk_widget_set_sensitive(landscape_dynamic, iMode==C4LSC_Dynamic);
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(landscape_dynamic), iMode==LandscapeMode::Dynamic);
|
||||
gtk_widget_set_sensitive(landscape_dynamic, iMode==LandscapeMode::Dynamic);
|
||||
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(landscape_static), iMode==C4LSC_Static);
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(landscape_static), iMode==LandscapeMode::Static);
|
||||
gtk_widget_set_sensitive(landscape_static, ::Landscape.HasMap());
|
||||
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(landscape_exact), iMode==C4LSC_Exact);
|
||||
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(landscape_exact), iMode==LandscapeMode::Exact);
|
||||
|
||||
g_signal_handler_unblock(landscape_dynamic, handlerDynamic);
|
||||
g_signal_handler_unblock(landscape_static, handlerStatic);
|
||||
g_signal_handler_unblock(landscape_exact, handlerExact);
|
||||
|
||||
C4DevmodeDlg::SetTitle(hbox, LoadResStr(iMode==C4LSC_Dynamic ? "IDS_DLG_DYNAMIC" : iMode==C4LSC_Static ? "IDS_DLG_STATIC" : "IDS_DLG_EXACT"));
|
||||
C4DevmodeDlg::SetTitle(hbox, LoadResStr(iMode==LandscapeMode::Dynamic ? "IDS_DLG_DYNAMIC" : iMode==LandscapeMode::Static ? "IDS_DLG_STATIC" : "IDS_DLG_EXACT"));
|
||||
}
|
||||
|
||||
void C4ToolsDlg::UpdateIFTControls()
|
||||
|
@ -1441,18 +1442,18 @@ void C4ConsoleGUI::SetCaptionToFileName(const char* file_name)
|
|||
|
||||
void C4ToolsDlg::EnableControls()
|
||||
{
|
||||
int32_t iLandscapeMode=::Landscape.Mode;
|
||||
gtk_widget_set_sensitive(state->brush, iLandscapeMode>=C4LSC_Static);
|
||||
gtk_widget_set_sensitive(state->line, iLandscapeMode>=C4LSC_Static);
|
||||
gtk_widget_set_sensitive(state->rect, iLandscapeMode>=C4LSC_Static);
|
||||
gtk_widget_set_sensitive(state->fill, iLandscapeMode>=C4LSC_Exact);
|
||||
gtk_widget_set_sensitive(state->picker, iLandscapeMode>=C4LSC_Static);
|
||||
gtk_widget_set_sensitive(state->fg_materials, iLandscapeMode>=C4LSC_Static);
|
||||
gtk_widget_set_sensitive(state->fg_textures, iLandscapeMode >= C4LSC_Static && !SEqual(Material,C4TLS_MatSky));
|
||||
gtk_widget_set_sensitive(state->bg_materials, iLandscapeMode>=C4LSC_Static && !SEqual(Material,C4TLS_MatSky));
|
||||
gtk_widget_set_sensitive(state->bg_textures, iLandscapeMode >= C4LSC_Static && !SEqual(Material,C4TLS_MatSky) && !SEqual(BackMaterial, C4TLS_MatSky));
|
||||
gtk_widget_set_sensitive(state->scale, iLandscapeMode>=C4LSC_Static);
|
||||
gtk_widget_set_sensitive(state->preview, iLandscapeMode>=C4LSC_Static);
|
||||
LandscapeMode iLandscapeMode=::Landscape.GetMode();
|
||||
gtk_widget_set_sensitive(state->brush, iLandscapeMode>=LandscapeMode::Static);
|
||||
gtk_widget_set_sensitive(state->line, iLandscapeMode>=LandscapeMode::Static);
|
||||
gtk_widget_set_sensitive(state->rect, iLandscapeMode>=LandscapeMode::Static);
|
||||
gtk_widget_set_sensitive(state->fill, iLandscapeMode>=LandscapeMode::Exact);
|
||||
gtk_widget_set_sensitive(state->picker, iLandscapeMode>=LandscapeMode::Static);
|
||||
gtk_widget_set_sensitive(state->fg_materials, iLandscapeMode>=LandscapeMode::Static);
|
||||
gtk_widget_set_sensitive(state->fg_textures, iLandscapeMode >= LandscapeMode::Static && !SEqual(Material,C4TLS_MatSky));
|
||||
gtk_widget_set_sensitive(state->bg_materials, iLandscapeMode>=LandscapeMode::Static && !SEqual(Material,C4TLS_MatSky));
|
||||
gtk_widget_set_sensitive(state->bg_textures, iLandscapeMode >= LandscapeMode::Static && !SEqual(Material,C4TLS_MatSky) && !SEqual(BackMaterial, C4TLS_MatSky));
|
||||
gtk_widget_set_sensitive(state->scale, iLandscapeMode>=LandscapeMode::Static);
|
||||
gtk_widget_set_sensitive(state->preview, iLandscapeMode>=LandscapeMode::Static);
|
||||
NeedPreviewUpdate();
|
||||
}
|
||||
|
||||
|
@ -1588,17 +1589,17 @@ void C4ConsoleGUI::State::OnNetClient(GtkWidget* item, gpointer data)
|
|||
|
||||
void C4ToolsDlg::State::OnButtonModeDynamic(GtkWidget* widget, gpointer data)
|
||||
{
|
||||
static_cast<C4ToolsDlg::State*>(data)->GetOwner()->SetLandscapeMode(C4LSC_Dynamic);
|
||||
static_cast<C4ToolsDlg::State*>(data)->GetOwner()->SetLandscapeMode(LandscapeMode::Dynamic);
|
||||
}
|
||||
|
||||
void C4ToolsDlg::State::OnButtonModeStatic(GtkWidget* widget, gpointer data)
|
||||
{
|
||||
static_cast<C4ToolsDlg::State*>(data)->GetOwner()->SetLandscapeMode(C4LSC_Static);
|
||||
static_cast<C4ToolsDlg::State*>(data)->GetOwner()->SetLandscapeMode(LandscapeMode::Static);
|
||||
}
|
||||
|
||||
void C4ToolsDlg::State::OnButtonModeExact(GtkWidget* widget, gpointer data)
|
||||
{
|
||||
static_cast<C4ToolsDlg::State*>(data)->GetOwner()->SetLandscapeMode(C4LSC_Exact);
|
||||
static_cast<C4ToolsDlg::State*>(data)->GetOwner()->SetLandscapeMode(LandscapeMode::Exact);
|
||||
}
|
||||
|
||||
void C4ToolsDlg::State::OnButtonBrush(GtkWidget* widget, gpointer data)
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "C4Viewport.h"
|
||||
#include <StdRegistry.h>
|
||||
#include "lib/StdColors.h"
|
||||
#include "landscape/C4Sky.h"
|
||||
|
||||
#include <C4windowswrapper.h>
|
||||
#include <mmsystem.h>
|
||||
|
@ -630,15 +631,15 @@ INT_PTR CALLBACK ToolsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
|
|||
return true;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case IDC_BUTTONMODEDYNAMIC:
|
||||
Console.ToolsDlg.SetLandscapeMode(C4LSC_Dynamic);
|
||||
Console.ToolsDlg.SetLandscapeMode(LandscapeMode::Dynamic);
|
||||
return true;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case IDC_BUTTONMODESTATIC:
|
||||
Console.ToolsDlg.SetLandscapeMode(C4LSC_Static);
|
||||
Console.ToolsDlg.SetLandscapeMode(LandscapeMode::Static);
|
||||
return true;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case IDC_BUTTONMODEEXACT:
|
||||
Console.ToolsDlg.SetLandscapeMode(C4LSC_Exact);
|
||||
Console.ToolsDlg.SetLandscapeMode(LandscapeMode::Exact);
|
||||
return true;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case IDC_BUTTONBRUSH:
|
||||
|
@ -1251,7 +1252,7 @@ void C4ToolsDlg::UpdateTextures()
|
|||
SendDlgItemMessage(state->hDialog, box, CB_RESETCONTENT, 0, (LPARAM)0);
|
||||
// bottom-most: any invalid textures
|
||||
bool fAnyEntry = false; int32_t cnt; const char *szTexture;
|
||||
if (::Landscape.Mode != C4LSC_Exact)
|
||||
if (::Landscape.GetMode() != LandscapeMode::Exact)
|
||||
for (cnt = 0; (szTexture = ::TextureMap.GetTexture(cnt)); cnt++)
|
||||
{
|
||||
if (!::TextureMap.GetIndex(material, szTexture, false))
|
||||
|
@ -1275,7 +1276,7 @@ void C4ToolsDlg::UpdateTextures()
|
|||
for (cnt = 0; (szTexture = ::TextureMap.GetTexture(cnt)); cnt++)
|
||||
{
|
||||
// Current material-texture valid? Always valid for exact mode
|
||||
if (::TextureMap.GetIndex(material, szTexture, false) || ::Landscape.Mode == C4LSC_Exact)
|
||||
if (::TextureMap.GetIndex(material, szTexture, false) || ::Landscape.GetMode() == LandscapeMode::Exact)
|
||||
{
|
||||
SendDlgItemMessage(state->hDialog, box, CB_INSERTSTRING, 0, GetWideLPARAM(szTexture));
|
||||
}
|
||||
|
@ -1311,7 +1312,7 @@ void C4ToolsDlg::NeedPreviewUpdate()
|
|||
// Sky material: sky as pattern only
|
||||
if (SEqual(Material,C4TLS_MatSky))
|
||||
{
|
||||
Pattern.Set(::Landscape.Sky.Surface, 0);
|
||||
Pattern.Set(::Landscape.GetSky().Surface, 0);
|
||||
}
|
||||
// Material-Texture
|
||||
else
|
||||
|
@ -1375,52 +1376,52 @@ void C4ToolsDlg::UpdateIFTControls()
|
|||
|
||||
void C4ToolsDlg::UpdateLandscapeModeCtrls()
|
||||
{
|
||||
int32_t iMode = ::Landscape.Mode;
|
||||
LandscapeMode iMode = ::Landscape.GetMode();
|
||||
// Dynamic: enable only if dynamic anyway
|
||||
SendDlgItemMessage(state->hDialog,IDC_BUTTONMODEDYNAMIC,BM_SETSTATE,(iMode==C4LSC_Dynamic),0);
|
||||
EnableWindow(GetDlgItem(state->hDialog,IDC_BUTTONMODEDYNAMIC),(iMode==C4LSC_Dynamic));
|
||||
SendDlgItemMessage(state->hDialog,IDC_BUTTONMODEDYNAMIC,BM_SETSTATE,(iMode==LandscapeMode::Dynamic),0);
|
||||
EnableWindow(GetDlgItem(state->hDialog,IDC_BUTTONMODEDYNAMIC),(iMode==LandscapeMode::Dynamic));
|
||||
UpdateWindow(GetDlgItem(state->hDialog,IDC_BUTTONMODEDYNAMIC));
|
||||
// Static: enable only if map available
|
||||
SendDlgItemMessage(state->hDialog,IDC_BUTTONMODESTATIC,BM_SETSTATE,(iMode==C4LSC_Static),0);
|
||||
SendDlgItemMessage(state->hDialog,IDC_BUTTONMODESTATIC,BM_SETSTATE,(iMode==LandscapeMode::Static),0);
|
||||
EnableWindow(GetDlgItem(state->hDialog,IDC_BUTTONMODESTATIC),(::Landscape.HasMap()));
|
||||
UpdateWindow(GetDlgItem(state->hDialog,IDC_BUTTONMODESTATIC));
|
||||
// Exact: enable always
|
||||
SendDlgItemMessage(state->hDialog,IDC_BUTTONMODEEXACT,BM_SETSTATE,(iMode==C4LSC_Exact),0);
|
||||
SendDlgItemMessage(state->hDialog,IDC_BUTTONMODEEXACT,BM_SETSTATE,(iMode==LandscapeMode::Exact),0);
|
||||
UpdateWindow(GetDlgItem(state->hDialog,IDC_BUTTONMODEEXACT));
|
||||
// Set dialog caption
|
||||
SetWindowTextW(state->hDialog,LoadResStrW(iMode==C4LSC_Dynamic ? "IDS_DLG_DYNAMIC" : iMode==C4LSC_Static ? "IDS_DLG_STATIC" : "IDS_DLG_EXACT"));
|
||||
SetWindowTextW(state->hDialog,LoadResStrW(iMode==LandscapeMode::Dynamic ? "IDS_DLG_DYNAMIC" : iMode==LandscapeMode::Static ? "IDS_DLG_STATIC" : "IDS_DLG_EXACT"));
|
||||
}
|
||||
|
||||
|
||||
void C4ToolsDlg::EnableControls()
|
||||
{
|
||||
HWND hDialog = state->hDialog;
|
||||
int32_t iLandscapeMode=::Landscape.Mode;
|
||||
LandscapeMode iLandscapeMode = ::Landscape.GetMode();
|
||||
// Set bitmap buttons
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONBRUSH,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? state->hbmBrush : state->hbmBrush2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONLINE,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? state->hbmLine : state->hbmLine2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONRECT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? state->hbmRect : state->hbmRect2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONFILL,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Exact) ? state->hbmFill : state->hbmFill2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONPICKER,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=C4LSC_Static) ? state->hbmPicker : state->hbmPicker2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONBRUSH,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=LandscapeMode::Static) ? state->hbmBrush : state->hbmBrush2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONLINE,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=LandscapeMode::Static) ? state->hbmLine : state->hbmLine2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONRECT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=LandscapeMode::Static) ? state->hbmRect : state->hbmRect2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONFILL,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=LandscapeMode::Exact) ? state->hbmFill : state->hbmFill2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONPICKER,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)((iLandscapeMode>=LandscapeMode::Static) ? state->hbmPicker : state->hbmPicker2));
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONMODEDYNAMIC,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)state->hbmDynamic);
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONMODESTATIC,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)state->hbmStatic);
|
||||
SendDlgItemMessage(hDialog,IDC_BUTTONMODEEXACT,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)state->hbmExact);
|
||||
// Enable drawing controls
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONBRUSH),(iLandscapeMode>=C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONLINE),(iLandscapeMode>=C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONRECT),(iLandscapeMode>=C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONFILL),(iLandscapeMode>=C4LSC_Exact));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONPICKER),(iLandscapeMode>=C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_COMBOFGMATERIAL),(iLandscapeMode>=C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_COMBOFGTEXTURE),(iLandscapeMode>=C4LSC_Static) && !SEqual(Material,C4TLS_MatSky));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_COMBOBGMATERIAL), (iLandscapeMode >= C4LSC_Static) && !SEqual(Material, C4TLS_MatSky));
|
||||
EnableWindow(GetDlgItem(hDialog, IDC_COMBOBGTEXTURE), (iLandscapeMode >= C4LSC_Static) && !SEqual(Material, C4TLS_MatSky) && !SEqual(BackMaterial, C4TLS_MatSky));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_STATICMATERIAL),(iLandscapeMode>=C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_STATICTEXTURE),(iLandscapeMode>=C4LSC_Static) && !SEqual(Material,C4TLS_MatSky));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_STATICFOREGROUND), (iLandscapeMode >= C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_STATICBACKGROUND), (iLandscapeMode >= C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_SLIDERGRADE),(iLandscapeMode>=C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_PREVIEW),(iLandscapeMode>=C4LSC_Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONBRUSH),(iLandscapeMode>=LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONLINE),(iLandscapeMode>=LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONRECT),(iLandscapeMode>=LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONFILL),(iLandscapeMode>=LandscapeMode::Exact));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_BUTTONPICKER),(iLandscapeMode>=LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_COMBOFGMATERIAL),(iLandscapeMode>=LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_COMBOFGTEXTURE),(iLandscapeMode>=LandscapeMode::Static) && !SEqual(Material,C4TLS_MatSky));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_COMBOBGMATERIAL), (iLandscapeMode >= LandscapeMode::Static) && !SEqual(Material, C4TLS_MatSky));
|
||||
EnableWindow(GetDlgItem(hDialog, IDC_COMBOBGTEXTURE), (iLandscapeMode >= LandscapeMode::Static) && !SEqual(Material, C4TLS_MatSky) && !SEqual(BackMaterial, C4TLS_MatSky));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_STATICMATERIAL),(iLandscapeMode>=LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_STATICTEXTURE),(iLandscapeMode>=LandscapeMode::Static) && !SEqual(Material,C4TLS_MatSky));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_STATICFOREGROUND), (iLandscapeMode >= LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_STATICBACKGROUND), (iLandscapeMode >= LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_SLIDERGRADE),(iLandscapeMode>=LandscapeMode::Static));
|
||||
EnableWindow(GetDlgItem(hDialog,IDC_PREVIEW),(iLandscapeMode>=LandscapeMode::Static));
|
||||
|
||||
NeedPreviewUpdate();
|
||||
}
|
||||
|
|
|
@ -702,7 +702,7 @@ void C4EditCursor::ApplyToolBrush()
|
|||
if (!EditingOK()) return;
|
||||
C4ToolsDlg *pTools=&Console.ToolsDlg;
|
||||
// execute/send control
|
||||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Brush, ::Landscape.Mode, X,Y,0,0, pTools->Grade, pTools->Material, pTools->Texture, pTools->BackMaterial, pTools->BackTexture));
|
||||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Brush, ::Landscape.GetMode(), X,Y,0,0, pTools->Grade, pTools->Material, pTools->Texture, pTools->BackMaterial, pTools->BackTexture));
|
||||
}
|
||||
|
||||
void C4EditCursor::ApplyToolLine()
|
||||
|
@ -710,7 +710,7 @@ void C4EditCursor::ApplyToolLine()
|
|||
if (!EditingOK()) return;
|
||||
C4ToolsDlg *pTools=&Console.ToolsDlg;
|
||||
// execute/send control
|
||||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Line, ::Landscape.Mode, X,Y,X2,Y2, pTools->Grade, pTools->Material,pTools->Texture, pTools->BackMaterial, pTools->BackTexture));
|
||||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Line, ::Landscape.GetMode(), X,Y,X2,Y2, pTools->Grade, pTools->Material,pTools->Texture, pTools->BackMaterial, pTools->BackTexture));
|
||||
}
|
||||
|
||||
void C4EditCursor::ApplyToolRect()
|
||||
|
@ -718,7 +718,7 @@ void C4EditCursor::ApplyToolRect()
|
|||
if (!EditingOK()) return;
|
||||
C4ToolsDlg *pTools=&Console.ToolsDlg;
|
||||
// execute/send control
|
||||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Rect, ::Landscape.Mode, X,Y,X2,Y2, pTools->Grade, pTools->Material, pTools->Texture, pTools->BackMaterial, pTools->BackTexture));
|
||||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Rect, ::Landscape.GetMode(), X,Y,X2,Y2, pTools->Grade, pTools->Material, pTools->Texture, pTools->BackMaterial, pTools->BackTexture));
|
||||
}
|
||||
|
||||
void C4EditCursor::ApplyToolFill()
|
||||
|
@ -726,7 +726,7 @@ void C4EditCursor::ApplyToolFill()
|
|||
if (!EditingOK()) return;
|
||||
C4ToolsDlg *pTools=&Console.ToolsDlg;
|
||||
// execute/send control
|
||||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Fill, ::Landscape.Mode, X,Y,0,Y2, pTools->Grade, pTools->Material, NULL, NULL, NULL));
|
||||
EMControl(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_Fill, ::Landscape.GetMode(), X,Y,0,Y2, pTools->Grade, pTools->Material, NULL, NULL, NULL));
|
||||
}
|
||||
|
||||
void C4EditCursor::AppendMenuItem(int num, const StdStrBuf & label)
|
||||
|
@ -756,9 +756,9 @@ bool C4EditCursor::DoContextMenu(DWORD dwKeyState)
|
|||
#ifdef USE_WIN32_WINDOWS
|
||||
POINT point; GetCursorPos(&point);
|
||||
HMENU hContext = GetSubMenu(hMenu,0);
|
||||
SetMenuItemEnable( hContext, IDM_VIEWPORT_DELETE, fObjectSelected && Console.Editing);
|
||||
SetMenuItemEnable( hContext, IDM_VIEWPORT_DUPLICATE, fObjectSelected && Console.Editing);
|
||||
SetMenuItemEnable( hContext, IDM_VIEWPORT_CONTENTS, fObjectSelected && Selection.GetObject()->Contents.ObjectCount() && Console.Editing);
|
||||
SetMenuItemEnable(hContext, IDM_VIEWPORT_DELETE, fObjectSelected && Console.Editing);
|
||||
SetMenuItemEnable(hContext, IDM_VIEWPORT_DUPLICATE, fObjectSelected && Console.Editing);
|
||||
SetMenuItemEnable(hContext, IDM_VIEWPORT_CONTENTS, fObjectSelected && Selection.GetObject()->Contents.ObjectCount() && Console.Editing);
|
||||
SetMenuItemText(hContext,IDM_VIEWPORT_DELETE,LoadResStr("IDS_MNU_DELETE"));
|
||||
SetMenuItemText(hContext,IDM_VIEWPORT_DUPLICATE,LoadResStr("IDS_MNU_DUPLICATE"));
|
||||
SetMenuItemText(hContext,IDM_VIEWPORT_CONTENTS,LoadResStr("IDS_MNU_CONTENTS"));
|
||||
|
@ -946,13 +946,13 @@ void C4EditCursor::ApplyToolPicker()
|
|||
{
|
||||
int32_t iMaterial;
|
||||
BYTE byIndex;
|
||||
switch (::Landscape.Mode)
|
||||
switch (::Landscape.GetMode())
|
||||
{
|
||||
case C4LSC_Static:
|
||||
case LandscapeMode::Static:
|
||||
{
|
||||
bool material_set = false;
|
||||
int32_t x = X/::Landscape.MapZoom;
|
||||
int32_t y = Y/::Landscape.MapZoom;
|
||||
int32_t x = X/::Landscape.GetMapZoom();
|
||||
int32_t y = Y/::Landscape.GetMapZoom();
|
||||
// Material-texture from map
|
||||
if ((byIndex = ::Landscape.GetMapIndex(x, y)))
|
||||
{
|
||||
|
@ -989,7 +989,7 @@ void C4EditCursor::ApplyToolPicker()
|
|||
if (!material_set) Console.ToolsDlg.SelectMaterial(C4TLS_MatSky);
|
||||
break;
|
||||
}
|
||||
case C4LSC_Exact:
|
||||
case LandscapeMode::Exact:
|
||||
// Material only from landscape
|
||||
if (MatValid(iMaterial=GBackMat(X,Y)))
|
||||
{
|
||||
|
|
|
@ -160,7 +160,7 @@ int indexFromSender(id sender)
|
|||
- (IBAction) selectLandscapeMode:(id)sender
|
||||
{
|
||||
// add one since 0 is "undefined"
|
||||
Console.ToolsDlg.SetLandscapeMode([sender selectedSegment]+1, NO);
|
||||
Console.ToolsDlg.SetLandscapeMode((LandscapeMode)([sender selectedSegment]+1), NO);
|
||||
}
|
||||
|
||||
- (IBAction) setGrade:(id)sender
|
||||
|
|
|
@ -61,7 +61,7 @@ void C4ToolsDlg::SetMaterial(const char *szMaterial)
|
|||
SCopy(szMaterial,Material,C4M_MaxName);
|
||||
AssertValidTexture();
|
||||
EnableControls();
|
||||
if (::Landscape.Mode==C4LSC_Static) UpdateTextures();
|
||||
if (::Landscape.GetMode() == LandscapeMode::Static) UpdateTextures();
|
||||
NeedPreviewUpdate();
|
||||
if (ModeBack && SEqual(szMaterial, C4TLS_MatSky))
|
||||
SelectBackMaterial(C4TLS_MatSky);
|
||||
|
@ -109,7 +109,7 @@ void C4ToolsDlg::SetBackMaterial(const char *szMaterial)
|
|||
SCopy(szMaterial,BackMaterial,C4M_MaxName);
|
||||
AssertValidBackTexture();
|
||||
EnableControls();
|
||||
if (::Landscape.Mode==C4LSC_Static) UpdateTextures();
|
||||
if (::Landscape.GetMode() == LandscapeMode::Static) UpdateTextures();
|
||||
}
|
||||
|
||||
void C4ToolsDlg::SetBackTexture(const char *szTexture)
|
||||
|
@ -177,30 +177,30 @@ bool C4ToolsDlg::ChangeGrade(int32_t iChange)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl)
|
||||
bool C4ToolsDlg::SetLandscapeMode(LandscapeMode mode, bool fThroughControl)
|
||||
{
|
||||
int32_t iLastMode=::Landscape.Mode;
|
||||
auto last_mode = ::Landscape.GetMode();
|
||||
// Exact to static: confirm data loss warning
|
||||
if (iLastMode==C4LSC_Exact)
|
||||
if (iMode==C4LSC_Static)
|
||||
if (last_mode == LandscapeMode::Exact)
|
||||
if (mode == LandscapeMode::Static)
|
||||
if (!fThroughControl)
|
||||
if (!Console.Message(LoadResStr("IDS_CNS_EXACTTOSTATIC"),true))
|
||||
if (!Console.Message(LoadResStr("IDS_CNS_EXACTTOSTATIC"), true))
|
||||
return false;
|
||||
// send as control
|
||||
if (!fThroughControl)
|
||||
{
|
||||
::Control.DoInput(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_SetMode, iMode), CDT_Decide);
|
||||
::Control.DoInput(CID_EMDrawTool, new C4ControlEMDrawTool(EMDT_SetMode, mode), CDT_Decide);
|
||||
return true;
|
||||
}
|
||||
// Set landscape mode
|
||||
::Landscape.SetMode(iMode);
|
||||
::Landscape.SetMode(mode);
|
||||
// Exact to static: redraw landscape from map
|
||||
if (iLastMode==C4LSC_Exact)
|
||||
if (iMode==C4LSC_Static)
|
||||
if (last_mode == LandscapeMode::Exact)
|
||||
if (mode == LandscapeMode::Static)
|
||||
::Landscape.MapToLandscape();
|
||||
// Assert valid tool
|
||||
if (iMode!=C4LSC_Exact)
|
||||
if (SelectedTool==C4TLS_Fill)
|
||||
if (mode != LandscapeMode::Exact)
|
||||
if (SelectedTool == C4TLS_Fill)
|
||||
SetTool(C4TLS_Brush, false);
|
||||
// Update controls
|
||||
UpdateLandscapeModeCtrls();
|
||||
|
@ -213,7 +213,7 @@ bool C4ToolsDlg::SetLandscapeMode(int32_t iMode, bool fThroughControl)
|
|||
void C4ToolsDlg::AssertValidTexture()
|
||||
{
|
||||
// Static map mode only
|
||||
if (::Landscape.Mode!=C4LSC_Static) return;
|
||||
if (::Landscape.GetMode() != LandscapeMode::Static) return;
|
||||
// Ignore if sky
|
||||
if (SEqual(Material,C4TLS_MatSky)) return;
|
||||
// Current material-texture valid
|
||||
|
@ -231,7 +231,7 @@ void C4ToolsDlg::AssertValidTexture()
|
|||
void C4ToolsDlg::AssertValidBackTexture()
|
||||
{
|
||||
// Static map mode only
|
||||
if (::Landscape.Mode!=C4LSC_Static) return;
|
||||
if (::Landscape.GetMode() != LandscapeMode::Static) return;
|
||||
// Ignore if not enabled
|
||||
if (!ModeBack) return;
|
||||
// Ignore if sky
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#endif
|
||||
|
||||
#include "C4Constants.h"
|
||||
#include "landscape/C4Landscape.h"
|
||||
|
||||
const int32_t
|
||||
C4TLS_Brush = 0,
|
||||
|
@ -40,6 +41,7 @@ const int32_t
|
|||
|
||||
#define C4TLS_MatSky "Sky"
|
||||
|
||||
enum class LandscapeMode;
|
||||
class C4ToolsDlg
|
||||
{
|
||||
friend class C4ConsoleGUI;
|
||||
|
@ -70,7 +72,7 @@ public:
|
|||
bool SetGrade(int32_t iGrade);
|
||||
bool SetTool(int32_t iTool, bool fTemp);
|
||||
bool ToggleTool() { return !!SetTool((Tool+1)%4, false); }
|
||||
bool SetLandscapeMode(int32_t iMode, bool fThroughControl=false);
|
||||
bool SetLandscapeMode(LandscapeMode iMode, bool fThroughControl=false);
|
||||
bool SetIFT(bool fIFT);
|
||||
bool ToggleIFT() { return !!SetIFT(!ModeIFT); }
|
||||
bool SelectTexture(const char *szTexture);
|
||||
|
|
|
@ -83,14 +83,14 @@ bool C4Viewport::ScrollBarsByViewPosition()
|
|||
// Vertical
|
||||
scroll.fMask=SIF_ALL;
|
||||
scroll.nMin=0;
|
||||
scroll.nMax = GBackHgt * Zoom;
|
||||
scroll.nMax = ::Landscape.GetHeight() * Zoom;
|
||||
scroll.nPage=ViewHgt;
|
||||
scroll.nPos=int(GetViewY() * Zoom);
|
||||
SetScrollInfo(pWindow->hWindow,SB_VERT,&scroll,true);
|
||||
// Horizontal
|
||||
scroll.fMask=SIF_ALL;
|
||||
scroll.nMin=0;
|
||||
scroll.nMax=GBackWdt * Zoom;
|
||||
scroll.nMax=::Landscape.GetWidth() * Zoom;
|
||||
scroll.nPage=ViewWdt;
|
||||
scroll.nPos = int(GetViewX() * Zoom);
|
||||
SetScrollInfo(pWindow->hWindow,SB_HORZ,&scroll,true);
|
||||
|
@ -129,7 +129,7 @@ bool C4Viewport::ScrollBarsByViewPosition()
|
|||
gtk_adjustment_configure(adjustment,
|
||||
GetViewX(), // value
|
||||
0, // lower
|
||||
GBackWdt, // upper
|
||||
::Landscape.GetWidth(), // upper
|
||||
ViewportScrollSpeed, // step_increment
|
||||
allocation.width / Zoom, // page_increment
|
||||
allocation.width / Zoom // page_size
|
||||
|
@ -139,7 +139,7 @@ bool C4Viewport::ScrollBarsByViewPosition()
|
|||
gtk_adjustment_configure(adjustment,
|
||||
GetViewY(), // value
|
||||
0, // lower
|
||||
GBackHgt, // upper
|
||||
::Landscape.GetHeight(), // upper
|
||||
ViewportScrollSpeed, // step_increment
|
||||
allocation.height / Zoom, // page_increment
|
||||
allocation.height / Zoom // page_size
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Texture.h>
|
||||
#include <C4Landscape.h>
|
||||
#include "landscape/C4Sky.h"
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4GameObjects.h>
|
||||
#include <C4GameControl.h>
|
||||
|
@ -913,7 +914,7 @@ void C4Game::ClearPointers(C4Object * pObj)
|
|||
TransferZones.ClearPointers(pObj);
|
||||
if (pGlobalEffects)
|
||||
pGlobalEffects->ClearPointers(pObj);
|
||||
if (::Landscape.pFoW) ::Landscape.pFoW->Remove(pObj);
|
||||
::Landscape.ClearPointers(pObj);
|
||||
}
|
||||
|
||||
bool C4Game::TogglePause()
|
||||
|
@ -1680,7 +1681,7 @@ void C4Game::CompileFunc(StdCompiler *pComp, CompileSettings comp, C4ValueNumber
|
|||
{
|
||||
pComp->Value(mkNamingAdapt(Weather, "Weather"));
|
||||
pComp->Value(mkNamingAdapt(Landscape, "Landscape"));
|
||||
pComp->Value(mkNamingAdapt(Landscape.Sky, "Sky"));
|
||||
pComp->Value(mkNamingAdapt(Landscape.GetSky(), "Sky"));
|
||||
|
||||
// save custom GUIs only if a real savegame and not for editor-scenario-saves or section changes
|
||||
if (!comp.fScenarioSection)
|
||||
|
@ -2011,7 +2012,7 @@ bool C4Game::QuickSave(const char *strFilename, const char *strTitle, bool fForc
|
|||
|
||||
bool LandscapeFree(int32_t x, int32_t y)
|
||||
{
|
||||
if (!Inside<int32_t>(x,0,GBackWdt-1) || !Inside<int32_t>(y,0,GBackHgt-1)) return false;
|
||||
if (!Inside<int32_t>(x,0,::Landscape.GetWidth()-1) || !Inside<int32_t>(y,0,::Landscape.GetHeight()-1)) return false;
|
||||
return !DensitySolid(GBackDensity(x,y));
|
||||
}
|
||||
|
||||
|
@ -2243,7 +2244,7 @@ bool C4Game::InitGame(C4Group &hGroup, bool fLoadSection, bool fLoadSky, C4Value
|
|||
if (fLoadSection && fLandscapeLoaded) { PXS.Clear(); MassMover.Clear(); }
|
||||
SetInitProgress(89);
|
||||
// Init main object list
|
||||
Objects.Init(Landscape.Width, Landscape.Height);
|
||||
Objects.Init(Landscape.GetWidth(), Landscape.GetHeight());
|
||||
|
||||
// Pathfinder
|
||||
if (!fLoadSection) PathFinder.Init( &LandscapeFree, &TransferZones );
|
||||
|
@ -2618,7 +2619,7 @@ bool C4Game::PlaceInEarth(C4ID id)
|
|||
int32_t cnt,tx,ty;
|
||||
for (cnt=0; cnt<35; cnt++) // cheap trys
|
||||
{
|
||||
tx=Random(GBackWdt); ty=Random(GBackHgt);
|
||||
tx=Random(::Landscape.GetWidth()); ty=Random(::Landscape.GetHeight());
|
||||
if (GBackMat(tx,ty)==MEarth)
|
||||
if (CreateObject(id,NULL,NO_OWNER,tx,ty,Random(360)))
|
||||
return true;
|
||||
|
@ -2687,7 +2688,7 @@ C4Object* C4Game::PlaceVegetation(C4PropList * PropList, int32_t iX, int32_t iY,
|
|||
// Above tunnel
|
||||
while ((iTy>0) && Landscape.GetBackPix(iTx,iTy) == 0) iTy--;
|
||||
// Above semi solid
|
||||
if (!AboveSemiSolid(iTx,iTy) || !Inside<int32_t>(iTy,50,GBackHgt-50))
|
||||
if (!AboveSemiSolid(iTx,iTy) || !Inside<int32_t>(iTy,50,::Landscape.GetHeight()-50))
|
||||
continue;
|
||||
// Still inside bounds?
|
||||
if (!PlaceVegetation_IsPosInBounds(iTx, iTy, iX, iY, iWdt, iHgt, shape_proplist)) continue;
|
||||
|
@ -2756,7 +2757,7 @@ C4Object* C4Game::PlaceVegetation(C4PropList * PropList, int32_t iX, int32_t iY,
|
|||
// Random hit within target area
|
||||
if (!PlaceVegetation_GetRandomPoint(iX, iY, iWdt, iHgt, shape_proplist, out_pos_proplist, &iTx, &iTy)) break;
|
||||
// Above semi solid
|
||||
if (!AboveSemiSolid(iTx,iTy) || !Inside<int32_t>(iTy,50,GBackHgt-50))
|
||||
if (!AboveSemiSolid(iTx,iTy) || !Inside<int32_t>(iTy,50,::Landscape.GetHeight()-50))
|
||||
continue;
|
||||
// Free above
|
||||
if (GBackSemiSolid(iTx,iTy-pDef->Shape.Hgt) || GBackSemiSolid(iTx,iTy-pDef->Shape.Hgt/2))
|
||||
|
@ -2793,12 +2794,12 @@ C4Object* C4Game::PlaceAnimal(C4PropList* PropList)
|
|||
{
|
||||
// Running free
|
||||
case C4D_Place_Surface:
|
||||
iX=Random(GBackWdt); iY=Random(GBackHgt);
|
||||
iX=Random(::Landscape.GetWidth()); iY=Random(::Landscape.GetHeight());
|
||||
if (!FindSolidGround(iX,iY,pDef->Shape.Wdt)) return NULL;
|
||||
break;
|
||||
// In liquid
|
||||
case C4D_Place_Liquid:
|
||||
iX=Random(GBackWdt); iY=Random(GBackHgt);
|
||||
iX=Random(::Landscape.GetWidth()); iY=Random(::Landscape.GetHeight());
|
||||
if (!FindSurfaceLiquid(iX,iY,pDef->Shape.Wdt,pDef->Shape.Hgt))
|
||||
if (!FindLiquid(iX,iY,pDef->Shape.Wdt,pDef->Shape.Hgt))
|
||||
return NULL;
|
||||
|
@ -2806,8 +2807,8 @@ C4Object* C4Game::PlaceAnimal(C4PropList* PropList)
|
|||
break;
|
||||
// Floating in air
|
||||
case C4D_Place_Air:
|
||||
iX=Random(GBackWdt);
|
||||
for (iY=0; (iY<GBackHgt) && !GBackSemiSolid(iX,iY); iY++) {}
|
||||
iX=Random(::Landscape.GetWidth());
|
||||
for (iY=0; (iY<::Landscape.GetHeight()) && !GBackSemiSolid(iX,iY); iY++) {}
|
||||
if (iY<=0) return NULL;
|
||||
iY=Random(iY);
|
||||
break;
|
||||
|
@ -2824,7 +2825,7 @@ void C4Game::InitInEarth()
|
|||
int32_t cnt,vidnum;
|
||||
C4ID vidlist[maxvid];
|
||||
// Amount
|
||||
int32_t amt=(GBackWdt*GBackHgt/5000)*C4S.Landscape.InEarthLevel.Evaluate()/100;
|
||||
int32_t amt=(::Landscape.GetWidth()*::Landscape.GetHeight()/5000)*C4S.Landscape.InEarthLevel.Evaluate()/100;
|
||||
// List all valid IDs from C4S
|
||||
vidnum=ListExpandValids(C4S.Landscape.InEarth,vidlist,maxvid);
|
||||
// Place
|
||||
|
@ -2840,13 +2841,13 @@ void C4Game::InitVegetation()
|
|||
int32_t cnt,vidnum;
|
||||
C4ID vidlist[maxvid];
|
||||
// Amount
|
||||
int32_t amt=(GBackWdt/50)*C4S.Landscape.VegLevel.Evaluate()/100;
|
||||
int32_t amt=(::Landscape.GetWidth()/50)*C4S.Landscape.VegLevel.Evaluate()/100;
|
||||
// Get percentage vidlist from C4S
|
||||
vidnum=ListExpandValids(C4S.Landscape.Vegetation,vidlist,maxvid);
|
||||
// Place vegetation
|
||||
if (vidnum>0)
|
||||
for (cnt=0; cnt<amt; cnt++)
|
||||
PlaceVegetation(C4Id2Def(vidlist[Random(vidnum)]),0,0,GBackWdt,GBackHgt,-1,NULL,NULL);
|
||||
PlaceVegetation(C4Id2Def(vidlist[Random(vidnum)]),0,0,::Landscape.GetWidth(),::Landscape.GetHeight(),-1,NULL,NULL);
|
||||
}
|
||||
|
||||
void C4Game::InitAnimals()
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include <C4Weather.h>
|
||||
#include <C4Viewport.h>
|
||||
#include <C4FoW.h>
|
||||
#include "landscape/C4Landscape.h"
|
||||
#include "landscape/C4Sky.h"
|
||||
|
||||
// undocumented!
|
||||
static bool FnIncinerateLandscape(C4PropList * _this, long iX, long iY, long caused_by_plr)
|
||||
|
@ -53,12 +55,12 @@ static bool FnIncinerateLandscape(C4PropList * _this, long iX, long iY, long cau
|
|||
|
||||
static void FnSetGravity(C4PropList * _this, long iGravity)
|
||||
{
|
||||
::Landscape.Gravity = C4REAL100(Clamp<long>(iGravity,-1000,1000));
|
||||
::Landscape.SetGravity(C4REAL100(Clamp<long>(iGravity,-1000,1000)));
|
||||
}
|
||||
|
||||
static long FnGetGravity(C4PropList * _this)
|
||||
{
|
||||
return fixtoi(::Landscape.Gravity * 100);
|
||||
return fixtoi(::Landscape.GetGravity() * 100);
|
||||
}
|
||||
|
||||
static C4String *FnGetPlayerName(C4PropList * _this, long iPlayer)
|
||||
|
@ -364,9 +366,9 @@ static long FnGetMaterialCount(C4PropList * _this, long iMaterial, bool fReal)
|
|||
{
|
||||
if (!MatValid(iMaterial)) return -1;
|
||||
if (fReal || !::MaterialMap.Map[iMaterial].MinHeightCount)
|
||||
return ::Landscape.MatCount[iMaterial];
|
||||
return ::Landscape.GetMatCount(iMaterial);
|
||||
else
|
||||
return ::Landscape.EffectiveMatCount[iMaterial];
|
||||
return ::Landscape.GetEffectiveMatCount(iMaterial);
|
||||
}
|
||||
|
||||
static long FnGetMaterial(C4PropList * _this, long x, long y)
|
||||
|
@ -386,7 +388,7 @@ static C4String *FnGetTexture(C4PropList * _this, long x, long y)
|
|||
if (Object(_this)) { x+=Object(_this)->GetX(); y+=Object(_this)->GetY(); }
|
||||
|
||||
// Get texture
|
||||
int32_t iTex = PixCol2Tex(GBackPix(x, y));
|
||||
int32_t iTex = PixCol2Tex(::Landscape.GetPix(x, y));
|
||||
if (!iTex) return NULL;
|
||||
// Get material-texture mapping
|
||||
const C4TexMapEntry *pTex = ::TextureMap.GetEntry(iTex);
|
||||
|
@ -1211,15 +1213,15 @@ static long FnGetTemperature(C4PropList * _this)
|
|||
|
||||
static void FnSetAmbientBrightness(C4PropList * _this, long iBrightness)
|
||||
{
|
||||
if (::Landscape.pFoW)
|
||||
::Landscape.pFoW->Ambient.SetBrightness(iBrightness / 100.);
|
||||
if (::Landscape.HasFoW())
|
||||
::Landscape.GetFoW()->Ambient.SetBrightness(iBrightness / 100.);
|
||||
}
|
||||
|
||||
static long FnGetAmbientBrightness(C4PropList * _this)
|
||||
{
|
||||
if (!::Landscape.pFoW)
|
||||
if (!::Landscape.HasFoW())
|
||||
return 100;
|
||||
return static_cast<long>(::Landscape.pFoW->Ambient.GetBrightness() * 100. + 0.5);
|
||||
return static_cast<long>(::Landscape.GetFoW()->Ambient.GetBrightness() * 100. + 0.5);
|
||||
}
|
||||
|
||||
static void FnSetSeason(C4PropList * _this, long iSeason)
|
||||
|
@ -1244,12 +1246,12 @@ static long FnGetClimate(C4PropList * _this)
|
|||
|
||||
static long FnLandscapeWidth(C4PropList * _this)
|
||||
{
|
||||
return GBackWdt;
|
||||
return ::Landscape.GetWidth();
|
||||
}
|
||||
|
||||
static long FnLandscapeHeight(C4PropList * _this)
|
||||
{
|
||||
return GBackHgt;
|
||||
return ::Landscape.GetHeight();
|
||||
}
|
||||
|
||||
static void FnShakeFree(C4PropList * _this, long x, long y, long rad)
|
||||
|
@ -1663,7 +1665,7 @@ static C4String *FnMaterialName(C4PropList * _this, long iMat)
|
|||
static bool FnSetSkyAdjust(C4PropList * _this, long dwAdjust, long dwBackClr)
|
||||
{
|
||||
// set adjust
|
||||
::Landscape.Sky.SetModulation(dwAdjust, dwBackClr);
|
||||
::Landscape.GetSky().SetModulation(dwAdjust, dwBackClr);
|
||||
// success
|
||||
return true;
|
||||
}
|
||||
|
@ -1679,7 +1681,7 @@ static bool FnSetMatAdjust(C4PropList * _this, long dwAdjust)
|
|||
static long FnGetSkyAdjust(C4PropList * _this, bool fBackColor)
|
||||
{
|
||||
// get adjust
|
||||
return ::Landscape.Sky.GetModulation(!!fBackColor);
|
||||
return ::Landscape.GetSky().GetModulation(!!fBackColor);
|
||||
}
|
||||
|
||||
static long FnGetMatAdjust(C4PropList * _this)
|
||||
|
@ -1936,13 +1938,13 @@ static bool FnSetSkyParallax(C4PropList * _this, Nillable<long> iMode, Nillable<
|
|||
{
|
||||
// set all parameters that aren't nil
|
||||
if (!iMode.IsNil())
|
||||
if (Inside<long>(iMode, 0, 1)) ::Landscape.Sky.ParallaxMode = iMode;
|
||||
if (!iParX.IsNil() && iParX) ::Landscape.Sky.ParX = iParX;
|
||||
if (!iParY.IsNil() && iParY) ::Landscape.Sky.ParY = iParY;
|
||||
if (!iXDir.IsNil()) ::Landscape.Sky.xdir = itofix(iXDir);
|
||||
if (!iYDir.IsNil()) ::Landscape.Sky.ydir = itofix(iYDir);
|
||||
if (!iX.IsNil()) ::Landscape.Sky.x = itofix(iX);
|
||||
if (!iY.IsNil()) ::Landscape.Sky.y = itofix(iY);
|
||||
if (Inside<long>(iMode, 0, 1)) ::Landscape.GetSky().ParallaxMode = iMode;
|
||||
if (!iParX.IsNil() && iParX) ::Landscape.GetSky().ParX = iParX;
|
||||
if (!iParY.IsNil() && iParY) ::Landscape.GetSky().ParY = iParY;
|
||||
if (!iXDir.IsNil()) ::Landscape.GetSky().xdir = itofix(iXDir);
|
||||
if (!iYDir.IsNil()) ::Landscape.GetSky().ydir = itofix(iYDir);
|
||||
if (!iX.IsNil()) ::Landscape.GetSky().x = itofix(iX);
|
||||
if (!iY.IsNil()) ::Landscape.GetSky().y = itofix(iY);
|
||||
// success
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <C4LoaderScreen.h>
|
||||
#include <C4GraphicsResource.h>
|
||||
#include <C4Landscape.h>
|
||||
#include "landscape/C4Sky.h"
|
||||
#include <C4Network2.h>
|
||||
#include <C4Game.h>
|
||||
#include <C4GameObjects.h>
|
||||
|
@ -229,7 +230,7 @@ bool C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename, f
|
|||
C4Viewport *pVP=::Viewports.GetFirstViewport(); if (!pVP) return false;
|
||||
// create image large enough to hold the landscape
|
||||
std::unique_ptr<CPNGFile> png(new CPNGFile());
|
||||
int32_t lWdt = GBackWdt * zoom, lHgt = GBackHgt * zoom;
|
||||
int32_t lWdt = ::Landscape.GetWidth() * zoom, lHgt = ::Landscape.GetHeight() * zoom;
|
||||
if (!png->Create(lWdt, lHgt, false)) return false;
|
||||
// get backbuffer size
|
||||
int32_t bkWdt=C4GUI::GetScreenWdt(), bkHgt=C4GUI::GetScreenHgt();
|
||||
|
@ -241,8 +242,8 @@ bool C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename, f
|
|||
// draw on one big viewport
|
||||
pVP->SetOutputSize(0,0,0,0, bkWdt, bkHgt);
|
||||
// backup and clear sky parallaxity
|
||||
int32_t iParX=::Landscape.Sky.ParX; ::Landscape.Sky.ParX=10;
|
||||
int32_t iParY=::Landscape.Sky.ParY; ::Landscape.Sky.ParY=10;
|
||||
int32_t iParX=::Landscape.GetSky().ParX; ::Landscape.GetSky().ParX=10;
|
||||
int32_t iParY=::Landscape.GetSky().ParY; ::Landscape.GetSky().ParY=10;
|
||||
// backup and clear viewport borders
|
||||
FLOAT_RECT vp_borders = { pVP->BorderLeft, pVP->BorderRight, pVP->BorderTop, pVP->BorderBottom };
|
||||
pVP->BorderLeft = pVP->BorderRight = pVP->BorderTop = pVP->BorderBottom = 0.0f;
|
||||
|
@ -288,8 +289,8 @@ bool C4GraphicsSystem::DoSaveScreenshot(bool fSaveAll, const char *szFilename, f
|
|||
pVP->BorderRight = vp_borders.right;
|
||||
pVP->BorderBottom = vp_borders.bottom;
|
||||
// restore parallaxity
|
||||
::Landscape.Sky.ParX=iParX;
|
||||
::Landscape.Sky.ParY=iParY;
|
||||
::Landscape.GetSky().ParX=iParX;
|
||||
::Landscape.GetSky().ParY=iParY;
|
||||
// restore viewport size
|
||||
::Viewports.RecalculateViewports();
|
||||
// save!
|
||||
|
|
|
@ -26,7 +26,7 @@ const int StableRange=10;
|
|||
const int AttachRange=5;
|
||||
const int CornerRange=AttachRange+2;
|
||||
|
||||
#define GravAccel (::Landscape.Gravity)
|
||||
#define GravAccel ::Landscape.GetGravity()
|
||||
|
||||
extern const C4Real HitSpeed1,HitSpeed2,HitSpeed3,HitSpeed4;
|
||||
extern const C4Real FloatFriction;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <C4GraphicsResource.h>
|
||||
#include <C4GraphicsSystem.h>
|
||||
#include <C4Landscape.h>
|
||||
#include "landscape/C4Sky.h"
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4GameObjects.h>
|
||||
#include <C4Network2.h>
|
||||
|
@ -260,7 +261,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawGame, bool fDrawOverlay)
|
|||
pDraw->SetFoW(pFoW);
|
||||
|
||||
C4ST_STARTNEW(SkyStat, "C4Viewport::Draw: Sky")
|
||||
::Landscape.Sky.Draw(cgo);
|
||||
::Landscape.GetSky().Draw(cgo);
|
||||
C4ST_STOP(SkyStat)
|
||||
|
||||
::Objects.Draw(cgo, Player, -2147483647 - 1 /* INT32_MIN */, 0);
|
||||
|
@ -411,7 +412,7 @@ void C4Viewport::CalculateZoom()
|
|||
if (plr)
|
||||
plr->ZoomLimitsToViewport(this);
|
||||
else
|
||||
SetZoomLimits(0.8*std::min<float>(float(ViewWdt)/GBackWdt,float(ViewHgt)/GBackHgt), 8);
|
||||
SetZoomLimits(0.8*std::min<float>(float(ViewWdt)/::Landscape.GetWidth(),float(ViewHgt)/::Landscape.GetHeight()), 8);
|
||||
|
||||
}
|
||||
|
||||
|
@ -424,7 +425,7 @@ void C4Viewport::InitZoom()
|
|||
}
|
||||
else
|
||||
{
|
||||
ZoomTarget = std::max<float>(float(ViewWdt)/GBackWdt, 1.0f);
|
||||
ZoomTarget = std::max<float>(float(ViewWdt)/::Landscape.GetWidth(), 1.0f);
|
||||
Zoom = ZoomTarget;
|
||||
}
|
||||
}
|
||||
|
@ -556,13 +557,13 @@ void C4Viewport::AdjustPosition(bool immediate)
|
|||
|
||||
// if view is close to border, allow scrolling
|
||||
if (targetCenterViewX < ViewportScrollBorder) extraBoundsX = std::min<float>(ViewportScrollBorder - targetCenterViewX, ViewportScrollBorder);
|
||||
else if (targetCenterViewX >= GBackWdt - ViewportScrollBorder) extraBoundsX = std::min<float>(targetCenterViewX - GBackWdt, 0) + ViewportScrollBorder;
|
||||
else if (targetCenterViewX >= ::Landscape.GetWidth() - ViewportScrollBorder) extraBoundsX = std::min<float>(targetCenterViewX - ::Landscape.GetWidth(), 0) + ViewportScrollBorder;
|
||||
if (targetCenterViewY < ViewportScrollBorder) extraBoundsY = std::min<float>(ViewportScrollBorder - targetCenterViewY, ViewportScrollBorder);
|
||||
else if (targetCenterViewY >= GBackHgt - ViewportScrollBorder) extraBoundsY = std::min<float>(targetCenterViewY - GBackHgt, 0) + ViewportScrollBorder;
|
||||
else if (targetCenterViewY >= ::Landscape.GetHeight() - ViewportScrollBorder) extraBoundsY = std::min<float>(targetCenterViewY - ::Landscape.GetHeight(), 0) + ViewportScrollBorder;
|
||||
}
|
||||
|
||||
extraBoundsX = std::max(extraBoundsX, (ViewWdt/Zoom - GBackWdt)/2 + 1);
|
||||
extraBoundsY = std::max(extraBoundsY, (ViewHgt/Zoom - GBackHgt)/2 + 1);
|
||||
extraBoundsX = std::max(extraBoundsX, (ViewWdt/Zoom - ::Landscape.GetWidth())/2 + 1);
|
||||
extraBoundsY = std::max(extraBoundsY, (ViewHgt/Zoom - ::Landscape.GetHeight())/2 + 1);
|
||||
|
||||
// add mouse auto scroll
|
||||
if (pPlr->MouseControl && ::MouseControl.InitCentered && Config.Controls.MouseAutoScroll)
|
||||
|
@ -579,8 +580,8 @@ void C4Viewport::AdjustPosition(bool immediate)
|
|||
targetCenterViewY = Clamp(targetCenterViewY, targetCenterViewY - scrollRange, targetCenterViewY + scrollRange);
|
||||
}
|
||||
// bounds
|
||||
targetCenterViewX = Clamp(targetCenterViewX, ViewWdt/Zoom/2 - extraBoundsX, GBackWdt - ViewWdt/Zoom/2 + extraBoundsX);
|
||||
targetCenterViewY = Clamp(targetCenterViewY, ViewHgt/Zoom/2 - extraBoundsY, GBackHgt - ViewHgt/Zoom/2 + extraBoundsY);
|
||||
targetCenterViewX = Clamp(targetCenterViewX, ViewWdt/Zoom/2 - extraBoundsX, ::Landscape.GetWidth() - ViewWdt/Zoom/2 + extraBoundsX);
|
||||
targetCenterViewY = Clamp(targetCenterViewY, ViewHgt/Zoom/2 - extraBoundsY, ::Landscape.GetHeight() - ViewHgt/Zoom/2 + extraBoundsY);
|
||||
|
||||
targetViewX = targetCenterViewX - ViewWdt/Zoom/2 + viewOffsX;
|
||||
targetViewY = targetCenterViewY - ViewHgt/Zoom/2 + viewOffsY;
|
||||
|
@ -610,20 +611,20 @@ void C4Viewport::CenterPosition()
|
|||
{
|
||||
// center viewport position on map
|
||||
// set center position
|
||||
SetViewX(GBackWdt/2 + ViewWdt/Zoom/2);
|
||||
SetViewY(GBackHgt/2 + ViewHgt/Zoom/2);
|
||||
SetViewX(::Landscape.GetWidth()/2 + ViewWdt/Zoom/2);
|
||||
SetViewY(::Landscape.GetHeight()/2 + ViewHgt/Zoom/2);
|
||||
}
|
||||
|
||||
void C4Viewport::UpdateBordersX()
|
||||
{
|
||||
BorderLeft = std::max(-GetViewX() * Zoom, 0.0f);
|
||||
BorderRight = std::max(ViewWdt - GBackWdt * Zoom + GetViewX() * Zoom, 0.0f);
|
||||
BorderRight = std::max(ViewWdt - ::Landscape.GetWidth() * Zoom + GetViewX() * Zoom, 0.0f);
|
||||
}
|
||||
|
||||
void C4Viewport::UpdateBordersY()
|
||||
{
|
||||
BorderTop = std::max(-GetViewY() * Zoom, 0.0f);
|
||||
BorderBottom = std::max(ViewHgt - GBackHgt * Zoom + GetViewY() * Zoom, 0.0f);
|
||||
BorderBottom = std::max(ViewHgt - ::Landscape.GetHeight() * Zoom + GetViewY() * Zoom, 0.0f);
|
||||
}
|
||||
|
||||
void C4Viewport::DrawPlayerInfo(C4TargetFacet &cgo)
|
||||
|
@ -673,9 +674,9 @@ void C4Viewport::DisableFoW()
|
|||
|
||||
void C4Viewport::EnableFoW()
|
||||
{
|
||||
if (::Landscape.pFoW && Player != NO_OWNER)
|
||||
if (::Landscape.HasFoW() && Player != NO_OWNER)
|
||||
{
|
||||
pFoW.reset(new C4FoWRegion(::Landscape.pFoW, ::Players.Get(Player)));
|
||||
pFoW.reset(new C4FoWRegion(::Landscape.GetFoW(), ::Players.Get(Player)));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -722,13 +723,13 @@ void C4Viewport::SetViewX(float x)
|
|||
|
||||
if (fIsNoOwnerViewport)
|
||||
{
|
||||
if(GBackWdt < ViewWdt / Zoom)
|
||||
if(::Landscape.GetWidth() < ViewWdt / Zoom)
|
||||
{
|
||||
viewX = GBackWdt/2 - ViewWdt / Zoom / 2;
|
||||
viewX = ::Landscape.GetWidth()/2 - ViewWdt / Zoom / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewX = Clamp(x, 0.0f, GBackWdt - ViewWdt / Zoom);
|
||||
viewX = Clamp(x, 0.0f, ::Landscape.GetWidth() - ViewWdt / Zoom);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -741,13 +742,13 @@ void C4Viewport::SetViewY(float y)
|
|||
|
||||
if (fIsNoOwnerViewport)
|
||||
{
|
||||
if(GBackHgt < ViewHgt / Zoom)
|
||||
if(::Landscape.GetHeight() < ViewHgt / Zoom)
|
||||
{
|
||||
viewY = GBackHgt/2 - ViewHgt / Zoom / 2;
|
||||
viewY = ::Landscape.GetHeight()/2 - ViewHgt / Zoom / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
viewY = Clamp(y, 0.0f, GBackHgt - ViewHgt / Zoom);
|
||||
viewY = Clamp(y, 0.0f, ::Landscape.GetHeight() - ViewHgt / Zoom);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ int32_t mouseButtonFromEvent(NSEvent* event, DWORD* modifierFlags)
|
|||
if (Application.isEditor && viewport && !viewport->GetPlayerLock())
|
||||
{
|
||||
NSScrollView* scrollView = self.controller.scrollView;
|
||||
NSPoint p = NSMakePoint(2*-[event deltaX]/abs(GBackWdt-viewport->ViewWdt), 2*-[event deltaY]/abs(GBackHgt-viewport->ViewHgt));
|
||||
NSPoint p = NSMakePoint(2*-[event deltaX]/abs(::Landscape.GetWidth()-viewport->ViewWdt), 2*-[event deltaY]/abs(::Landscape.GetHeight()-viewport->ViewHgt));
|
||||
[scrollView.horizontalScroller setDoubleValue:scrollView.horizontalScroller.doubleValue+p.x];
|
||||
[scrollView.verticalScroller setDoubleValue:scrollView.verticalScroller.doubleValue+p.y];
|
||||
viewport->ViewPositionByScrollBars();
|
||||
|
|
|
@ -192,7 +192,7 @@ void CSurface8::MapBytes(BYTE *bpMap)
|
|||
for (int cnt=0; cnt<Wdt*Hgt; cnt++) SetPix(cnt%Wdt, cnt/Wdt, bpMap[GetPix(cnt%Wdt, cnt/Wdt)]);
|
||||
}
|
||||
|
||||
void CSurface8::GetSurfaceSize(int &irX, int &irY)
|
||||
void CSurface8::GetSurfaceSize(int &irX, int &irY) const
|
||||
{
|
||||
// simply assign stored values
|
||||
irX=Wdt;
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
void NoClip();
|
||||
bool Read(class CStdStream &hGroup);
|
||||
bool Save(const char *szFilename, CStdPalette * = NULL);
|
||||
void GetSurfaceSize(int &irX, int &irY); // get surface size
|
||||
void GetSurfaceSize(int &irX, int &irY) const; // get surface size
|
||||
void AllowColor(BYTE iRngLo, BYTE iRngHi, bool fAllowZero=false);
|
||||
void SetBuffer(BYTE *pbyToBuf, int Wdt, int Hgt, int Pitch);
|
||||
void ReleaseBuffer();
|
||||
|
|
|
@ -804,7 +804,7 @@ void C4MouseControl::UpdateFogOfWar()
|
|||
// Check for fog of war
|
||||
// TODO: Check C4FoWRegion... should maybe be passed as a parameter?
|
||||
// pDraw->GetFoW() might not be current at this time.
|
||||
if (/*(pPlayer->fFogOfWar && !pPlayer->FoWIsVisible(int32_t(GameX),int32_t(GameY))) || */GameX<0 || GameY<0 || int32_t(GameX)>=GBackWdt || int32_t(GameY)>=GBackHgt)
|
||||
if (/*(pPlayer->fFogOfWar && !pPlayer->FoWIsVisible(int32_t(GameX),int32_t(GameY))) || */GameX<0 || GameY<0 || int32_t(GameX)>=::Landscape.GetWidth() || int32_t(GameY)>=::Landscape.GetHeight())
|
||||
{
|
||||
FogOfWar=true;
|
||||
// allow dragging, scrolling, region selection and manipulations of objects not affected by FoW
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (c) 1998-2000, Matthes Bender
|
||||
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
|
||||
* Copyright (c) 2009-2013, The OpenClonk Team and contributors
|
||||
* Copyright (c) 2009-2016, The OpenClonk Team and contributors
|
||||
*
|
||||
* Distributed under the terms of the ISC license; see accompanying file
|
||||
* "COPYING" for details.
|
||||
|
@ -20,61 +20,30 @@
|
|||
#ifndef INC_C4Landscape
|
||||
#define INC_C4Landscape
|
||||
|
||||
#include "C4Sky.h"
|
||||
#include "C4Shape.h"
|
||||
|
||||
#include <CSurface8.h>
|
||||
#include <C4Material.h>
|
||||
#include "C4Prototypes.h"
|
||||
#include "C4Constants.h"
|
||||
|
||||
const int32_t C4MaxMaterial = 125;
|
||||
|
||||
const int32_t C4LSC_Undefined = 0,
|
||||
C4LSC_Dynamic = 1,
|
||||
C4LSC_Static = 2,
|
||||
C4LSC_Exact = 3;
|
||||
|
||||
const int32_t C4LS_MaxRelights = 50;
|
||||
|
||||
enum class LandscapeMode
|
||||
{
|
||||
Undefined = 0,
|
||||
Dynamic = 1,
|
||||
Static = 2,
|
||||
Exact = 3
|
||||
};
|
||||
|
||||
class C4Landscape
|
||||
{
|
||||
struct P;
|
||||
std::unique_ptr<P> p;
|
||||
|
||||
public:
|
||||
C4Landscape();
|
||||
~C4Landscape();
|
||||
public:
|
||||
int32_t Mode;
|
||||
int32_t Width,Height;
|
||||
int32_t MapWidth,MapHeight,MapZoom;
|
||||
DWORD MatCount[C4MaxMaterial]; // NoSave //
|
||||
DWORD EffectiveMatCount[C4MaxMaterial]; // NoSave //
|
||||
|
||||
bool NoScan; // ExecuteScan() disabled
|
||||
int32_t ScanX,ScanSpeed; // SyncClearance-NoSave //
|
||||
int32_t LeftOpen,RightOpen,TopOpen,BottomOpen;
|
||||
C4Real Gravity;
|
||||
uint32_t Modulation; // landscape blit modulation; 0 means normal
|
||||
int32_t MapSeed; // random seed for MapToLandscape
|
||||
C4Sky Sky;
|
||||
C4MapCreatorS2 *pMapCreator; // map creator for script-generated maps
|
||||
bool fMapChanged;
|
||||
BYTE *pInitial; // Initial landscape after creation - used for diff
|
||||
BYTE *pInitialBkg; // Initial bkg landscape after creation - used for diff
|
||||
class C4FoW *pFoW;
|
||||
|
||||
private:
|
||||
CSurface8 * Surface8;
|
||||
CSurface8 * Surface8Bkg; // Background material
|
||||
CSurface8 * Map;
|
||||
CSurface8 * MapBkg;
|
||||
class C4LandscapeRender *pLandscapeRender;
|
||||
uint8_t *TopRowPix, *BottomRowPix; // array size of landscape width: Filled with 0s for border pixels that are open and MCVehic for pixels that are closed
|
||||
int32_t Pix2Mat[C4M_MaxTexIndex], Pix2Dens[C4M_MaxTexIndex], Pix2Place[C4M_MaxTexIndex];
|
||||
bool Pix2Light[C4M_MaxTexIndex];
|
||||
int32_t PixCntPitch;
|
||||
uint8_t *PixCnt;
|
||||
C4Rect Relights[C4LS_MaxRelights];
|
||||
mutable uint8_t *BridgeMatConversion[C4M_MaxTexIndex]; // NoSave //
|
||||
|
||||
public:
|
||||
// Use this with the various drawing functions to keep current material for
|
||||
// either foreground or background map. We can use C4M_MaxTexIndex as a value
|
||||
// here because this value is reserved anyway for the differential landscape
|
||||
|
@ -85,11 +54,9 @@ public:
|
|||
void Clear(bool fClearMapCreator=true, bool fClearSky=true, bool fClearRenderer=true);
|
||||
void Execute();
|
||||
void Synchronize();
|
||||
void Draw(C4TargetFacet &cgo, class C4FoWRegion *pLight = NULL);
|
||||
void Draw(C4TargetFacet &cgo, class C4FoWRegion *pLight = nullptr);
|
||||
void ScenarioInit();
|
||||
|
||||
void ClearRectDensity(int32_t iTx, int32_t iTy, int32_t iWdt, int32_t iHgt, int32_t iOfDensity);
|
||||
void ClearMatCount();
|
||||
void ScanSideOpen();
|
||||
|
||||
void DrawMaterialRect(int32_t mat, int32_t tx, int32_t ty, int32_t wdt, int32_t hgt);
|
||||
|
@ -105,10 +72,13 @@ public:
|
|||
bool SaveInitial();
|
||||
bool SaveTextures(C4Group &hGroup) const;
|
||||
bool Init(C4Group &hGroup, bool fOverloadCurrent, bool fLoadSky, bool &rfLoaded, bool fSavegame);
|
||||
bool HasMap() const { return Map != NULL && MapBkg != NULL; }
|
||||
bool HasMap() const;
|
||||
bool MapToLandscape();
|
||||
bool ApplyDiff(C4Group &hGroup);
|
||||
bool SetMode(int32_t iMode);
|
||||
|
||||
void SetMode(LandscapeMode iMode);
|
||||
LandscapeMode GetMode() const;
|
||||
|
||||
bool SetPix2(int32_t x, int32_t y, BYTE fgPix, BYTE bgPix); // set landscape pixel (bounds checked)
|
||||
bool _SetPix2(int32_t x, int32_t y, BYTE fgPix, BYTE bgPix); // set landsape pixel (bounds not checked)
|
||||
void _SetPix2Tmp(int32_t x, int32_t y, BYTE fgPix, BYTE bgPix); // set landsape pixel (bounds not checked, no material count updates, no landscape relighting). Material must be reset to original value with this function before modifying landscape in any other way. Only used for temporary pixel changes by SolidMask (C4SolidMask::RemoveTemporary, C4SolidMask::PutTemporary).
|
||||
|
@ -125,138 +95,40 @@ public:
|
|||
bool DrawChunks(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t icntx, int32_t icnty, const char *szMaterial, const char *szTexture, bool bIFT);
|
||||
bool DrawQuad(int32_t iX1, int32_t iY1, int32_t iX2, int32_t iY2, int32_t iX3, int32_t iY3, int32_t iX4, int32_t iY4, const char *szMaterial, const char *szBackMaterial, bool fDrawBridge);
|
||||
bool DrawPolygon(int *vtcs, int length, const char *szMaterial, const char *szBackMaterial, bool fDrawBridge);
|
||||
CStdPalette *GetPal() const { return Surface8 ? Surface8->pPal : NULL; }
|
||||
inline BYTE _GetPix(int32_t x, int32_t y) const // get landscape pixel (bounds not checked)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (x<0 || y<0 || x>=Width || y>=Height) { BREAKPOINT_HERE; }
|
||||
#endif
|
||||
return Surface8->_GetPix(x,y);
|
||||
}
|
||||
inline BYTE GetPix(int32_t x, int32_t y) const // get landscape pixel (bounds checked)
|
||||
{
|
||||
extern BYTE MCVehic;
|
||||
// Border checks
|
||||
if (x<0)
|
||||
{
|
||||
if (y<LeftOpen) return 0;
|
||||
else return MCVehic;
|
||||
}
|
||||
if (static_cast<uint32_t>(x) >= static_cast<uint32_t>(Width))
|
||||
{
|
||||
if (y<RightOpen) return 0;
|
||||
else return MCVehic;
|
||||
}
|
||||
if (y<0)
|
||||
{
|
||||
return TopRowPix[x];
|
||||
}
|
||||
if (static_cast<uint32_t>(y) >= static_cast<uint32_t>(Height))
|
||||
{
|
||||
return BottomRowPix[x];
|
||||
}
|
||||
return Surface8->_GetPix(x,y);
|
||||
}
|
||||
inline int32_t _GetMat(int32_t x, int32_t y) const // get landscape material (bounds not checked)
|
||||
{
|
||||
return Pix2Mat[_GetPix(x, y)];
|
||||
}
|
||||
inline int32_t _GetDensity(int32_t x, int32_t y) const // get landscape density (bounds not checked)
|
||||
{
|
||||
return Pix2Dens[_GetPix(x, y)];
|
||||
}
|
||||
inline int32_t _GetPlacement(int32_t x, int32_t y) const // get landscape material placement (bounds not checked)
|
||||
{
|
||||
return Pix2Place[_GetPix(x, y)];
|
||||
}
|
||||
inline int32_t GetMat(int32_t x, int32_t y) const // get landscape material (bounds checked)
|
||||
{
|
||||
return Pix2Mat[GetPix(x, y)];
|
||||
}
|
||||
inline int32_t GetDensity(int32_t x, int32_t y) const // get landscape density (bounds checked)
|
||||
{
|
||||
return Pix2Dens[GetPix(x, y)];
|
||||
}
|
||||
inline int32_t GetPlacement(int32_t x, int32_t y) const // get landscape material placement (bounds checked)
|
||||
{
|
||||
return Pix2Place[GetPix(x, y)];
|
||||
}
|
||||
CStdPalette *GetPal() const;
|
||||
|
||||
inline BYTE _GetBackPix(int32_t x, int32_t y) const // get landscape pixel (bounds not checked)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (x<0 || y<0 || x>=Width || y>=Height) { BREAKPOINT_HERE; }
|
||||
#endif
|
||||
return Surface8Bkg->_GetPix(x,y);
|
||||
}
|
||||
inline BYTE GetBackPix(int32_t x, int32_t y) const // get landscape pixel (bounds checked)
|
||||
{
|
||||
// Border checks
|
||||
if (x<0)
|
||||
{
|
||||
if (y<LeftOpen) return 0;
|
||||
else return Mat2PixColDefault(MTunnel);
|
||||
}
|
||||
if (static_cast<uint32_t>(x) >= static_cast<uint32_t>(Width))
|
||||
{
|
||||
if (y<RightOpen) return 0;
|
||||
else return Mat2PixColDefault(MTunnel);
|
||||
}
|
||||
if (y<0)
|
||||
{
|
||||
return DefaultBkgMat(TopRowPix[x]);
|
||||
}
|
||||
if (static_cast<uint32_t>(y) >= static_cast<uint32_t>(Height))
|
||||
{
|
||||
return DefaultBkgMat(BottomRowPix[x]);
|
||||
}
|
||||
int32_t GetWidth() const;
|
||||
int32_t GetHeight() const;
|
||||
int32_t GetMapZoom() const;
|
||||
C4Real GetGravity() const;
|
||||
void SetGravity(C4Real g);
|
||||
|
||||
return Surface8Bkg->_GetPix(x,y);
|
||||
}
|
||||
inline int32_t _GetBackMat(int32_t x, int32_t y) const // get landscape material (bounds not checked)
|
||||
{
|
||||
return Pix2Mat[_GetBackPix(x, y)];
|
||||
}
|
||||
inline int32_t _GetBackDensity(int32_t x, int32_t y) const // get landscape density (bounds not checked)
|
||||
{
|
||||
return Pix2Dens[_GetBackPix(x, y)];
|
||||
}
|
||||
inline int32_t _GetBackPlacement(int32_t x, int32_t y) const // get landscape material placement (bounds not checked)
|
||||
{
|
||||
return Pix2Place[_GetBackPix(x, y)];
|
||||
}
|
||||
inline int32_t GetBackMat(int32_t x, int32_t y) const // get landscape material (bounds checked)
|
||||
{
|
||||
return Pix2Mat[GetBackPix(x, y)];
|
||||
}
|
||||
inline int32_t GetBackDensity(int32_t x, int32_t y) const // get landscape density (bounds checked)
|
||||
{
|
||||
return Pix2Dens[GetBackPix(x, y)];
|
||||
}
|
||||
inline int32_t GetBackPlacement(int32_t x, int32_t y) const // get landscape material placement (bounds checked)
|
||||
{
|
||||
return Pix2Place[GetBackPix(x, y)];
|
||||
}
|
||||
BYTE _GetPix(int32_t x, int32_t y) const; // get landscape pixel (bounds not checked)
|
||||
BYTE GetPix(int32_t x, int32_t y) const;
|
||||
|
||||
inline bool GetLight(int32_t x, int32_t y)
|
||||
{
|
||||
return GetBackPix(x, y) == 0 || Pix2Light[GetPix(x, y)];
|
||||
}
|
||||
inline bool _GetLight(int32_t x, int32_t y)
|
||||
{
|
||||
return _GetBackPix(x, y) == 0 || Pix2Light[_GetPix(x, y)];
|
||||
}
|
||||
int32_t _GetMat(int32_t x, int32_t y) const;
|
||||
int32_t _GetDensity(int32_t x, int32_t y) const;
|
||||
int32_t _GetPlacement(int32_t x, int32_t y) const;
|
||||
int32_t GetMat(int32_t x, int32_t y) const;
|
||||
int32_t GetDensity(int32_t x, int32_t y) const;
|
||||
int32_t GetPlacement(int32_t x, int32_t y) const;
|
||||
|
||||
inline bool _FastSolidCheck(int32_t x, int32_t y) const // checks whether there *might* be something solid at the point
|
||||
{
|
||||
return PixCnt[(x / 17) * PixCntPitch + (y / 15)] > 0;
|
||||
}
|
||||
static inline int32_t FastSolidCheckNextX(int32_t x)
|
||||
{
|
||||
return (x / 17) * 17 + 17;
|
||||
}
|
||||
inline int32_t GetPixMat(BYTE byPix) const { return Pix2Mat[byPix]; }
|
||||
inline int32_t GetPixDensity(BYTE byPix) const { return Pix2Dens[byPix]; }
|
||||
BYTE _GetBackPix(int32_t x, int32_t y) const;
|
||||
BYTE GetBackPix(int32_t x, int32_t y) const;
|
||||
int32_t _GetBackMat(int32_t x, int32_t y) const;
|
||||
int32_t _GetBackDensity(int32_t x, int32_t y) const;
|
||||
int32_t _GetBackPlacement(int32_t x, int32_t y) const;
|
||||
int32_t GetBackMat(int32_t x, int32_t y) const;
|
||||
int32_t GetBackDensity(int32_t x, int32_t y) const;
|
||||
int32_t GetBackPlacement(int32_t x, int32_t y) const;
|
||||
|
||||
bool GetLight(int32_t x, int32_t y);
|
||||
bool _GetLight(int32_t x, int32_t y);
|
||||
|
||||
bool _FastSolidCheck(int32_t x, int32_t y) const;
|
||||
static int32_t FastSolidCheckNextX(int32_t x);
|
||||
int32_t GetPixMat(BYTE byPix) const;
|
||||
int32_t GetPixDensity(BYTE byPix) const;
|
||||
bool _PathFree(int32_t x, int32_t y, int32_t x2, int32_t y2) const; // quickly checks wether there *might* be pixel in the path.
|
||||
int32_t GetMatHeight(int32_t x, int32_t y, int32_t iYDir, int32_t iMat, int32_t iMax) const;
|
||||
|
||||
|
@ -265,49 +137,25 @@ public:
|
|||
bool DrawMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef, bool ignoreSky = false); // creates and draws a map section using MapCreatorS2
|
||||
bool ClipRect(int32_t &rX, int32_t &rY, int32_t &rWdt, int32_t &rHgt) const; // clip given rect by landscape size; return whether anything is left unclipped
|
||||
bool DrawDefMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, const char *szMapDef, bool ignoreSky = false); // creates and draws a map section using MapCreatorS2 and a map from the loaded Landscape.txt
|
||||
bool SetModulation(DWORD dwWithClr) // adjust the way the landscape is blitted
|
||||
{ Modulation=dwWithClr; return true; }
|
||||
DWORD GetModulation() const { return Modulation; }
|
||||
bool SetModulation(DWORD dwWithClr);
|
||||
DWORD GetModulation() const;
|
||||
bool PostInitMap(); // do script callbacks of MapCreatorS2 in finished landscape
|
||||
bool ReplaceMapColor(BYTE iOldIndex, BYTE iNewIndex); // find every occurance of iOldIndex in map; replace it by new index
|
||||
bool SetTextureIndex(const char *szMatTex, BYTE iNewIndex, bool fInsert); // change color index of map texture, or insert a new one
|
||||
void SetMapChanged() { fMapChanged = true; }
|
||||
void SetMapChanged();
|
||||
void HandleTexMapUpdate();
|
||||
void UpdatePixMaps();
|
||||
bool DoRelights();
|
||||
void RemoveUnusedTexMapEntries();
|
||||
|
||||
private:
|
||||
void ExecuteScan();
|
||||
int32_t DoScan(int32_t x, int32_t y, int32_t mat, int32_t dir);
|
||||
uint32_t ChunkyRandom(uint32_t &iOffset, uint32_t iRange) const; // return static random value, according to offset and MapSeed
|
||||
void DrawChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, uint8_t mcol, uint8_t mcolBkg, C4MaterialCoreShape Shape, uint32_t cro);
|
||||
void DrawSmoothOChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, uint8_t mcol, uint8_t mcolBkg, int flip, uint32_t cro);
|
||||
void ChunkOZoom(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX=0,int32_t iOffY=0);
|
||||
bool GetTexUsage(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage) const;
|
||||
bool TexOZoom(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, DWORD *dwpTextureUsage, int32_t iToX=0,int32_t iToY=0);
|
||||
bool MapToSurface(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iToX, int32_t iToY, int32_t iToWdt, int32_t iToHgt, int32_t iOffX, int32_t iOffY);
|
||||
bool MapToLandscape(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iOffsX = 0, int32_t iOffsY = 0, bool noClear = false); // zoom map segment to surface (or sector surfaces)
|
||||
bool InitTopAndBottomRowPix(); // inti out-of-landscape pixels for bottom side
|
||||
bool GetMapColorIndex(const char *szMaterial, const char *szTexture, BYTE &rbyCol) const;
|
||||
bool SkyToLandscape(int32_t iToX, int32_t iToY, int32_t iToWdt, int32_t iToHgt, int32_t iOffX, int32_t iOffY);
|
||||
bool CreateMap(CSurface8*& sfcMap, CSurface8*& sfcMapBkg); // create map by landscape attributes
|
||||
bool CreateMapS2(C4Group &ScenFile, CSurface8*& sfcMap, CSurface8*& sfcMapBkg); // create map by def file
|
||||
bool Mat2Pal(); // assign material colors to landscape palette
|
||||
void UpdatePixCnt(const class C4Rect &Rect, bool fCheck = false);
|
||||
void UpdateMatCnt(C4Rect Rect, bool fPlus);
|
||||
void PrepareChange(C4Rect BoundingBox);
|
||||
void FinishChange(C4Rect BoundingBox);
|
||||
bool DrawLineLandscape(int32_t iX, int32_t iY, int32_t iGrade, uint8_t line_color, uint8_t line_color_bkg);
|
||||
bool DrawLineMap(int32_t iX, int32_t iY, int32_t iRadius, uint8_t line_color, uint8_t line_color_bkg);
|
||||
uint8_t *GetBridgeMatConversion(int32_t for_material_col) const;
|
||||
bool SaveInternal(C4Group &hGroup) const;
|
||||
bool SaveDiffInternal(C4Group &hGroup, bool fSyncSave) const;
|
||||
class C4Sky &GetSky();
|
||||
|
||||
int32_t ForPolygon(int *vtcs, int length, bool (C4Landscape::*fnCallback)(int32_t, int32_t),
|
||||
C4MaterialList *mats_count = NULL, uint8_t col = 0, uint8_t colBkg = 0, uint8_t *conversion_table = NULL);
|
||||
bool HasFoW() const;
|
||||
class C4FoW *GetFoW();
|
||||
|
||||
int32_t GetMatCount(int material) const;
|
||||
int32_t GetEffectiveMatCount(int material) const;
|
||||
|
||||
public:
|
||||
int32_t DigFreeShape(int *vtcs, int length, C4Object *by_object = NULL, bool no_dig2objects = false, bool no_instability_check = false);
|
||||
void BlastFreeShape(int *vtcs, int length, C4Object *by_object = NULL, int32_t by_player = NO_OWNER, int32_t iMaxDensity = C4M_Vehicle);
|
||||
|
||||
|
@ -322,21 +170,8 @@ public:
|
|||
|
||||
bool ClearPix(int32_t tx, int32_t ty); // also used by mass mover (corrode)
|
||||
|
||||
private:
|
||||
CSurface8* CreateDefaultBkgSurface(CSurface8& sfcFg, bool msbAsIft) const;
|
||||
void DigMaterial2Objects(int32_t tx, int32_t ty, C4MaterialList *mat_list, C4Object *pCollect = NULL);
|
||||
void BlastMaterial2Objects(int32_t tx, int32_t ty, C4MaterialList *mat_list, int32_t caused_by, int32_t str, C4ValueArray *out_objects);
|
||||
void ClearPointers(C4Object *pObj);
|
||||
|
||||
bool DigFreePix(int32_t tx, int32_t ty);
|
||||
bool DigFreePixNoInstability(int32_t tx, int32_t ty);
|
||||
bool BlastFreePix(int32_t tx, int32_t ty);
|
||||
bool ShakeFreePix(int32_t tx, int32_t ty);
|
||||
|
||||
C4ValueArray *PrepareFreeShape(C4Rect &BoundingBox, C4Object *by_object);
|
||||
void PostFreeShape(C4ValueArray *dig_objects, C4Object *by_object);
|
||||
BYTE DefaultBkgMat(BYTE fg) const;
|
||||
|
||||
public:
|
||||
void CompileFunc(StdCompiler *pComp); // without landscape bitmaps and sky
|
||||
};
|
||||
|
||||
|
@ -361,12 +196,6 @@ bool FindClosestFree(int32_t &rX, int32_t &rY, int32_t iAngle1, int32_t iAngle2,
|
|||
bool ConstructionCheck(C4PropList *, int32_t iX, int32_t iY, C4Object *pByObj=NULL);
|
||||
int32_t PixCol2Mat(BYTE pixc);
|
||||
|
||||
#define GBackWdt ::Landscape.Width
|
||||
#define GBackHgt ::Landscape.Height
|
||||
#define GBackPix ::Landscape.GetPix
|
||||
#define ClearBackPix ::Landscape.ClearPix
|
||||
#define _GBackPix ::Landscape._GetPix
|
||||
|
||||
inline bool DensitySolid(int32_t dens)
|
||||
{
|
||||
return (dens>=C4M_Solid);
|
||||
|
|
|
@ -100,7 +100,7 @@ void C4MassMoverSet::Draw()
|
|||
bool C4MassMover::Init(int32_t tx, int32_t ty)
|
||||
{
|
||||
// Out of bounds check
|
||||
if (!Inside<int32_t>(tx,0,GBackWdt-1) || !Inside<int32_t>(ty,0,GBackHgt-1))
|
||||
if (!Inside<int32_t>(tx,0,::Landscape.GetWidth()-1) || !Inside<int32_t>(ty,0,::Landscape.GetHeight()-1))
|
||||
return false;
|
||||
// Check mat
|
||||
Mat=GBackMat(tx,ty);
|
||||
|
|
|
@ -816,7 +816,7 @@ bool C4MaterialMap::mrfCorrode(C4MaterialReaction *pReaction, int32_t &iX, int32
|
|||
fDoCorrode = (d100 < ::MaterialMap.Map[iPxsMat].Corrosive) && (d100 < ::MaterialMap.Map[iLsMat].Corrode);
|
||||
if (fDoCorrode)
|
||||
{
|
||||
ClearBackPix(iLSPosX,iLSPosY);
|
||||
::Landscape.ClearPix(iLSPosX,iLSPosY);
|
||||
//::Landscape.CheckInstabilityRange(iLSPosX,iLSPosY); - more correct, but makes acid too effective as well
|
||||
if (!Random(5))
|
||||
{
|
||||
|
@ -843,7 +843,7 @@ bool C4MaterialMap::mrfCorrode(C4MaterialReaction *pReaction, int32_t &iX, int32
|
|||
fDoCorrode = (d100 < ::MaterialMap.Map[iPxsMat].Corrosive) && (d100 < ::MaterialMap.Map[iLsMat].Corrode);
|
||||
if (fDoCorrode)
|
||||
{
|
||||
ClearBackPix(iLSPosX,iLSPosY);
|
||||
::Landscape.ClearPix(iLSPosX,iLSPosY);
|
||||
::Landscape.CheckInstabilityRange(iLSPosX,iLSPosY);
|
||||
if (!Random(5))
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ void C4PXS::Execute()
|
|||
{ Deactivate(); return; }
|
||||
|
||||
// Out of bounds
|
||||
if ((x<0) || (x>=GBackWdt) || (y<-10) || (y>=GBackHgt))
|
||||
if ((x<0) || (x>=::Landscape.GetWidth()) || (y<-10) || (y>=::Landscape.GetHeight()))
|
||||
{ Deactivate(); return; }
|
||||
|
||||
// Material conversion
|
||||
|
@ -80,7 +80,7 @@ void C4PXS::Execute()
|
|||
int32_t iToX = fixtoi(ctcox), iToY = fixtoi(ctcoy);
|
||||
|
||||
// In bounds?
|
||||
if (Inside<int32_t>(iToX, 0, GBackWdt-1) && Inside<int32_t>(iToY, 0, GBackHgt-1))
|
||||
if (Inside<int32_t>(iToX, 0, ::Landscape.GetWidth()-1) && Inside<int32_t>(iToY, 0, ::Landscape.GetHeight()-1))
|
||||
// Check path
|
||||
if (::Landscape._PathFree(iX, iY, iToX, iToY))
|
||||
{
|
||||
|
|
|
@ -534,7 +534,7 @@ float C4ParticleValueProvider::Wind(C4Particle *forParticle)
|
|||
|
||||
float C4ParticleValueProvider::Gravity(C4Particle *forParticle)
|
||||
{
|
||||
return startValue + (speedFactor * ::Landscape.Gravity);
|
||||
return startValue + (speedFactor * ::Landscape.GetGravity());
|
||||
}
|
||||
|
||||
void C4ParticleValueProvider::SetType(C4ParticleValueProviderID what)
|
||||
|
|
|
@ -215,7 +215,7 @@ void C4Sky::Draw(C4TargetFacet &cgo)
|
|||
|
||||
DWORD C4Sky::GetSkyFadeClr(int32_t iY)
|
||||
{
|
||||
int32_t iPos2=(iY*256)/GBackHgt; int32_t iPos1=256-iPos2;
|
||||
int32_t iPos2=(iY*256)/::Landscape.GetHeight(); int32_t iPos1=256-iPos2;
|
||||
return (((((FadeClr1&0xff00ff)*iPos1 + (FadeClr2&0xff00ff)*iPos2) & 0xff00ff00)
|
||||
| (((FadeClr1&0x00ff00)*iPos1 + (FadeClr2&0x00ff00)*iPos2) & 0x00ff0000))>>8)
|
||||
| (FadeClr1 & 0xff000000);
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <C4GameObjects.h>
|
||||
#include <C4DrawGL.h>
|
||||
#include <StdPNG.h>
|
||||
#include "graphics/CSurface8.h"
|
||||
#include "landscape/C4Material.h"
|
||||
|
||||
|
||||
void C4SolidMask::Put(bool fCauseInstability, C4TargetRect *pClipRect, bool fRestoreAttachment)
|
||||
|
@ -75,8 +77,8 @@ void C4SolidMask::Put(bool fCauseInstability, C4TargetRect *pClipRect, bool fRes
|
|||
MaskPutRect.y = oy;
|
||||
if (MaskPutRect.y < 0) { MaskPutRect.ty = -MaskPutRect.y; MaskPutRect.y = 0; }
|
||||
else MaskPutRect.ty = 0;
|
||||
MaskPutRect.Wdt = std::min<int32_t>(ox + pForObject->SolidMask.Wdt, GBackWdt) - MaskPutRect.x;
|
||||
MaskPutRect.Hgt = std::min<int32_t>(oy + pForObject->SolidMask.Hgt, GBackHgt) - MaskPutRect.y;
|
||||
MaskPutRect.Wdt = std::min<int32_t>(ox + pForObject->SolidMask.Wdt, ::Landscape.GetWidth()) - MaskPutRect.x;
|
||||
MaskPutRect.Hgt = std::min<int32_t>(oy + pForObject->SolidMask.Hgt, ::Landscape.GetHeight()) - MaskPutRect.y;
|
||||
}
|
||||
// fill rect with mask
|
||||
for (ycnt=0; ycnt<pClipRect->Hgt; ++ycnt)
|
||||
|
@ -93,7 +95,7 @@ void C4SolidMask::Put(bool fCauseInstability, C4TargetRect *pClipRect, bool fRes
|
|||
if (!MaskPut)
|
||||
{
|
||||
// get background pixel
|
||||
byPixel=GBackPix(iTx,iTy);
|
||||
byPixel=::Landscape.GetPix(iTx,iTy);
|
||||
// store it. If MCVehic, also store in initial put, but won't be used in restore
|
||||
// do not overwrite current value in re-put issued by SolidMask-remover
|
||||
if (!IsSomeVehicle(byPixel) || RegularPut)
|
||||
|
@ -128,8 +130,8 @@ void C4SolidMask::Put(bool fCauseInstability, C4TargetRect *pClipRect, bool fRes
|
|||
MaskPutRect.y = ystart;
|
||||
if (MaskPutRect.y < 0) { MaskPutRect.ty = -MaskPutRect.y; MaskPutRect.Hgt = MaskPutRect.y; MaskPutRect.y = 0; }
|
||||
else { MaskPutRect.ty = 0; MaskPutRect.Hgt = 0; }
|
||||
MaskPutRect.Wdt = std::min<int32_t>(xstart + MatBuffPitch, GBackWdt) - MaskPutRect.x;
|
||||
MaskPutRect.Hgt = std::min<int32_t>(ystart + MatBuffPitch, GBackHgt) - MaskPutRect.y;
|
||||
MaskPutRect.Wdt = std::min<int32_t>(xstart + MatBuffPitch, ::Landscape.GetWidth()) - MaskPutRect.x;
|
||||
MaskPutRect.Hgt = std::min<int32_t>(ystart + MatBuffPitch, ::Landscape.GetHeight()) - MaskPutRect.y;
|
||||
}
|
||||
// go through clipping rect
|
||||
const C4Real y0 = itofix(pClipRect->ty - MatBuffPitch/2);
|
||||
|
@ -159,7 +161,7 @@ void C4SolidMask::Put(bool fCauseInstability, C4TargetRect *pClipRect, bool fRes
|
|||
if (!MaskPut)
|
||||
{
|
||||
// get background pixel
|
||||
byPixel=_GBackPix(iTx,iTy);
|
||||
byPixel=::Landscape._GetPix(iTx,iTy);
|
||||
// store it. If MCVehic, also store in initial put, but won't be used in restore
|
||||
// do not overwrite current value in re-put issued by SolidMask-remover
|
||||
if (!IsSomeVehicle(byPixel) || RegularPut)
|
||||
|
@ -259,7 +261,7 @@ void C4SolidMask::Remove(bool fBackupAttachment)
|
|||
// The pPix-check ensures that only pixels that hads been overwritten by this SolidMask are restored
|
||||
// Non-SolidMask-pixels should not happen here, because all relevant landscape change routines should
|
||||
// temp remove SolidMasks before
|
||||
assert(IsSomeVehicle(_GBackPix(iTx,iTy)));
|
||||
assert(IsSomeVehicle(::Landscape._GetPix(iTx,iTy)));
|
||||
if (IsSomeVehicle(::Landscape._GetPix(iTx, iTy)))
|
||||
::Landscape._SetPix2(iTx, iTy, *pPix, ::Landscape.Transparent);
|
||||
// Instability
|
||||
|
@ -353,7 +355,7 @@ void C4SolidMask::RemoveTemporary(C4Rect where)
|
|||
if (*pPix != MCVehic) //
|
||||
{
|
||||
// restore
|
||||
assert(IsSomeVehicle(GBackPix(x,y)));
|
||||
assert(IsSomeVehicle(::Landscape.GetPix(x,y)));
|
||||
::Landscape._SetPix2Tmp(x, y, *pPix, ::Landscape.Transparent);
|
||||
}
|
||||
}
|
||||
|
@ -374,7 +376,7 @@ void C4SolidMask::PutTemporary(C4Rect where)
|
|||
if (*pPix != MCVehic)
|
||||
{
|
||||
// put
|
||||
assert(GBackPix(x,y)==*pPix);
|
||||
assert(::Landscape.GetPix(x,y)==*pPix);
|
||||
::Landscape._SetPix2Tmp(x, y, MaskMaterial, ::Landscape.Transparent);
|
||||
}
|
||||
}
|
||||
|
@ -395,7 +397,7 @@ void C4SolidMask::Repair(C4Rect where)
|
|||
if (*pPix != MCVehic)
|
||||
{
|
||||
// record changed landscape in MatBuff
|
||||
*pPix = GBackPix(x,y);
|
||||
*pPix = ::Landscape.GetPix(x,y);
|
||||
// put
|
||||
::Landscape.SetPix2(x, y, MaskMaterial, ::Landscape.Transparent);
|
||||
}
|
||||
|
@ -439,7 +441,7 @@ C4SolidMask::~C4SolidMask()
|
|||
|
||||
void C4SolidMask::RemoveSolidMasks()
|
||||
{
|
||||
C4Rect SolidMaskRect(0,0,GBackWdt,GBackHgt);
|
||||
C4Rect SolidMaskRect(0,0,::Landscape.GetWidth(),::Landscape.GetHeight());
|
||||
C4SolidMask *pSolid;
|
||||
for (pSolid = C4SolidMask::Last; pSolid; pSolid = pSolid->Prev)
|
||||
{
|
||||
|
@ -449,7 +451,7 @@ void C4SolidMask::RemoveSolidMasks()
|
|||
|
||||
void C4SolidMask::PutSolidMasks()
|
||||
{
|
||||
C4Rect SolidMaskRect(0,0,GBackWdt,GBackHgt);
|
||||
C4Rect SolidMaskRect(0,0,::Landscape.GetWidth(),::Landscape.GetHeight());
|
||||
C4SolidMask *pSolid;
|
||||
// Restore Solidmasks
|
||||
for (pSolid = C4SolidMask::First; pSolid; pSolid = pSolid->Next)
|
||||
|
@ -467,7 +469,7 @@ C4SolidMask * C4SolidMask::Last = 0;
|
|||
bool C4SolidMask::CheckConsistency()
|
||||
{
|
||||
assert(IsSomeVehicle(MaskMaterial));
|
||||
C4Rect SolidMaskRect(0,0,GBackWdt,GBackHgt);
|
||||
C4Rect SolidMaskRect(0,0,::Landscape.GetWidth(),::Landscape.GetHeight());
|
||||
C4SolidMask *pSolid;
|
||||
for (pSolid = C4SolidMask::Last; pSolid; pSolid = pSolid->Prev)
|
||||
{
|
||||
|
|
|
@ -175,7 +175,7 @@ void C4TextureShapeActivationMap::Add(int32_t block_x, int32_t block_y, int32_t
|
|||
}
|
||||
|
||||
|
||||
void C4TextureShape::Draw(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX, int32_t iOffY, int32_t MapZoom, int32_t min_overlap_ratio)
|
||||
void C4TextureShape::Draw(const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX, int32_t iOffY, int32_t MapZoom, int32_t min_overlap_ratio)
|
||||
{
|
||||
// Safety
|
||||
if (!num_shapes) return;
|
||||
|
@ -183,8 +183,8 @@ void C4TextureShape::Draw(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMap
|
|||
// Add max polygon size because polygons may extent far onto outside pixels
|
||||
int32_t x0 = std::max<int32_t>(0, iMapX*MapZoom + iOffX - GetMaxPolyWidth()),
|
||||
y0 = std::max<int32_t>(0, iMapY*MapZoom + iOffY - GetMaxPolyHeight());
|
||||
int32_t x1 = std::min<int32_t>(::Landscape.Width, x0 + iMapWdt*MapZoom + GetMaxPolyWidth() * 2),
|
||||
y1 = std::min<int32_t>(::Landscape.Height, y0 + iMapHgt*MapZoom + GetMaxPolyHeight() * 2);
|
||||
int32_t x1 = std::min<int32_t>(::Landscape.GetWidth(), x0 + iMapWdt*MapZoom + GetMaxPolyWidth() * 2),
|
||||
y1 = std::min<int32_t>(::Landscape.GetHeight(), y0 + iMapHgt*MapZoom + GetMaxPolyHeight() * 2);
|
||||
// Range in shape blocks.
|
||||
// A shape block is the coverage of the size of one loaded shape data surface
|
||||
int32_t rblock_x0 = x0 / data.Wdt;
|
||||
|
@ -202,11 +202,11 @@ void C4TextureShape::Draw(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMap
|
|||
{
|
||||
for (int32_t map_x = iMapX; map_x < iMapX + iMapWdt; ++map_x)
|
||||
{
|
||||
if (sfcMap->GetPix(map_x, map_y) == iTexture)
|
||||
if (sfcMap.GetPix(map_x, map_y) == iTexture)
|
||||
{
|
||||
// Here we have a pixel of the texture drawn in this shape
|
||||
// Find all shapes covered by this map pixel and remember background pixel for them
|
||||
const BYTE pixBkg = sfcMapBkg->GetPix(map_x, map_y);
|
||||
const BYTE pixBkg = sfcMapBkg.GetPix(map_x, map_y);
|
||||
// Find all shape blocks to be checked
|
||||
int32_t px_check_rate = 1; // sample rate to check coverage, in pixels. Could also increase this if it turns out to be a bottleneck
|
||||
for (int32_t pxo_y = 0; pxo_y < MapZoom; pxo_y += px_check_rate)
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
int32_t GetMaxPolyWidth() const { return GetWidth() / 4; }
|
||||
int32_t GetMaxPolyHeight() const { return GetHeight() / 4; }
|
||||
|
||||
void Draw(CSurface8 * sfcMap, CSurface8* sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX, int32_t iOffY, int32_t MapZoom, int32_t min_overlap_ratio);
|
||||
void Draw(const CSurface8 &sfcMap, const CSurface8 &sfcMapBkg, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, uint8_t iTexture, int32_t iOffX, int32_t iOffY, int32_t MapZoom, int32_t min_overlap_ratio);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -70,8 +70,8 @@ struct LightMapZoom {
|
|||
bool operator()(int x, int y) const
|
||||
{
|
||||
// Landscape coordinates
|
||||
const int lx = Clamp(static_cast<int>((x + 0.5) * sx), 0, Landscape.Width - 1);
|
||||
const int ly = Clamp(static_cast<int>((y + 0.5) * sy), 0, Landscape.Height - 1);
|
||||
const int lx = Clamp(static_cast<int>((x + 0.5) * sx), 0, Landscape.GetWidth() - 1);
|
||||
const int ly = Clamp(static_cast<int>((y + 0.5) * sy), 0, Landscape.GetHeight() - 1);
|
||||
// LightMap check
|
||||
return ::Landscape._GetLight(lx, ly);
|
||||
}
|
||||
|
@ -124,8 +124,8 @@ void C4FoWAmbient::CreateFromLandscape(const C4Landscape& landscape, double reso
|
|||
FullCoverage = full_coverage;
|
||||
|
||||
// Number of zoomed pixels
|
||||
LandscapeX = landscape.Width;
|
||||
LandscapeY = landscape.Height;
|
||||
LandscapeX = Landscape.GetWidth();
|
||||
LandscapeY = Landscape.GetHeight();
|
||||
SizeX = std::min<unsigned int>(static_cast<unsigned int>(ceil(LandscapeX / resolution)), pDraw->MaxTexSize);
|
||||
SizeY = std::min<unsigned int>(static_cast<unsigned int>(ceil(LandscapeY / resolution)), pDraw->MaxTexSize);
|
||||
|
||||
|
@ -139,7 +139,7 @@ void C4FoWAmbient::CreateFromLandscape(const C4Landscape& landscape, double reso
|
|||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, SizeX, SizeY, 0, GL_RED, GL_FLOAT, NULL);
|
||||
|
||||
const C4TimeMilliseconds begin = C4TimeMilliseconds::Now();
|
||||
UpdateFromLandscape(landscape, C4Rect(0, 0, landscape.Width, landscape.Height));
|
||||
UpdateFromLandscape(landscape, C4Rect(0, 0, Landscape.GetWidth(), Landscape.GetHeight()));
|
||||
uint32_t dt = C4TimeMilliseconds::Now() - begin;
|
||||
LogF("Created %ux%u ambient map in %g secs", SizeX, SizeY, dt / 1000.);
|
||||
#endif
|
||||
|
@ -154,8 +154,8 @@ void C4FoWAmbient::UpdateFromLandscape(const C4Landscape& landscape, const C4Rec
|
|||
assert(Tex != 0);
|
||||
|
||||
// Factor to go from zoomed to landscape coordinates
|
||||
const double zoom_x = static_cast<double>(landscape.Width) / SizeX;
|
||||
const double zoom_y = static_cast<double>(landscape.Height) / SizeY;
|
||||
const double zoom_x = static_cast<double>(Landscape.GetWidth()) / SizeX;
|
||||
const double zoom_y = static_cast<double>(Landscape.GetHeight()) / SizeY;
|
||||
// Update region in zoomed coordinates
|
||||
const unsigned int left = std::max(static_cast<int>( (update.x - Radius) / zoom_x), 0);
|
||||
const unsigned int right = std::min(static_cast<unsigned int>( (update.x + update.Wdt + Radius) / zoom_x), SizeX - 1) + 1;
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#define C4FOWAMBIENT_H
|
||||
|
||||
#include <C4Landscape.h>
|
||||
#ifndef USE_CONSOLE
|
||||
#include <GL/glew.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
This class manages a texture that holds the ambient light intensity
|
||||
|
@ -62,7 +65,7 @@ public:
|
|||
void UpdateFromLandscape(const C4Landscape& landscape, const C4Rect& update);
|
||||
|
||||
// Fills a 2x3 matrix to transform fragment coordinates to ambient map texture coordinates
|
||||
void GetFragTransform(const FLOAT_RECT& vpRect, const C4Rect& clipRect, const C4Rect& outRect, float ambientTransform[6]) const;
|
||||
void GetFragTransform(const struct FLOAT_RECT& vpRect, const C4Rect& clipRect, const C4Rect& outRect, float ambientTransform[6]) const;
|
||||
|
||||
unsigned int GetLandscapeWidth() const { return LandscapeX; }
|
||||
unsigned int GetLandscapeHeight() const { return LandscapeY; }
|
||||
|
|
|
@ -134,7 +134,7 @@ void C4FoWLightSection::Update(C4Rect RectIn)
|
|||
{
|
||||
// Transform rectangle into our coordinate system
|
||||
C4Rect Rect = rtransRect(RectIn);
|
||||
C4Rect Bounds = rtransRect(C4Rect(0,0,GBackWdt,GBackHgt));
|
||||
C4Rect Bounds = rtransRect(C4Rect(0,0,::Landscape.GetWidth(),::Landscape.GetHeight()));
|
||||
|
||||
#ifdef LIGHT_DEBUG
|
||||
if (!::Game.iTick255) {
|
||||
|
|
|
@ -14,13 +14,48 @@
|
|||
*/
|
||||
|
||||
#include "C4Include.h"
|
||||
#include <array>
|
||||
|
||||
#include "C4Landscape.h"
|
||||
#include "C4Texture.h"
|
||||
#include "graphics/CSurface8.h"
|
||||
#include "landscape/C4Landscape.h"
|
||||
#include "landscape/C4Texture.h"
|
||||
|
||||
/* This is a small part of the implementation of C4Landscape for what is
|
||||
* required by mape. We cannot link the full implementation since it would
|
||||
* introduce a dependency on C4Game, and therefore the rest of the engine. */
|
||||
|
||||
struct C4Landscape::P
|
||||
{
|
||||
int32_t Pix2Mat[C4M_MaxTexIndex], Pix2Dens[C4M_MaxTexIndex], Pix2Place[C4M_MaxTexIndex];
|
||||
bool Pix2Light[C4M_MaxTexIndex];
|
||||
mutable std::array<std::unique_ptr<uint8_t[]>, C4M_MaxTexIndex> BridgeMatConversion;
|
||||
int32_t Width = 0, Height = 0;
|
||||
std::unique_ptr<CSurface8> Surface8;
|
||||
};
|
||||
|
||||
C4Landscape::C4Landscape() : p(new P) {}
|
||||
C4Landscape::~C4Landscape() {}
|
||||
bool C4Landscape::FindMatSlide(int&, int&, int, int, int) const { return false; }
|
||||
int32_t C4Landscape::ExtractMaterial(int32_t, int32_t, bool) { return 0; }
|
||||
bool C4Landscape::InsertMaterial(int32_t, int32_t *, int32_t *, int32_t, int32_t, bool) { return false; }
|
||||
bool C4Landscape::Incinerate(int32_t, int32_t, int32_t) { return false; }
|
||||
bool C4Landscape::ClearPix(int32_t, int32_t) { return false; }
|
||||
void C4Landscape::CheckInstabilityRange(int32_t, int32_t) {}
|
||||
|
||||
int32_t C4Landscape::GetDensity(int32_t x, int32_t y) const { return p->Pix2Dens[GetPix(x, y)]; }
|
||||
int32_t C4Landscape::GetPixDensity(BYTE byPix) const { return p->Pix2Dens[byPix]; }
|
||||
C4Real C4Landscape::GetGravity() const { return C4REAL100(20); }
|
||||
int32_t C4Landscape::GetMat(int32_t x, int32_t y) const { return p->Pix2Mat[GetPix(x, y)]; }
|
||||
|
||||
BYTE C4Landscape::GetPix(int32_t x, int32_t y) const // get landscape pixel (bounds checked)
|
||||
{
|
||||
extern BYTE MCVehic;
|
||||
// Border checks
|
||||
if (x < 0 || x >= p->Width) return MCVehic;
|
||||
if (y < 0 || y >= p->Height) return MCVehic;
|
||||
return p->Surface8->_GetPix(x, y);
|
||||
}
|
||||
|
||||
int32_t PixCol2Mat(BYTE pixc)
|
||||
{
|
||||
// Get texture
|
||||
|
@ -40,15 +75,11 @@ void C4Landscape::HandleTexMapUpdate()
|
|||
void C4Landscape::UpdatePixMaps() // Copied from C4Landscape.cpp
|
||||
{
|
||||
int32_t i;
|
||||
for (i = 0; i < C4M_MaxTexIndex; i++) Pix2Mat[i] = PixCol2Mat(i);
|
||||
for (i = 0; i < C4M_MaxTexIndex; i++) Pix2Dens[i] = MatDensity(Pix2Mat[i]);
|
||||
for (i = 0; i < C4M_MaxTexIndex; i++) Pix2Place[i] = MatValid(Pix2Mat[i]) ? ::MaterialMap.Map[Pix2Mat[i]].Placement : 0;
|
||||
for (i = 0; i < C4M_MaxTexIndex; i++) Pix2Light[i] = MatValid(Pix2Mat[i]) && (::MaterialMap.Map[Pix2Mat[i]].Light>0);
|
||||
Pix2Place[0] = 0;
|
||||
for (i = 0; i < C4M_MaxTexIndex; i++) p->Pix2Mat[i] = PixCol2Mat(i);
|
||||
for (i = 0; i < C4M_MaxTexIndex; i++) p->Pix2Dens[i] = MatDensity(p->Pix2Mat[i]);
|
||||
for (i = 0; i < C4M_MaxTexIndex; i++) p->Pix2Place[i] = MatValid(p->Pix2Mat[i]) ? ::MaterialMap.Map[p->Pix2Mat[i]].Placement : 0;
|
||||
for (i = 0; i < C4M_MaxTexIndex; i++) p->Pix2Light[i] = MatValid(p->Pix2Mat[i]) && (::MaterialMap.Map[p->Pix2Mat[i]].Light>0);
|
||||
p->Pix2Place[0] = 0;
|
||||
// clear bridge mat conversion buffers
|
||||
for (int32_t i = 0; i < C4M_MaxTexIndex; ++i)
|
||||
{
|
||||
delete [] BridgeMatConversion[i];
|
||||
BridgeMatConversion[i] = NULL;
|
||||
}
|
||||
std::fill(p->BridgeMatConversion.begin(), p->BridgeMatConversion.end(), nullptr);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "C4Record.h"
|
||||
#include "C4RoundResults.h"
|
||||
#include "C4TextureShape.h"
|
||||
#include "landscape/C4Sky.h"
|
||||
|
||||
/* This file implements stubs for the parts of the engine that are not used
|
||||
* by mape. */
|
||||
|
@ -76,15 +77,6 @@ void C4DefList::ResetIncludeDependencies() {}
|
|||
bool C4DefList::DrawFontImage(const char* szImageTag, C4Facet& rTarget, C4DrawTransform* pTransform) { return false; }
|
||||
float C4DefList::GetFontImageAspect(const char* szImageTag) { return -1.0f; }
|
||||
|
||||
C4Landscape::C4Landscape() {}
|
||||
C4Landscape::~C4Landscape() {}
|
||||
bool C4Landscape::FindMatSlide(int&, int&, int, int, int) const { return false; }
|
||||
int32_t C4Landscape::ExtractMaterial(int32_t, int32_t, bool) { return 0; }
|
||||
bool C4Landscape::InsertMaterial(int32_t, int32_t *, int32_t *, int32_t, int32_t, bool) { return false; }
|
||||
bool C4Landscape::Incinerate(int32_t, int32_t, int32_t) { return false; }
|
||||
bool C4Landscape::ClearPix(int32_t, int32_t) { return false; }
|
||||
void C4Landscape::CheckInstabilityRange(int32_t, int32_t) {}
|
||||
|
||||
void C4Sky::Default() {}
|
||||
C4Sky::~C4Sky() {}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ bool FreeMoveTo(C4Object *cObj)
|
|||
void AdjustMoveToTarget(int32_t &rX, int32_t &rY, bool fFreeMove, int32_t iShapeHgt)
|
||||
{
|
||||
// Above solid (always)
|
||||
int32_t iY=std::min(rY, GBackHgt);
|
||||
int32_t iY=std::min(rY, ::Landscape.GetHeight());
|
||||
while ((iY>=0) && GBackSolid(rX,iY)) iY--;
|
||||
if (iY>=0) rY=iY;
|
||||
// No-free-move adjustments (i.e. if walking)
|
||||
|
@ -152,8 +152,8 @@ void AdjustMoveToTarget(int32_t &rX, int32_t &rY, bool fFreeMove, int32_t iShape
|
|||
// Drop down to bottom of free space
|
||||
if (!GBackSemiSolid(rX,rY))
|
||||
{
|
||||
for (iY=rY; (iY<GBackHgt) && !GBackSemiSolid(rX,iY+1); iY++) {}
|
||||
if (iY<GBackHgt) rY=iY;
|
||||
for (iY=rY; (iY<::Landscape.GetHeight()) && !GBackSemiSolid(rX,iY+1); iY++) {}
|
||||
if (iY<::Landscape.GetHeight()) rY=iY;
|
||||
}
|
||||
// Vertical shape offset above solid
|
||||
if (GBackSolid(rX,rY+1) || GBackSolid(rX,rY+5))
|
||||
|
|
|
@ -169,7 +169,7 @@ void C4Object::SideBounds(C4Real &ctcox)
|
|||
}
|
||||
// landscape bounds
|
||||
C4Real lbound = itofix(0 - Shape.GetX()),
|
||||
rbound = itofix(GBackWdt - (Shape.GetX() + Shape.Wdt));
|
||||
rbound = itofix(::Landscape.GetWidth() - (Shape.GetX() + Shape.Wdt));
|
||||
if (ctcox < lbound && GetPropertyInt(P_BorderBound) & C4D_Border_Sides)
|
||||
StopAndContact(ctcox, lbound, xdir, CNAT_Left);
|
||||
if (ctcox > rbound && GetPropertyInt(P_BorderBound) & C4D_Border_Sides)
|
||||
|
@ -192,7 +192,7 @@ void C4Object::VerticalBounds(C4Real &ctcoy)
|
|||
}
|
||||
// landscape bounds
|
||||
C4Real tbound = itofix(0 - Shape.GetY()),
|
||||
bbound = itofix(GBackHgt - (Shape.GetY() + Shape.Hgt));
|
||||
bbound = itofix(::Landscape.GetHeight() - (Shape.GetY() + Shape.Hgt));
|
||||
if (ctcoy < tbound && GetPropertyInt(P_BorderBound) & C4D_Border_Top)
|
||||
StopAndContact(ctcoy, tbound, ydir, CNAT_Top);
|
||||
if (ctcoy > bbound && GetPropertyInt(P_BorderBound) & C4D_Border_Bottom)
|
||||
|
@ -578,8 +578,8 @@ bool C4Object::ExecMovement() // Every Tick1 by Execute
|
|||
if (!Def->Rotateable) fix_r=Fix0;
|
||||
|
||||
// Out of bounds check
|
||||
if ((!Inside<int32_t>(GetX() + Shape.GetX(), -Shape.Wdt, GBackWdt) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Sides))
|
||||
|| ((GetY() + Shape.GetY() > GBackHgt) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Bottom)))
|
||||
if ((!Inside<int32_t>(GetX() + Shape.GetX(), -Shape.Wdt, ::Landscape.GetWidth()) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Sides))
|
||||
|| ((GetY() + Shape.GetY() > ::Landscape.GetHeight()) && !(GetPropertyInt(P_BorderBound) & C4D_Border_Bottom)))
|
||||
{
|
||||
C4PropList* pActionDef = GetAction();
|
||||
// Never remove attached objects: If they are truly outside landscape, their target will be removed,
|
||||
|
@ -593,9 +593,9 @@ bool C4Object::ExecMovement() // Every Tick1 by Execute
|
|||
int parX, parY;
|
||||
GetParallaxity(&parX, &parY);
|
||||
fRemove = false;
|
||||
if (GetX()>GBackWdt || GetY()>GBackHgt) fRemove = true; // except if they are really out of the viewport to the right...
|
||||
if (GetX()>::Landscape.GetWidth() || GetY()>::Landscape.GetHeight()) fRemove = true; // except if they are really out of the viewport to the right...
|
||||
else if (GetX()<0 && !!parX) fRemove = true; // ...or it's not HUD horizontally and it's out to the left
|
||||
else if (!parX && GetX()<-GBackWdt) fRemove = true; // ...or it's HUD horizontally and it's out to the left
|
||||
else if (!parX && GetX()<-::Landscape.GetWidth()) fRemove = true; // ...or it's HUD horizontally and it's out to the left
|
||||
}
|
||||
if (fRemove)
|
||||
{
|
||||
|
@ -628,7 +628,7 @@ bool SimFlight(C4Real &x, C4Real &y, C4Real &xdir, C4Real &ydir, int32_t iDensit
|
|||
// Movement to target
|
||||
ctcox=fixtoi(x); ctcoy=fixtoi(y);
|
||||
// Bounds
|
||||
if (!Inside<int32_t>(ctcox,0,GBackWdt) || (ctcoy>=GBackHgt))
|
||||
if (!Inside<int32_t>(ctcox,0,::Landscape.GetWidth()) || (ctcoy>=::Landscape.GetHeight()))
|
||||
return false;
|
||||
// Move to target
|
||||
do
|
||||
|
|
|
@ -4190,7 +4190,7 @@ bool C4Object::SetLightColor(uint32_t iValue)
|
|||
|
||||
void C4Object::UpdateLight()
|
||||
{
|
||||
if (Landscape.pFoW) Landscape.pFoW->Add(this);
|
||||
if (Landscape.HasFoW()) Landscape.GetFoW()->Add(this);
|
||||
}
|
||||
|
||||
void C4Object::SetAudibilityAt(C4TargetFacet &cgo, int32_t iX, int32_t iY, int32_t player)
|
||||
|
@ -4696,7 +4696,7 @@ bool C4Object::StatusDeactivate(bool fClearPointers)
|
|||
// put into inactive list
|
||||
::Objects.Remove(this);
|
||||
Status = C4OS_INACTIVE;
|
||||
if (Landscape.pFoW) Landscape.pFoW->Remove(this);
|
||||
if (Landscape.HasFoW()) Landscape.GetFoW()->Remove(this);
|
||||
::Objects.InactiveObjects.Add(this, C4ObjectList::stMain);
|
||||
// if desired, clear game pointers
|
||||
if (fClearPointers)
|
||||
|
|
|
@ -177,7 +177,7 @@ void C4Shape::GetVertexOutline(C4Rect &rRect)
|
|||
|
||||
inline bool C4Shape::CheckTouchableMaterial(int32_t x, int32_t y, int32_t vtx_i, int32_t ydir, const C4DensityProvider &rDensityProvider) {
|
||||
return rDensityProvider.GetDensity(x,y) >= ContactDensity &&
|
||||
((ydir > 0 && !(CNAT_PhaseHalfVehicle & VtxCNAT[vtx_i])) || !IsMCHalfVehicle(GBackPix(x,y)));
|
||||
((ydir > 0 && !(CNAT_PhaseHalfVehicle & VtxCNAT[vtx_i])) || !IsMCHalfVehicle(::Landscape.GetPix(x,y)));
|
||||
}
|
||||
|
||||
// Adjust given position to one pixel before contact
|
||||
|
@ -389,7 +389,7 @@ bool C4Shape::ContactCheck(int32_t cx, int32_t cy, uint32_t *border_hack_contact
|
|||
if (border_hack_contacts)
|
||||
{
|
||||
if (x == 0 && CheckTouchableMaterial(x-1, y, cvtx)) *border_hack_contacts |= CNAT_Left;
|
||||
else if (x == ::Landscape.Width && CheckTouchableMaterial(x+1, y, cvtx)) *border_hack_contacts |= CNAT_Right;
|
||||
else if (x == ::Landscape.GetWidth() && CheckTouchableMaterial(x+1, y, cvtx)) *border_hack_contacts |= CNAT_Right;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -245,16 +245,16 @@ bool C4Viewport::ScrollBarsByViewPosition()
|
|||
{
|
||||
if (PlayerLock) return false;
|
||||
NSScrollView* scrollView = pWindow->objectiveCObject<C4WindowController>().scrollView;
|
||||
[scrollView.horizontalScroller setToLandscapeCoordinate:GetViewX() size:GBackWdt viewportSize:ViewWdt zoom:GetZoom()];
|
||||
[scrollView.verticalScroller setToLandscapeCoordinate:GetViewY() size:GBackHgt viewportSize:ViewHgt zoom:GetZoom()];
|
||||
[scrollView.horizontalScroller setToLandscapeCoordinate:GetViewX() size:Landscape.GetWidth() viewportSize:ViewWdt zoom:GetZoom()];
|
||||
[scrollView.verticalScroller setToLandscapeCoordinate:GetViewY() size:Landscape.GetHeight() viewportSize:ViewHgt zoom:GetZoom()];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool C4Viewport::ViewPositionByScrollBars()
|
||||
{
|
||||
NSScrollView* scrollView = pWindow->objectiveCObject<C4WindowController>().scrollView;
|
||||
SetViewX([scrollView.horizontalScroller landscapeCoordinateForSize:GBackWdt viewportSize:ViewWdt zoom:GetZoom()]);
|
||||
SetViewY([scrollView.verticalScroller landscapeCoordinateForSize:GBackHgt viewportSize:ViewHgt zoom:GetZoom()]);
|
||||
SetViewX([scrollView.horizontalScroller landscapeCoordinateForSize:Landscape.GetWidth() viewportSize:ViewWdt zoom:GetZoom()]);
|
||||
SetViewY([scrollView.verticalScroller landscapeCoordinateForSize:Landscape.GetHeight() viewportSize:ViewHgt zoom:GetZoom()]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -196,8 +196,8 @@ void C4Player::Execute()
|
|||
{
|
||||
// player has selected a team that has a valid start position assigned
|
||||
// set view to this position!
|
||||
ViewX = Game.C4S.PlrStart[iPlrStartIndex-1].Position[0] * ::Landscape.MapZoom;
|
||||
ViewY = Game.C4S.PlrStart[iPlrStartIndex-1].Position[1] * ::Landscape.MapZoom;
|
||||
ViewX = Game.C4S.PlrStart[iPlrStartIndex-1].Position[0] * ::Landscape.GetMapZoom();
|
||||
ViewY = Game.C4S.PlrStart[iPlrStartIndex-1].Position[1] * ::Landscape.GetMapZoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ bool C4Player::Init(int32_t iNumber, int32_t iAtClient, const char *szAtClientNa
|
|||
Name.Copy(pInfo->GetName());
|
||||
|
||||
// view pos init: Start at center pos
|
||||
ViewX = GBackWdt/2; ViewY = GBackHgt/2;
|
||||
ViewX = ::Landscape.GetWidth()/2; ViewY = ::Landscape.GetHeight()/2;
|
||||
|
||||
// Scenario init
|
||||
if (fScenarioInit)
|
||||
|
@ -632,8 +632,8 @@ bool C4Player::ScenarioInit()
|
|||
pty = Game.C4S.PlrStart[PlrStartIndex].Position[1];
|
||||
|
||||
// Zoomed position
|
||||
if (ptx>-1) ptx = Clamp<int32_t>( ptx * Game.C4S.Landscape.MapZoom.Evaluate(), 0, GBackWdt-1 );
|
||||
if (pty>-1) pty = Clamp<int32_t>( pty * Game.C4S.Landscape.MapZoom.Evaluate(), 0, GBackHgt-1 );
|
||||
if (ptx>-1) ptx = Clamp<int32_t>( ptx * Game.C4S.Landscape.MapZoom.Evaluate(), 0, ::Landscape.GetWidth()-1 );
|
||||
if (pty>-1) pty = Clamp<int32_t>( pty * Game.C4S.Landscape.MapZoom.Evaluate(), 0, ::Landscape.GetHeight()-1 );
|
||||
|
||||
// Standard position (PrefPosition)
|
||||
if (ptx<0)
|
||||
|
@ -653,12 +653,12 @@ bool C4Player::ScenarioInit()
|
|||
}
|
||||
Position=iPosition;
|
||||
// Set x position
|
||||
ptx=Clamp(16+Position*(GBackWdt-32)/(iMaxPos-1),0,GBackWdt-16);
|
||||
ptx=Clamp(16+Position*(::Landscape.GetWidth()-32)/(iMaxPos-1),0,::Landscape.GetWidth()-16);
|
||||
}
|
||||
|
||||
// All-random position
|
||||
if (ptx<0) ptx=16+Random(GBackWdt-32);
|
||||
if (pty<0) pty=16+Random(GBackHgt-32);
|
||||
if (ptx<0) ptx=16+Random(::Landscape.GetWidth()-32);
|
||||
if (pty<0) pty=16+Random(::Landscape.GetHeight()-32);
|
||||
|
||||
// Place to solid ground
|
||||
if (!Game.C4S.PlrStart[PlrStartIndex].EnforcePosition)
|
||||
|
@ -1359,8 +1359,8 @@ void C4Player::ScrollView(float iX, float iY, float ViewWdt, float ViewHgt)
|
|||
if (ViewLock) return;
|
||||
SetViewMode(C4PVM_Scrolling);
|
||||
float ViewportScrollBorder = Application.isEditor ? 0 : C4ViewportScrollBorder;
|
||||
ViewX = Clamp<C4Real>( ViewX+ftofix(iX), ftofix(ViewWdt/2.0f-ViewportScrollBorder), ftofix(GBackWdt+ViewportScrollBorder-ViewWdt/2.0f) );
|
||||
ViewY = Clamp<C4Real>( ViewY+ftofix(iY), ftofix(ViewHgt/2.0f-ViewportScrollBorder), ftofix(GBackHgt+ViewportScrollBorder-ViewHgt/2.0f) );
|
||||
ViewX = Clamp<C4Real>( ViewX+ftofix(iX), ftofix(ViewWdt/2.0f-ViewportScrollBorder), ftofix(::Landscape.GetWidth()+ViewportScrollBorder-ViewWdt/2.0f) );
|
||||
ViewY = Clamp<C4Real>( ViewY+ftofix(iY), ftofix(ViewHgt/2.0f-ViewportScrollBorder), ftofix(::Landscape.GetHeight()+ViewportScrollBorder-ViewHgt/2.0f) );
|
||||
}
|
||||
|
||||
void C4Player::ClearControl()
|
||||
|
|
Loading…
Reference in New Issue