forked from Mirrors/openclonk
Move Game.Material to ::MaterialMap
parent
31e27e91f5
commit
4d047ed20f
|
@ -33,7 +33,6 @@
|
|||
#include <C4GameObjects.h>
|
||||
#include <C4Scenario.h>
|
||||
#include <C4PlayerList.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4GameControl.h>
|
||||
#include <C4Control.h>
|
||||
#include <C4PathFinder.h>
|
||||
|
@ -76,7 +75,6 @@ class C4Game
|
|||
C4PlayerInfoList &RestorePlayerInfos; // Shortcut
|
||||
C4RoundResults RoundResults;
|
||||
C4Weather Weather;
|
||||
C4MaterialMap Material;
|
||||
C4GameObjects Objects;
|
||||
C4ObjectList BackObjects; // objects in background (C4D_Background)
|
||||
C4ObjectList ForeObjects; // objects in foreground (C4D_Foreground)
|
||||
|
|
|
@ -199,6 +199,8 @@ class C4MaterialMap
|
|||
BOOL SortEnumeration(int32_t iMat, const char *szMatName);
|
||||
};
|
||||
|
||||
extern C4MaterialMap MaterialMap;
|
||||
|
||||
const int32_t C4M_Flat = 0,
|
||||
C4M_TopFlat = 1,
|
||||
C4M_Smooth = 2,
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "C4Texture.h"
|
||||
#include "C4GraphicsSystem.h"
|
||||
#include "C4GraphicsResource.h"
|
||||
#include <C4Material.h>
|
||||
#endif
|
||||
|
||||
//=================================== ID2Def ==============================================
|
||||
|
@ -123,7 +124,7 @@ int32_t PixCol2MatOld2(BYTE pixc);
|
|||
|
||||
inline bool MatValid(int32_t mat)
|
||||
{
|
||||
return Inside<int32_t>(mat,0,Game.Material.Num-1);
|
||||
return Inside<int32_t>(mat,0,::MaterialMap.Num-1);
|
||||
}
|
||||
|
||||
inline bool MatVehicle(int32_t iMat)
|
||||
|
@ -159,25 +160,25 @@ inline BYTE MatTex2PixCol(int32_t tex)
|
|||
|
||||
inline BYTE Mat2PixColDefault(int32_t mat)
|
||||
{
|
||||
return Game.Material.Map[mat].DefaultMatTex;
|
||||
return ::MaterialMap.Map[mat].DefaultMatTex;
|
||||
}
|
||||
|
||||
inline int32_t MatDensity(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 0;
|
||||
return Game.Material.Map[mat].Density;
|
||||
return ::MaterialMap.Map[mat].Density;
|
||||
}
|
||||
|
||||
inline int32_t MatPlacement(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 0;
|
||||
return Game.Material.Map[mat].Placement;
|
||||
return ::MaterialMap.Map[mat].Placement;
|
||||
}
|
||||
|
||||
inline int32_t MatDigFree(int32_t mat)
|
||||
{
|
||||
if (!MatValid(mat)) return 1;
|
||||
return Game.Material.Map[mat].DigFree;
|
||||
return ::MaterialMap.Map[mat].DigFree;
|
||||
}
|
||||
|
||||
inline BYTE GBackIFT(int32_t x, int32_t y)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#ifndef BIG_C4INCLUDE
|
||||
#include <C4Def.h>
|
||||
#include <C4Material.h>
|
||||
#include <C4Game.h>
|
||||
#endif
|
||||
|
||||
|
@ -266,7 +267,7 @@ void C4AulScriptEngine::Link(C4DefList *rDefs)
|
|||
}
|
||||
|
||||
// update material pointers
|
||||
Game.Material.UpdateScriptPointers();
|
||||
::MaterialMap.UpdateScriptPointers();
|
||||
|
||||
// display state
|
||||
LogF("C4AulScriptEngine linked - %d line%s, %d warning%s, %d error%s",
|
||||
|
@ -305,7 +306,7 @@ void C4AulScriptEngine::ReLink(C4DefList *rDefs)
|
|||
Game.Objects.UpdateScriptPointers();
|
||||
|
||||
// update material pointers
|
||||
Game.Material.UpdateScriptPointers();
|
||||
::MaterialMap.UpdateScriptPointers();
|
||||
}
|
||||
|
||||
BOOL C4AulScriptEngine::ReloadScript(const char *szScript, C4DefList *pDefs)
|
||||
|
|
|
@ -1002,7 +1002,7 @@ void C4ControlEMDrawTool::Execute() const
|
|||
break;
|
||||
case EMDT_Fill: // fill tool
|
||||
{
|
||||
int iMat = Game.Material.Get(szMaterial);
|
||||
int iMat = ::MaterialMap.Get(szMaterial);
|
||||
if (!MatValid(iMat)) return;
|
||||
for (int cnt=0; cnt<iGrade; cnt++)
|
||||
::Landscape.InsertMaterial(iMat,iX+Random(iGrade)-iGrade/2,iY+Random(iGrade)-iGrade/2);
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <C4ObjectMenu.h>
|
||||
#include <C4Player.h>
|
||||
#include <C4Log.h>
|
||||
#include <C4Material.h>
|
||||
#endif
|
||||
|
||||
//-------------------------------- C4DefGraphics -----------------------------------------------
|
||||
|
|
|
@ -193,7 +193,7 @@ BOOL C4EditCursor::UpdateStatusBar()
|
|||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
case C4CNS_ModeDraw:
|
||||
str.Format("%i/%i (%s)",X,Y,MatValid(GBackMat(X,Y)) ? Game.Material.Map[GBackMat(X,Y)].Name : LoadResStr("IDS_CNS_NOTHING") );
|
||||
str.Format("%i/%i (%s)",X,Y,MatValid(GBackMat(X,Y)) ? ::MaterialMap.Map[GBackMat(X,Y)].Name : LoadResStr("IDS_CNS_NOTHING") );
|
||||
break;
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
}
|
||||
|
@ -728,7 +728,7 @@ void C4EditCursor::ApplyToolPicker()
|
|||
// Material only from landscape
|
||||
if (MatValid(iMaterial=GBackMat(X,Y)))
|
||||
{
|
||||
Console.ToolsDlg.SelectMaterial(Game.Material.Map[iMaterial].Name);
|
||||
Console.ToolsDlg.SelectMaterial(::MaterialMap.Map[iMaterial].Name);
|
||||
Console.ToolsDlg.SetIFT(GBackIFT(X,Y));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -565,7 +565,7 @@ int32_t FnFxFireStart(C4AulContext *ctx, C4Object *pObj, int32_t iNumber, int32_
|
|||
BOOL fFireCaused=TRUE;
|
||||
int32_t iMat;
|
||||
if (MatValid(iMat=GBackMat(pObj->GetX(),pObj->GetY())))
|
||||
if (Game.Material.Map[iMat].Extinguisher)
|
||||
if (::MaterialMap.Map[iMat].Extinguisher)
|
||||
{
|
||||
// blasts should changedef in water, too!
|
||||
if (fBlasted) if (pObj->Def->BurnTurnTo!=C4ID_None) pObj->ChangeDef(pObj->Def->BurnTurnTo);
|
||||
|
@ -790,7 +790,7 @@ void Splash(int32_t tx, int32_t ty, int32_t amt, C4Object *pByObj)
|
|||
int32_t iMat = GBackMat(tx, ty);
|
||||
// check liquid
|
||||
if (MatValid(iMat))
|
||||
if (DensityLiquid(Game.Material.Map[iMat].Density) && Game.Material.Map[iMat].Instable)
|
||||
if (DensityLiquid(::MaterialMap.Map[iMat].Density) && ::MaterialMap.Map[iMat].Instable)
|
||||
{
|
||||
int32_t sy = ty;
|
||||
while(GBackLiquid(tx, sy) && sy > ty - 20 && sy >= 0) sy--;
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include <C4MassMover.h>
|
||||
#include <C4RankSystem.h>
|
||||
#include <C4GameMessage.h>
|
||||
#include <C4Material.h>
|
||||
#endif
|
||||
|
||||
#include <StdFile.h>
|
||||
|
@ -558,7 +559,7 @@ void C4Game::Clear()
|
|||
PXS.Clear();
|
||||
if (pGlobalEffects) { delete pGlobalEffects; pGlobalEffects=NULL; }
|
||||
Particles.Clear();
|
||||
Material.Clear();
|
||||
::MaterialMap.Clear();
|
||||
TextureMap.Clear(); // texture map *MUST* be cleared after the materials, because of the patterns!
|
||||
GraphicsResource.Clear();
|
||||
::Messages.Clear();
|
||||
|
@ -679,7 +680,7 @@ BOOL C4Game::GameOverCheck()
|
|||
condition_true=TRUE;
|
||||
for (cnt=0; cnt<C4MaxNameList; cnt++)
|
||||
if (C4S.Game.ClearMaterial.Name[cnt][0])
|
||||
if (MatValid(mat=Game.Material.Get(C4S.Game.ClearMaterial.Name[cnt])))
|
||||
if (MatValid(mat=::MaterialMap.Get(C4S.Game.ClearMaterial.Name[cnt])))
|
||||
{
|
||||
condition_valid=TRUE;
|
||||
if (::Landscape.EffectiveMatCount[mat]>(DWORD)C4S.Game.ClearMaterial.Count[cnt])
|
||||
|
@ -833,7 +834,7 @@ BOOL C4Game::InitMaterialTexture()
|
|||
|
||||
// Clear old data
|
||||
TextureMap.Clear();
|
||||
Material.Clear();
|
||||
::MaterialMap.Clear();
|
||||
|
||||
// Check for scenario local materials
|
||||
bool fHaveScenMaterials = Game.ScenarioFile.FindEntry(C4CFN_Material);
|
||||
|
@ -891,7 +892,7 @@ BOOL C4Game::InitMaterialTexture()
|
|||
// Load materials
|
||||
if(fOverloadMaterials)
|
||||
{
|
||||
int iMats = Material.Load(Mats);
|
||||
int iMats = ::MaterialMap.Load(Mats);
|
||||
// Automatically continue search if no material was found
|
||||
if(!iMats) fNewOverloadMaterials = true;
|
||||
mat_count += iMats;
|
||||
|
@ -907,20 +908,20 @@ BOOL C4Game::InitMaterialTexture()
|
|||
LogF(LoadResStr("IDS_PRC_MATERIALS"),mat_count);
|
||||
|
||||
// Load material enumeration
|
||||
if (!Material.LoadEnumeration(ScenarioFile))
|
||||
if (!::MaterialMap.LoadEnumeration(ScenarioFile))
|
||||
{ LogFatal(LoadResStr("IDS_PRC_NOMATENUM")); return FALSE; }
|
||||
|
||||
// Initialize texture map
|
||||
TextureMap.Init();
|
||||
|
||||
// Cross map mats (after texture init, because Material-Texture-combinations are used)
|
||||
Material.CrossMapMaterials();
|
||||
::MaterialMap.CrossMapMaterials();
|
||||
|
||||
// Enumerate materials
|
||||
if (!EnumerateMaterials()) return FALSE;
|
||||
|
||||
// get material script funcs
|
||||
Material.UpdateScriptPointers();
|
||||
::MaterialMap.UpdateScriptPointers();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1604,17 +1605,17 @@ BOOL C4Game::EnumerateMaterials()
|
|||
{
|
||||
|
||||
// Check material number
|
||||
if (Material.Num>C4MaxMaterial)
|
||||
if (::MaterialMap.Num>C4MaxMaterial)
|
||||
{ LogFatal(LoadResStr("IDS_PRC_TOOMANYMATS")); return FALSE; }
|
||||
|
||||
// Get hardcoded system material indices
|
||||
MVehic = Material.Get("Vehicle"); MCVehic = Mat2PixColDefault(MVehic);
|
||||
MTunnel = Material.Get("Tunnel");
|
||||
MWater = Material.Get("Water");
|
||||
MSnow = Material.Get("Snow");
|
||||
MGranite = Material.Get("Granite");
|
||||
MFlyAshes= Material.Get("FlyAshes");
|
||||
MEarth = Material.Get(C4S.Landscape.Material);
|
||||
MVehic = ::MaterialMap.Get("Vehicle"); MCVehic = Mat2PixColDefault(MVehic);
|
||||
MTunnel = ::MaterialMap.Get("Tunnel");
|
||||
MWater = ::MaterialMap.Get("Water");
|
||||
MSnow = ::MaterialMap.Get("Snow");
|
||||
MGranite = ::MaterialMap.Get("Granite");
|
||||
MFlyAshes= ::MaterialMap.Get("FlyAshes");
|
||||
MEarth = ::MaterialMap.Get(C4S.Landscape.Material);
|
||||
if ((MVehic==MNone) || (MTunnel==MNone))
|
||||
{ LogFatal(LoadResStr("IDS_PRC_NOSYSMATS")); return FALSE; }
|
||||
// mapping to landscape palette will occur when landscape has been created
|
||||
|
@ -1682,7 +1683,7 @@ void C4Game::Default()
|
|||
FullSpeed=FALSE;
|
||||
FrameSkip=1; DoSkipFrame=false;
|
||||
::Definitions.Default();
|
||||
Material.Default();
|
||||
::MaterialMap.Default();
|
||||
Objects.Default();
|
||||
BackObjects.Default();
|
||||
ForeObjects.Default();
|
||||
|
@ -2290,7 +2291,7 @@ BOOL C4Game::InitGame(C4Group &hGroup, bool fLoadSection, bool fLoadSky)
|
|||
SetInitProgress(58);
|
||||
|
||||
// Colorize defs by material
|
||||
::Definitions.ColorizeByMaterial(Material,GBM);
|
||||
::Definitions.ColorizeByMaterial(::MaterialMap,GBM);
|
||||
SetInitProgress(59);
|
||||
|
||||
// Videos
|
||||
|
@ -2699,7 +2700,7 @@ C4Object* C4Game::PlaceVegetation(C4ID id, int32_t iX, int32_t iY, int32_t iWdt,
|
|||
// Soil check
|
||||
iTy+=3; // two pix into ground
|
||||
iMaterial = GBackMat(iTx,iTy);
|
||||
if (iMaterial!=MNone) if (Material.Map[iMaterial].Soil)
|
||||
if (iMaterial!=MNone) if (::MaterialMap.Map[iMaterial].Soil)
|
||||
{
|
||||
if (!pDef->Growth) iGrowth=FullCon;
|
||||
iTy+=5;
|
||||
|
|
|
@ -173,7 +173,7 @@ bool C4GameSave::SaveLandscape()
|
|||
MassMoverSet.Copy(::MassMover);
|
||||
if (!MassMoverSet.Save(*pSaveGroup)) return false;
|
||||
// Material enumeration
|
||||
if (!Game.Material.SaveEnumeration(*pSaveGroup)) return false;
|
||||
if (!::MaterialMap.SaveEnumeration(*pSaveGroup)) return false;
|
||||
}
|
||||
// static / dynamic
|
||||
if (::Landscape.Mode == C4LSC_Static)
|
||||
|
|
|
@ -95,14 +95,14 @@ void C4Landscape::Execute()
|
|||
{
|
||||
DWORD MatCountCheck[C4MaxMaterial], EffectiveMatCountCheck[C4MaxMaterial];
|
||||
int32_t iMat;
|
||||
for(iMat = 0; iMat < Game.Material.Num; iMat++)
|
||||
for(iMat = 0; iMat < ::MaterialMap.Num; iMat++)
|
||||
{
|
||||
MatCountCheck[iMat] = MatCount[iMat];
|
||||
EffectiveMatCountCheck[iMat] = EffectiveMatCount[iMat];
|
||||
}
|
||||
ClearMatCount();
|
||||
UpdateMatCnt(C4Rect(0,0,Width,Height), true);
|
||||
for(iMat = 0; iMat < Game.Material.Num; iMat++)
|
||||
for(iMat = 0; iMat < ::MaterialMap.Num; iMat++)
|
||||
{
|
||||
assert(MatCount[iMat] == MatCountCheck[iMat]);
|
||||
assert(EffectiveMatCount[iMat] == EffectiveMatCountCheck[iMat]);
|
||||
|
@ -123,15 +123,15 @@ void C4Landscape::ExecuteScan()
|
|||
|
||||
// Check: Scan needed?
|
||||
const int32_t iTemperature = Game.Weather.GetTemperature();
|
||||
for(mat = 0; mat < Game.Material.Num; mat++)
|
||||
for(mat = 0; mat < ::MaterialMap.Num; mat++)
|
||||
if(MatCount[mat])
|
||||
if(Game.Material.Map[mat].BelowTempConvertTo &&
|
||||
iTemperature < Game.Material.Map[mat].BelowTempConvert)
|
||||
if(::MaterialMap.Map[mat].BelowTempConvertTo &&
|
||||
iTemperature < ::MaterialMap.Map[mat].BelowTempConvert)
|
||||
break;
|
||||
else if(Game.Material.Map[mat].AboveTempConvertTo &&
|
||||
iTemperature > Game.Material.Map[mat].AboveTempConvert)
|
||||
else if(::MaterialMap.Map[mat].AboveTempConvertTo &&
|
||||
iTemperature > ::MaterialMap.Map[mat].AboveTempConvert)
|
||||
break;
|
||||
if(mat >= Game.Material.Num)
|
||||
if(mat >= ::MaterialMap.Num)
|
||||
return;
|
||||
|
||||
#ifdef DEBUGREC_MATSCAN
|
||||
|
@ -175,21 +175,21 @@ int32_t C4Landscape::DoScan(int32_t cx, int32_t cy, int32_t mat, int32_t dir)
|
|||
int32_t conv_to_tex = 0;
|
||||
int32_t iTemperature = Game.Weather.GetTemperature();
|
||||
// Check below conv
|
||||
if(Game.Material.Map[mat].BelowTempConvertDir == dir)
|
||||
if (Game.Material.Map[mat].BelowTempConvertTo)
|
||||
if (iTemperature<Game.Material.Map[mat].BelowTempConvert)
|
||||
conv_to_tex=Game.Material.Map[mat].BelowTempConvertTo;
|
||||
if(::MaterialMap.Map[mat].BelowTempConvertDir == dir)
|
||||
if (::MaterialMap.Map[mat].BelowTempConvertTo)
|
||||
if (iTemperature< ::MaterialMap.Map[mat].BelowTempConvert)
|
||||
conv_to_tex=::MaterialMap.Map[mat].BelowTempConvertTo;
|
||||
// Check above conv
|
||||
if(Game.Material.Map[mat].AboveTempConvertDir == dir)
|
||||
if (Game.Material.Map[mat].AboveTempConvertTo)
|
||||
if (iTemperature>Game.Material.Map[mat].AboveTempConvert)
|
||||
conv_to_tex=Game.Material.Map[mat].AboveTempConvertTo;
|
||||
if(::MaterialMap.Map[mat].AboveTempConvertDir == dir)
|
||||
if (::MaterialMap.Map[mat].AboveTempConvertTo)
|
||||
if (iTemperature>::MaterialMap.Map[mat].AboveTempConvert)
|
||||
conv_to_tex=::MaterialMap.Map[mat].AboveTempConvertTo;
|
||||
// nothing to do?
|
||||
if (!conv_to_tex) return 0;
|
||||
// find material
|
||||
int32_t conv_to = ::TextureMap.GetEntry(conv_to_tex)->GetMaterialIndex();
|
||||
// find mat top
|
||||
int32_t mconv = Game.Material.Map[mat].TempConvStrength,
|
||||
int32_t mconv = ::MaterialMap.Map[mat].TempConvStrength,
|
||||
mconvs = mconv;
|
||||
#ifdef DEBUGREC_MATSCAN
|
||||
C4RCMatScan rc = { cx, cy, mat, conv_to, dir, mconvs };
|
||||
|
@ -567,7 +567,7 @@ CSurface8 * C4Landscape::CreateMapS2(C4Group &ScenFile)
|
|||
|
||||
// create map creator
|
||||
if (!pMapCreator)
|
||||
pMapCreator = new C4MapCreatorS2(&Game.C4S.Landscape, &::TextureMap, &Game.Material, Game.StartupPlayerCount);
|
||||
pMapCreator = new C4MapCreatorS2(&Game.C4S.Landscape, &::TextureMap, &::MaterialMap, Game.StartupPlayerCount);
|
||||
|
||||
// read file
|
||||
pMapCreator->ReadFile(C4CFN_DynLandscape, &ScenFile);
|
||||
|
@ -827,10 +827,10 @@ BOOL C4Landscape::_SetPix(int32_t x, int32_t y, BYTE npix)
|
|||
// count effective material
|
||||
if(omat != nmat)
|
||||
{
|
||||
if(npix && Game.Material.Map[nmat].MinHeightCount)
|
||||
if(npix && ::MaterialMap.Map[nmat].MinHeightCount)
|
||||
{
|
||||
// Check for material above & below
|
||||
int iMinHeight = Game.Material.Map[nmat].MinHeightCount,
|
||||
int iMinHeight = ::MaterialMap.Map[nmat].MinHeightCount,
|
||||
iBelow = GetMatHeight(x, y+1, +1, nmat, iMinHeight),
|
||||
iAbove = GetMatHeight(x, y-1, -1, nmat, iMinHeight);
|
||||
// Will be above treshold?
|
||||
|
@ -844,10 +844,10 @@ BOOL C4Landscape::_SetPix(int32_t x, int32_t y, BYTE npix)
|
|||
EffectiveMatCount[nmat] += iChange;
|
||||
}
|
||||
}
|
||||
if(opix && Game.Material.Map[omat].MinHeightCount)
|
||||
if(opix && ::MaterialMap.Map[omat].MinHeightCount)
|
||||
{
|
||||
// Check for material above & below
|
||||
int iMinHeight = Game.Material.Map[omat].MinHeightCount,
|
||||
int iMinHeight = ::MaterialMap.Map[omat].MinHeightCount,
|
||||
iBelow = GetMatHeight(x, y+1, +1, omat, iMinHeight),
|
||||
iAbove = GetMatHeight(x, y-1, -1, omat, iMinHeight);
|
||||
// Not already below threshold?
|
||||
|
@ -882,7 +882,7 @@ BOOL C4Landscape::CheckInstability(int32_t tx, int32_t ty)
|
|||
{
|
||||
int32_t mat=GetMat(tx,ty);
|
||||
if (MatValid(mat))
|
||||
if (Game.Material.Map[mat].Instable)
|
||||
if (::MaterialMap.Map[mat].Instable)
|
||||
return ::MassMover.Create(tx,ty);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -959,7 +959,7 @@ int32_t C4Landscape::DigFreePix(int32_t tx, int32_t ty)
|
|||
{
|
||||
int32_t mat=GetMat(tx,ty);
|
||||
if (mat!=MNone)
|
||||
if (Game.Material.Map[mat].DigFree)
|
||||
if (::MaterialMap.Map[mat].DigFree)
|
||||
ClearPix(tx,ty);
|
||||
CheckInstabilityRange(tx,ty);
|
||||
return mat;
|
||||
|
@ -969,7 +969,7 @@ int32_t C4Landscape::ShakeFreePix(int32_t tx, int32_t ty)
|
|||
{
|
||||
int32_t mat=GetMat(tx,ty);
|
||||
if (mat!=MNone)
|
||||
if (Game.Material.Map[mat].DigFree)
|
||||
if (::MaterialMap.Map[mat].DigFree)
|
||||
{
|
||||
ClearPix(tx,ty);
|
||||
::PXS.Create(mat,itofix(tx),itofix(ty));
|
||||
|
@ -984,14 +984,14 @@ int32_t C4Landscape::BlastFreePix(int32_t tx, int32_t ty, int32_t grade, int32_t
|
|||
if (MatValid(mat))
|
||||
{
|
||||
// Blast Shift
|
||||
if (Game.Material.Map[mat].BlastShiftTo)
|
||||
if (::MaterialMap.Map[mat].BlastShiftTo)
|
||||
{
|
||||
// blast free amount; always blast if 100% is to be blasted away
|
||||
if (Random(BlastMatCount[mat]) < iBlastSize * grade / 6)
|
||||
SetPix(tx,ty,MatTex2PixCol(Game.Material.Map[mat].BlastShiftTo)+GBackIFT(tx,ty));
|
||||
SetPix(tx,ty,MatTex2PixCol(::MaterialMap.Map[mat].BlastShiftTo)+GBackIFT(tx,ty));
|
||||
}
|
||||
// Blast Free
|
||||
if (Game.Material.Map[mat].BlastFree) ClearPix(tx,ty);
|
||||
if (::MaterialMap.Map[mat].BlastFree) ClearPix(tx,ty);
|
||||
}
|
||||
|
||||
CheckInstabilityRange(tx,ty);
|
||||
|
@ -1085,19 +1085,19 @@ void C4Landscape::BlastFree(int32_t tx, int32_t ty, int32_t rad, int32_t grade,
|
|||
}
|
||||
|
||||
// Evaluate material count
|
||||
for (cnt=0; cnt<Game.Material.Num; cnt++)
|
||||
for (cnt=0; cnt< ::MaterialMap.Num; cnt++)
|
||||
if (BlastMatCount[cnt])
|
||||
{
|
||||
|
||||
if (Game.Material.Map[cnt].Blast2Object != C4ID_None)
|
||||
if (Game.Material.Map[cnt].Blast2ObjectRatio != 0)
|
||||
Game.BlastCastObjects(Game.Material.Map[cnt].Blast2Object,NULL,
|
||||
BlastMatCount[cnt]/Game.Material.Map[cnt].Blast2ObjectRatio,
|
||||
if (::MaterialMap.Map[cnt].Blast2Object != C4ID_None)
|
||||
if (::MaterialMap.Map[cnt].Blast2ObjectRatio != 0)
|
||||
Game.BlastCastObjects(::MaterialMap.Map[cnt].Blast2Object,NULL,
|
||||
BlastMatCount[cnt]/::MaterialMap.Map[cnt].Blast2ObjectRatio,
|
||||
tx,ty,iByPlayer);
|
||||
|
||||
if (Game.Material.Map[cnt].Blast2PXSRatio != 0)
|
||||
if (::MaterialMap.Map[cnt].Blast2PXSRatio != 0)
|
||||
::PXS.Cast(cnt,
|
||||
BlastMatCount[cnt]/Game.Material.Map[cnt].Blast2PXSRatio,
|
||||
BlastMatCount[cnt]/::MaterialMap.Map[cnt].Blast2PXSRatio,
|
||||
tx,ty,60);
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1145,7 @@ void C4Landscape::FindMatTop(int32_t mat, int32_t &x, int32_t &y)
|
|||
BOOL fLeft,fRight;
|
||||
|
||||
if (!MatValid(mat)) return;
|
||||
mslide=Game.Material.Map[mat].MaxSlide;
|
||||
mslide=::MaterialMap.Map[mat].MaxSlide;
|
||||
|
||||
do
|
||||
{
|
||||
|
@ -1199,7 +1199,7 @@ BOOL C4Landscape::InsertMaterial(int32_t mat, int32_t tx, int32_t ty, int32_t vx
|
|||
// Same or higher density?
|
||||
if(GetDensity(tx, ty) >= mdens)
|
||||
// Push
|
||||
if(!FindMatPathPush(tx, ty, mdens, Game.Material.Map[mat].MaxSlide, !! Game.Material.Map[mat].Instable))
|
||||
if(!FindMatPathPush(tx, ty, mdens, ::MaterialMap.Map[mat].MaxSlide, !! ::MaterialMap.Map[mat].Instable))
|
||||
// Or die
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1218,13 +1218,13 @@ BOOL C4Landscape::InsertMaterial(int32_t mat, int32_t tx, int32_t ty, int32_t vx
|
|||
}
|
||||
|
||||
// Try slide
|
||||
while (FindMatSlide(tx,ty,+1,mdens,Game.Material.Map[mat].MaxSlide))
|
||||
while (FindMatSlide(tx,ty,+1,mdens,::MaterialMap.Map[mat].MaxSlide))
|
||||
if (GetDensity(tx,ty+1)<mdens)
|
||||
{ ::PXS.Create(mat,itofix(tx),itofix(ty),FIXED10(vx),FIXED10(vy)); return TRUE; }
|
||||
|
||||
// Try reaction with material below
|
||||
C4MaterialReaction *pReact; int32_t tmat;
|
||||
if (pReact = Game.Material.GetReactionUnsafe(mat, tmat=GetMat(tx,ty+Sign(GravAccel))))
|
||||
if (pReact = ::MaterialMap.GetReactionUnsafe(mat, tmat=GetMat(tx,ty+Sign(GravAccel))))
|
||||
{
|
||||
FIXED fvx=FIXED10(vx), fvy=FIXED10(vy);
|
||||
if ((*pReact->pFunc)(pReact, tx,ty, tx,ty+Sign(GravAccel), fvx,fvy, mat,tmat, meePXSPos,NULL))
|
||||
|
@ -1443,7 +1443,7 @@ BOOL C4Landscape::Incinerate(int32_t x, int32_t y)
|
|||
{
|
||||
int32_t mat=GetMat(x,y);
|
||||
if (MatValid(mat))
|
||||
if (Game.Material.Map[mat].Inflammable)
|
||||
if (::MaterialMap.Map[mat].Inflammable)
|
||||
// Not too much FLAMs
|
||||
if (!Game.FindObject (C4Id ("FLAM"), x - 4, y - 1, 8, 20))
|
||||
if (Game.CreateObject(C4Id("FLAM"),NULL,NO_OWNER,x,y))
|
||||
|
@ -2156,7 +2156,7 @@ BOOL C4Landscape::SaveMap(C4Group &hGroup)
|
|||
|
||||
// Create map palette
|
||||
BYTE bypPalette[3*256];
|
||||
::TextureMap.StoreMapPalette(bypPalette,Game.Material);
|
||||
::TextureMap.StoreMapPalette(bypPalette,::MaterialMap);
|
||||
|
||||
// Save map surface
|
||||
if (!Map->Save(Config.AtTempPath(C4CFN_TempMap), bypPalette))
|
||||
|
@ -2367,7 +2367,7 @@ BOOL C4Landscape::DrawChunks(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, i
|
|||
BYTE byColor;
|
||||
if (!GetMapColorIndex(szMaterial, szTexture, bIFT, byColor)) return FALSE;
|
||||
|
||||
int32_t iMaterial = Game.Material.Get(szMaterial); if (!MatValid(iMaterial)) return FALSE;
|
||||
int32_t iMaterial = ::MaterialMap.Get(szMaterial); if (!MatValid(iMaterial)) return FALSE;
|
||||
|
||||
C4Rect BoundingBox(tx - 5, ty - 5, wdt + 10, hgt + 10);
|
||||
PrepareChange(BoundingBox);
|
||||
|
@ -2380,7 +2380,7 @@ BOOL C4Landscape::DrawChunks(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, i
|
|||
int32_t x, y;
|
||||
for(x = 0; x < icntx; x++)
|
||||
for(y = 0; y < icnty; y++)
|
||||
DrawChunk(tx+wdt*x/icntx,ty+hgt*y/icnty,wdt/icntx,hgt/icnty,byColor,Game.Material.Map[iMaterial].MapChunkType,Random(1000));
|
||||
DrawChunk(tx+wdt*x/icntx,ty+hgt*y/icnty,wdt/icntx,hgt/icnty,byColor,::MaterialMap.Map[iMaterial].MapChunkType,Random(1000));
|
||||
|
||||
// remove clipper
|
||||
Surface8->NoClip();
|
||||
|
@ -2580,7 +2580,7 @@ BOOL C4Landscape::DrawMap(int32_t iX, int32_t iY, int32_t iWdt, int32_t iHgt, co
|
|||
FakeLS.MapWdt.Set(iMapWdt, 0, iMapWdt, iMapWdt);
|
||||
FakeLS.MapHgt.Set(iMapHgt, 0, iMapHgt, iMapHgt);
|
||||
// create map creator
|
||||
C4MapCreatorS2 MapCreator(&FakeLS, &::TextureMap, &Game.Material, Game.StartupPlayerCount);
|
||||
C4MapCreatorS2 MapCreator(&FakeLS, &::TextureMap, &::MaterialMap, Game.StartupPlayerCount);
|
||||
// read file
|
||||
MapCreator.ReadScript(szMapDef);
|
||||
// render map
|
||||
|
@ -2746,7 +2746,7 @@ void C4Landscape::UpdatePixMaps()
|
|||
int32_t i;
|
||||
for(i = 0; i < 256; i++) Pix2Mat[i] = PixCol2Mat(i);
|
||||
for(i = 0; i < 256; i++) Pix2Dens[i] = MatDensity(Pix2Mat[i]);
|
||||
for(i = 0; i < 256; i++) Pix2Place[i] = MatValid(Pix2Mat[i]) ? Game.Material.Map[Pix2Mat[i]].Placement : 0;
|
||||
for(i = 0; i < 256; i++) Pix2Place[i] = MatValid(Pix2Mat[i]) ? ::MaterialMap.Map[Pix2Mat[i]].Placement : 0;
|
||||
Pix2Place[0] = 0;
|
||||
}
|
||||
|
||||
|
@ -2850,7 +2850,7 @@ void C4Landscape::UpdateMatCnt(C4Rect Rect, bool fPlus)
|
|||
// Normal material counting
|
||||
MatCount[iMat] += iMul * (iHgt + 1);
|
||||
// Effective material counting enabled?
|
||||
if(int32_t iMinHgt = Game.Material.Map[iMat].MinHeightCount)
|
||||
if(int32_t iMinHgt = ::MaterialMap.Map[iMat].MinHeightCount)
|
||||
{
|
||||
// First chunk? Add any material above when checking chunk height
|
||||
int iAddedHeight = 0;
|
||||
|
@ -2876,7 +2876,7 @@ void C4Landscape::UpdateMatCnt(C4Rect Rect, bool fPlus)
|
|||
// Normal material counting
|
||||
MatCount[iMat] += iMul * (iHgt + 1);
|
||||
// Minimum height counting?
|
||||
if(int32_t iMinHgt = Game.Material.Map[iMat].MinHeightCount)
|
||||
if(int32_t iMinHgt = ::MaterialMap.Map[iMat].MinHeightCount)
|
||||
{
|
||||
int iAddedHeight1 = 0, iAddedHeight2 = 0;
|
||||
// Add any material above for chunk size check
|
||||
|
@ -2886,7 +2886,7 @@ void C4Landscape::UpdateMatCnt(C4Rect Rect, bool fPlus)
|
|||
if(Rect.y+y < Height)
|
||||
iAddedHeight2 = GetMatHeight(Rect.x+x, Rect.y+Rect.Hgt, 1, iMat, iMinHgt);
|
||||
// Chunk tall enough?
|
||||
if(iHgt + 1 + iAddedHeight1 + iAddedHeight2 >= Game.Material.Map[iMat].MinHeightCount)
|
||||
if(iHgt + 1 + iAddedHeight1 + iAddedHeight2 >= ::MaterialMap.Map[iMat].MinHeightCount)
|
||||
{
|
||||
EffectiveMatCount[iMat] += iMul * (iHgt + 1);
|
||||
if(iAddedHeight1 < iMinHgt)
|
||||
|
@ -2921,9 +2921,9 @@ void C4Landscape::RemoveUnusedTexMapEntries()
|
|||
for (int32_t x=0; x<Width; ++x)
|
||||
fTexUsage[Surface8->GetPix(x,y) & 0x7f] = true;
|
||||
// check usage by materials
|
||||
for (int32_t iMat = 0; iMat < Game.Material.Num; ++iMat)
|
||||
for (int32_t iMat = 0; iMat < ::MaterialMap.Num; ++iMat)
|
||||
{
|
||||
C4Material *pMat = Game.Material.Map + iMat;
|
||||
C4Material *pMat = ::MaterialMap.Map + iMat;
|
||||
if (pMat->BlastShiftTo >= 0) fTexUsage[pMat->BlastShiftTo & 0x7f] = true;
|
||||
if (pMat->BelowTempConvertTo >= 0) fTexUsage[pMat->BelowTempConvertTo & 0x7f] = true;
|
||||
if (pMat->AboveTempConvertTo >= 0) fTexUsage[pMat->AboveTempConvertTo & 0x7f] = true;
|
||||
|
|
|
@ -135,7 +135,7 @@ BOOL C4MassMover::Execute()
|
|||
if (GBackMat(x,y)!=Mat) { Cease(); return FALSE; }
|
||||
|
||||
// Check for transfer target space
|
||||
C4Material *pMat = Game.Material.Map+Mat;
|
||||
C4Material *pMat = ::MaterialMap.Map+Mat;
|
||||
tx=x; ty=y;
|
||||
if (!::Landscape.FindMatPath(tx,ty,+1,pMat->Density,pMat->MaxSlide))
|
||||
{
|
||||
|
@ -171,7 +171,7 @@ BOOL C4MassMover::Execute()
|
|||
::Landscape.InsertMaterial(::Landscape.ExtractMaterial(x,y), tx, ty, 0, 1);
|
||||
|
||||
// Reinsert material (thrusted aside)
|
||||
if(Game.C4S.Game.Realism.LandscapeInsertThrust && MatValid(omat) && Game.Material.Map[omat].Density > 0)
|
||||
if(Game.C4S.Game.Realism.LandscapeInsertThrust && MatValid(omat) && ::MaterialMap.Map[omat].Density > 0)
|
||||
::Landscape.InsertMaterial(omat, tx, ty + 1);
|
||||
|
||||
// Create new mover at target
|
||||
|
@ -184,7 +184,7 @@ BOOL C4MassMover::Corrosion(int32_t dx, int32_t dy)
|
|||
{
|
||||
// check reaction map of massmover-mat to target mat
|
||||
int32_t tmat=GBackMat(x+dx,y+dy);
|
||||
C4MaterialReaction *pReact = Game.Material.GetReactionUnsafe(Mat, tmat);
|
||||
C4MaterialReaction *pReact = ::MaterialMap.GetReactionUnsafe(Mat, tmat);
|
||||
if (pReact)
|
||||
{
|
||||
FIXED xdir=Fix0, ydir=Fix0;
|
||||
|
|
|
@ -621,7 +621,7 @@ bool mrfInsertCheck(int32_t &iX, int32_t &iY, FIXED &fXDir, FIXED &fYDir, int32_
|
|||
|
||||
// Rough contact? May splash
|
||||
if (fYDir > itofix(1))
|
||||
if (Game.Material.Map[iPxsMat].SplashRate && !Random(Game.Material.Map[iPxsMat].SplashRate))
|
||||
if (::MaterialMap.Map[iPxsMat].SplashRate && !Random(::MaterialMap.Map[iPxsMat].SplashRate))
|
||||
{
|
||||
fYDir = -fYDir/8;
|
||||
fXDir = fXDir/8 + FIXED100(Random(200) - 100);
|
||||
|
@ -632,12 +632,12 @@ bool mrfInsertCheck(int32_t &iX, int32_t &iY, FIXED &fXDir, FIXED &fYDir, int32_
|
|||
fYDir = 0;
|
||||
|
||||
// Incindiary mats smoke on contact even before doing their slide
|
||||
if (Game.Material.Map[iPxsMat].Incindiary)
|
||||
if (::MaterialMap.Map[iPxsMat].Incindiary)
|
||||
if (!Random(25)) Smoke(iX, iY, 4+Rnd3() );
|
||||
|
||||
// Move by mat path/slide
|
||||
int32_t iSlideX = iX, iSlideY = iY;
|
||||
if (::Landscape.FindMatSlide(iSlideX,iSlideY,Sign(GravAccel),Game.Material.Map[iPxsMat].Density,Game.Material.Map[iPxsMat].MaxSlide))
|
||||
if (::Landscape.FindMatSlide(iSlideX,iSlideY,Sign(GravAccel),::MaterialMap.Map[iPxsMat].Density,::MaterialMap.Map[iPxsMat].MaxSlide))
|
||||
{
|
||||
if(iPxsMat == iLsMat)
|
||||
{ iX = iSlideX; iY = iSlideY; fXDir = 0; return false; }
|
||||
|
@ -682,11 +682,11 @@ bool C4MaterialMap::mrfConvert(C4MaterialReaction *pReaction, int32_t &iX, int32
|
|||
case meePXSPos: // PXS check before movement
|
||||
{
|
||||
// Check depth
|
||||
int32_t iDepth = pReaction->fUserDefined ? pReaction->iDepth : Game.Material.Map[iPxsMat].InMatConvertDepth;
|
||||
int32_t iDepth = pReaction->fUserDefined ? pReaction->iDepth : ::MaterialMap.Map[iPxsMat].InMatConvertDepth;
|
||||
if (!iDepth || GBackMat(iX, iY - iDepth) == iLsMat)
|
||||
{
|
||||
// Convert
|
||||
iPxsMat = pReaction->fUserDefined ? pReaction->iConvertMat : Game.Material.Map[iPxsMat].InMatConvertTo;
|
||||
iPxsMat = pReaction->fUserDefined ? pReaction->iConvertMat : ::MaterialMap.Map[iPxsMat].InMatConvertTo;
|
||||
if (!MatValid(iPxsMat))
|
||||
// Convert failure (target mat not be loaded, or target may be C4TLS_MatSky): Kill Pix
|
||||
return true;
|
||||
|
@ -749,7 +749,7 @@ bool C4MaterialMap::mrfCorrode(C4MaterialReaction *pReaction, int32_t &iX, int32
|
|||
if (pReaction->fUserDefined)
|
||||
fDoCorrode = (Random(100) < pReaction->iCorrosionRate);
|
||||
else
|
||||
fDoCorrode = (Random(100) < Game.Material.Map[iPxsMat].Corrosive) && (Random(100) < Game.Material.Map[iLsMat].Corrode);
|
||||
fDoCorrode = (Random(100) < ::MaterialMap.Map[iPxsMat].Corrosive) && (Random(100) < ::MaterialMap.Map[iLsMat].Corrode);
|
||||
if (fDoCorrode)
|
||||
{
|
||||
ClearBackPix(iLSPosX,iLSPosY);
|
||||
|
@ -773,7 +773,7 @@ bool C4MaterialMap::mrfCorrode(C4MaterialReaction *pReaction, int32_t &iX, int32
|
|||
if (pReaction->fUserDefined)
|
||||
fDoCorrode = (Random(100) < pReaction->iCorrosionRate);
|
||||
else
|
||||
fDoCorrode = (Random(100) < Game.Material.Map[iPxsMat].Corrosive) && (Random(100) < Game.Material.Map[iLsMat].Corrode);
|
||||
fDoCorrode = (Random(100) < ::MaterialMap.Map[iPxsMat].Corrosive) && (Random(100) < ::MaterialMap.Map[iLsMat].Corrode);
|
||||
if (fDoCorrode)
|
||||
{
|
||||
ClearBackPix(iLSPosX,iLSPosY);
|
||||
|
@ -884,3 +884,5 @@ void C4MaterialMap::UpdateScriptPointers()
|
|||
}
|
||||
|
||||
#endif
|
||||
|
||||
C4MaterialMap MaterialMap;
|
||||
|
|
|
@ -610,7 +610,7 @@ void C4MouseControl::UpdateCursorTarget()
|
|||
{
|
||||
int32_t iMat = GBackMat(int32_t(GameX),int32_t(GameY));
|
||||
if (MatValid(iMat))
|
||||
if (pDef=C4Id2Def(Game.Material.Map[iMat].Dig2Object))
|
||||
if (pDef=C4Id2Def(::MaterialMap.Map[iMat].Dig2Object))
|
||||
{ idCaption="IDS_CON_DIGOUT"; fDouble=true; szName=pDef->GetName(); }
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -63,7 +63,7 @@ void DrawVertex(C4Facet &cgo, int32_t tx, int32_t ty, int32_t col, int32_t conta
|
|||
void C4Action::SetBridgeData(int32_t iBridgeTime, bool fMoveClonk, bool fWall, int32_t iBridgeMaterial)
|
||||
{
|
||||
// validity
|
||||
iBridgeMaterial = Min<int32_t>(iBridgeMaterial, Game.Material.Num-1);
|
||||
iBridgeMaterial = Min<int32_t>(iBridgeMaterial, ::MaterialMap.Num-1);
|
||||
if (iBridgeMaterial < 0) iBridgeMaterial = 0xff;
|
||||
iBridgeTime = BoundBy<int32_t>(iBridgeTime, 0, 0xffff);
|
||||
// mask in this->Data
|
||||
|
@ -870,7 +870,7 @@ BOOL C4Object::ExecFire(int32_t iFireNumber, int32_t iCausedByPlr)
|
|||
if (MatValid(mat=GBackMat(GetX(), GetY())))
|
||||
{
|
||||
// Extinguish
|
||||
if (Game.Material.Map[mat].Extinguisher)
|
||||
if (::MaterialMap.Map[mat].Extinguisher)
|
||||
{ Extinguish(iFireNumber); if (GBackLiquid(GetX(), GetY())) StartSoundEffect("Pshshsh",false,100,this); }
|
||||
// Inflame
|
||||
if (!Random(3))
|
||||
|
@ -990,14 +990,14 @@ BOOL C4Object::ExecLife()
|
|||
if (!Tick10)
|
||||
if (Alive)
|
||||
if (InMat!=MNone)
|
||||
if (Game.Material.Map[InMat].Corrosive)
|
||||
if (::MaterialMap.Map[InMat].Corrosive)
|
||||
if (!GetPhysical()->CorrosionResist)
|
||||
DoEnergy(-Game.Material.Map[InMat].Corrosive/15,false,C4FxCall_EngCorrosion, NO_OWNER);
|
||||
DoEnergy(-::MaterialMap.Map[InMat].Corrosive/15,false,C4FxCall_EngCorrosion, NO_OWNER);
|
||||
|
||||
// InMat incineration
|
||||
if (!Tick10)
|
||||
if (InMat!=MNone)
|
||||
if (Game.Material.Map[InMat].Incindiary)
|
||||
if (::MaterialMap.Map[InMat].Incindiary)
|
||||
if (Def->ContactIncinerate)
|
||||
Incinerate(NO_OWNER);
|
||||
|
||||
|
@ -3951,14 +3951,14 @@ void C4Object::DigOutMaterialCast(BOOL fRequest)
|
|||
{
|
||||
// Check material contents for sufficient object cast amounts
|
||||
if (!MaterialContents) return;
|
||||
for (int32_t iMaterial=0; iMaterial<Game.Material.Num; iMaterial++)
|
||||
for (int32_t iMaterial=0; iMaterial< ::MaterialMap.Num; iMaterial++)
|
||||
if (MaterialContents->Amount[iMaterial])
|
||||
if (Game.Material.Map[iMaterial].Dig2Object!=C4ID_None)
|
||||
if (Game.Material.Map[iMaterial].Dig2ObjectRatio!=0)
|
||||
if (fRequest || !Game.Material.Map[iMaterial].Dig2ObjectOnRequestOnly)
|
||||
if (MaterialContents->Amount[iMaterial]>=Game.Material.Map[iMaterial].Dig2ObjectRatio)
|
||||
if (::MaterialMap.Map[iMaterial].Dig2Object!=C4ID_None)
|
||||
if (::MaterialMap.Map[iMaterial].Dig2ObjectRatio!=0)
|
||||
if (fRequest || !::MaterialMap.Map[iMaterial].Dig2ObjectOnRequestOnly)
|
||||
if (MaterialContents->Amount[iMaterial]>=::MaterialMap.Map[iMaterial].Dig2ObjectRatio)
|
||||
{
|
||||
Game.CreateObject(Game.Material.Map[iMaterial].Dig2Object,this,NO_OWNER,GetX(), GetY()+Shape.GetY()+Shape.Hgt,Random(360));
|
||||
Game.CreateObject(::MaterialMap.Map[iMaterial].Dig2Object,this,NO_OWNER,GetX(), GetY()+Shape.GetY()+Shape.Hgt,Random(360));
|
||||
MaterialContents->Amount[iMaterial]=0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,14 +55,14 @@ void C4PXS::Execute()
|
|||
// Material conversion
|
||||
int32_t iX = fixtoi(x), iY = fixtoi(y);
|
||||
inmat=GBackMat(iX,iY);
|
||||
C4MaterialReaction *pReact = Game.Material.GetReactionUnsafe(Mat, inmat);
|
||||
C4MaterialReaction *pReact = ::MaterialMap.GetReactionUnsafe(Mat, inmat);
|
||||
if (pReact && (*pReact->pFunc)(pReact, iX,iY, iX,iY, xdir,ydir, Mat,inmat, meePXSPos, NULL))
|
||||
{ Deactivate(); return; }
|
||||
|
||||
// Gravity
|
||||
ydir+=GravAccel;
|
||||
|
||||
if(GBackDensity(iX, iY + 1) < Game.Material.Map[Mat].Density)
|
||||
if(GBackDensity(iX, iY + 1) < ::MaterialMap.Map[Mat].Density)
|
||||
{
|
||||
// Air speed: Wind plus some random
|
||||
int32_t iWind = GBackWind(iX, iY);
|
||||
|
@ -70,7 +70,7 @@ void C4PXS::Execute()
|
|||
FIXED tydir = FIXED256(Random(1200) - 600);
|
||||
|
||||
// Air friction, based on WindDrift. MaxSpeed is ignored.
|
||||
int32_t iWindDrift = Max(Game.Material.Map[Mat].WindDrift - 20, 0);
|
||||
int32_t iWindDrift = Max(::MaterialMap.Map[Mat].WindDrift - 20, 0);
|
||||
xdir += ((txdir - xdir) * iWindDrift) * WindDrift_Factor;
|
||||
ydir += ((tydir - ydir) * iWindDrift) * WindDrift_Factor;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ void C4PXS::Execute()
|
|||
int32_t inX = iX + Sign(iToX - iX), inY = iY + Sign(iToY - iY);
|
||||
// Contact?
|
||||
inmat = GBackMat(inX, inY);
|
||||
C4MaterialReaction *pReact = Game.Material.GetReactionUnsafe(Mat, inmat);
|
||||
C4MaterialReaction *pReact = ::MaterialMap.GetReactionUnsafe(Mat, inmat);
|
||||
if (pReact)
|
||||
if ((*pReact->pFunc)(pReact, iX,iY, inX,inY, xdir,ydir, Mat,inmat, meePXSMove, &fStopMovement))
|
||||
{
|
||||
|
@ -256,7 +256,7 @@ void C4PXSSystem::Draw(C4TargetFacet &cgo)
|
|||
for (unsigned int cnt2 = 0; cnt2<PXSChunkSize; cnt2++,pxp++)
|
||||
if (pxp->Mat != MNone && VisibleRect.Contains(fixtoi(pxp->x), fixtoi(pxp->y)))
|
||||
{
|
||||
C4Material *pMat=&Game.Material.Map[pxp->Mat];
|
||||
C4Material *pMat=&::MaterialMap.Map[pxp->Mat];
|
||||
if (pMat->PXSFace.Surface && Config.Graphics.PXSGfx)
|
||||
continue;
|
||||
// old-style: unicolored pixels or lines
|
||||
|
@ -295,7 +295,7 @@ void C4PXSSystem::Draw(C4TargetFacet &cgo)
|
|||
for (unsigned int cnt2 = 0; cnt2<PXSChunkSize; cnt2++,pxp++)
|
||||
if (pxp->Mat != MNone && VisibleRect.Contains(fixtoi(pxp->x), fixtoi(pxp->y)))
|
||||
{
|
||||
C4Material *pMat=&Game.Material.Map[pxp->Mat];
|
||||
C4Material *pMat=&::MaterialMap.Map[pxp->Mat];
|
||||
if (!pMat->PXSFace.Surface)
|
||||
continue;
|
||||
// new-style: graphics
|
||||
|
|
|
@ -2245,7 +2245,7 @@ static bool FnFlameConsumeMaterial(C4AulContext *cthr, long x, long y)
|
|||
if (cthr->Obj) { x+=cthr->Obj->GetX(); y+=cthr->Obj->GetY(); }
|
||||
long mat=GBackMat(x,y);
|
||||
if (!MatValid(mat)) return false;
|
||||
if (!Game.Material.Map[mat].Inflammable) return false;
|
||||
if (!::MaterialMap.Map[mat].Inflammable) return false;
|
||||
if (::Landscape.ExtractMaterial(x,y)==MNone) return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -2280,7 +2280,7 @@ static bool FnInsertMaterial(C4AulContext *cthr, long mat, long x, long y, long
|
|||
static long FnGetMaterialCount(C4AulContext *cthr, long iMaterial, bool fReal)
|
||||
{
|
||||
if(!MatValid(iMaterial)) return -1;
|
||||
if(fReal || !Game.Material.Map[iMaterial].MinHeightCount)
|
||||
if(fReal || !::MaterialMap.Map[iMaterial].MinHeightCount)
|
||||
return ::Landscape.MatCount[iMaterial];
|
||||
else
|
||||
return ::Landscape.EffectiveMatCount[iMaterial];
|
||||
|
@ -2563,7 +2563,7 @@ static bool FnScriptGo(C4AulContext *cthr, bool go)
|
|||
static bool FnCastPXS(C4AulContext *cthr, C4String *mat_name, long amt, long level, long tx, long ty)
|
||||
{
|
||||
if (cthr->Obj) { tx+=cthr->Obj->GetX(); ty+=cthr->Obj->GetY(); }
|
||||
::PXS.Cast(Game.Material.Get(FnStringPar(mat_name)),amt,tx,ty,level);
|
||||
::PXS.Cast(::MaterialMap.Get(FnStringPar(mat_name)),amt,tx,ty,level);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -2576,7 +2576,7 @@ static bool FnCastObjects(C4AulContext *cthr, C4ID id, long amt, long level, lon
|
|||
|
||||
static long FnMaterial(C4AulContext *cthr, C4String *mat_name)
|
||||
{
|
||||
return Game.Material.Get(FnStringPar(mat_name));
|
||||
return ::MaterialMap.Get(FnStringPar(mat_name));
|
||||
}
|
||||
|
||||
C4Object* FnPlaceVegetation(C4AulContext *cthr, C4ID id, long iX, long iY, long iWdt, long iHgt, long iGrowth)
|
||||
|
@ -3179,7 +3179,7 @@ static long FnLaunchLightning(C4AulContext *cthr, long x, long y, long xdir, lon
|
|||
static long FnLaunchVolcano(C4AulContext *cthr, long x)
|
||||
{
|
||||
return Game.Weather.LaunchVolcano(
|
||||
Game.Material.Get("Lava"),
|
||||
::MaterialMap.Get("Lava"),
|
||||
x,GBackHgt-1,
|
||||
BoundBy(15*GBackHgt/500+Random(10),10,60));
|
||||
}
|
||||
|
@ -4427,10 +4427,10 @@ static C4Value FnGetMaterialVal(C4AulContext* cthr, C4Value* strEntry_C4V, C4Val
|
|||
long iMat = iMat_C4V->getInt();
|
||||
long iEntryNr = iEntryNr_C4V->getInt();
|
||||
|
||||
if(iMat < 0 || iMat >= Game.Material.Num) return C4Value();
|
||||
if(iMat < 0 || iMat >= ::MaterialMap.Num) return C4Value();
|
||||
|
||||
// get material
|
||||
C4Material *pMaterial = &Game.Material.Map[iMat];
|
||||
C4Material *pMaterial = &::MaterialMap.Map[iMat];
|
||||
|
||||
// get plr info core
|
||||
C4MaterialCore* pMaterialCore = static_cast<C4MaterialCore*>(pMaterial);
|
||||
|
@ -4594,7 +4594,7 @@ static bool FnSetMaterialColor(C4AulContext* cthr, long iMat, long iClr1R, long
|
|||
{
|
||||
// get mat
|
||||
if (!MatValid(iMat)) return FALSE;
|
||||
C4Material *pMat = &Game.Material.Map[iMat];
|
||||
C4Material *pMat = &::MaterialMap.Map[iMat];
|
||||
// newgfx: emulate by landscape modulation - enlightment not allowed...
|
||||
DWORD dwBack, dwMod=GetClrModulation(C4RGB(pMat->Color[0], pMat->Color[1], pMat->Color[2]), C4RGB(iClr1R, iClr1G, iClr1B), dwBack);
|
||||
dwMod&=0xffffff;
|
||||
|
@ -4609,7 +4609,7 @@ static long FnGetMaterialColor(C4AulContext* cthr, long iMat, long iNum, long iC
|
|||
{
|
||||
// get mat
|
||||
if (!MatValid(iMat)) return FALSE;
|
||||
C4Material *pMat = &Game.Material.Map[iMat];
|
||||
C4Material *pMat = &::MaterialMap.Map[iMat];
|
||||
// get color
|
||||
return pMat->Color[iNum*3+iChannel];
|
||||
}
|
||||
|
@ -4619,7 +4619,7 @@ static C4String *FnMaterialName(C4AulContext* cthr, long iMat)
|
|||
// mat valid?
|
||||
if (!MatValid(iMat)) return NULL;
|
||||
// return mat name
|
||||
return String(Game.Material.Map[iMat].Name);
|
||||
return String(::MaterialMap.Map[iMat].Name);
|
||||
}
|
||||
|
||||
static bool FnSetMenuSize(C4AulContext* cthr, long iCols, long iRows, C4Object *pObj)
|
||||
|
@ -5011,8 +5011,8 @@ static bool FnDrawModLandscape(C4AulContext *cctx, long iX, long iY, long iWdt,
|
|||
|
||||
long iX2=iX+iWdt; long iY2=iY+iHgt;
|
||||
// get material modification values
|
||||
C4ModLandscapeMatRec *MatInfo = new C4ModLandscapeMatRec[Game.Material.Num];
|
||||
for (int i=0; i<Game.Material.Num; ++i)
|
||||
C4ModLandscapeMatRec *MatInfo = new C4ModLandscapeMatRec[::MaterialMap.Num];
|
||||
for (int i=0; i< ::MaterialMap.Num; ++i)
|
||||
{
|
||||
MatInfo[i].iMode=pObj->Local.GetItem(i*3+0).getInt();
|
||||
MatInfo[i].iClr1=pObj->Local.GetItem(i*3+1).getInt();
|
||||
|
|
|
@ -77,13 +77,13 @@ bool C4TexMapEntry::Init()
|
|||
{
|
||||
#ifdef C4ENGINE
|
||||
// Find material
|
||||
iMaterialIndex = Game.Material.Get(Material.getData());
|
||||
iMaterialIndex = ::MaterialMap.Get(Material.getData());
|
||||
if(!MatValid(iMaterialIndex))
|
||||
{
|
||||
DebugLogF("Error initializing material %s-%s: Invalid material!", Material.getData(), Texture.getData());
|
||||
return false;
|
||||
}
|
||||
pMaterial = &Game.Material.Map[iMaterialIndex];
|
||||
pMaterial = &::MaterialMap.Map[iMaterialIndex];
|
||||
// Find texture
|
||||
C4Texture * sfcTexture = ::TextureMap.GetTexture(Texture.getData());
|
||||
if(!sfcTexture)
|
||||
|
@ -362,14 +362,14 @@ int32_t C4TextureMap::GetIndexMatTex(const char *szMaterialTexture, const char *
|
|||
return iMatTex;
|
||||
#ifdef C4ENGINE
|
||||
// search material
|
||||
long iMaterial = Game.Material.Get(szMaterialTexture);
|
||||
long iMaterial = ::MaterialMap.Get(szMaterialTexture);
|
||||
if (!MatValid(iMaterial))
|
||||
{
|
||||
if (szErrorIfFailed) DebugLogF("Error getting MatTex for %s: Invalid material", szErrorIfFailed);
|
||||
return 0;
|
||||
}
|
||||
// return default map entry
|
||||
return Game.Material.Map[iMaterial].DefaultMatTex;
|
||||
return ::MaterialMap.Map[iMaterial].DefaultMatTex;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
|
|
|
@ -500,8 +500,8 @@ void C4ToolsDlg::InitMaterialCtrls()
|
|||
// Materials
|
||||
#ifdef _WIN32
|
||||
SendDlgItemMessage(hDialog,IDC_COMBOMATERIAL,CB_ADDSTRING,0,(LPARAM)C4TLS_MatSky);
|
||||
for (int32_t cnt=0; cnt<Game.Material.Num; cnt++)
|
||||
SendDlgItemMessage(hDialog,IDC_COMBOMATERIAL,CB_ADDSTRING,0,(LPARAM)Game.Material.Map[cnt].Name);
|
||||
for (int32_t cnt=0; cnt< ::MaterialMap.Num; cnt++)
|
||||
SendDlgItemMessage(hDialog,IDC_COMBOMATERIAL,CB_ADDSTRING,0,(LPARAM)::MaterialMap.Map[cnt].Name);
|
||||
SendDlgItemMessage(hDialog,IDC_COMBOMATERIAL,CB_SELECTSTRING,0,(LPARAM)Material);
|
||||
#else
|
||||
#ifdef WITH_DEVELOPER_MODE
|
||||
|
@ -511,9 +511,9 @@ void C4ToolsDlg::InitMaterialCtrls()
|
|||
gtk_list_store_clear(list);
|
||||
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(materials), C4TLS_MatSky);
|
||||
for(int32_t cnt = 0; cnt < Game.Material.Num; cnt++)
|
||||
for(int32_t cnt = 0; cnt < ::MaterialMap.Num; cnt++)
|
||||
{
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(materials), Game.Material.Map[cnt].Name);
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(materials), ::MaterialMap.Map[cnt].Name);
|
||||
}
|
||||
g_signal_handler_unblock(materials, handlerMaterials);
|
||||
SelectComboBoxText(GTK_COMBO_BOX(materials), Material);
|
||||
|
@ -677,7 +677,7 @@ void C4ToolsDlg::UpdatePreview()
|
|||
// Material-Texture
|
||||
else
|
||||
{
|
||||
bCol=Mat2PixColDefault(Game.Material.Get(Material));
|
||||
bCol=Mat2PixColDefault(::MaterialMap.Get(Material));
|
||||
// Get/Create TexMap entry
|
||||
BYTE iTex = ::TextureMap.GetIndex(Material, Texture, TRUE);
|
||||
if (iTex)
|
||||
|
|
|
@ -134,7 +134,7 @@ void C4Weather::Execute()
|
|||
// Volcano
|
||||
if (!Random(60))
|
||||
if (Random(100)<VolcanoLevel)
|
||||
LaunchVolcano(Game.Material.Get("Lava"),
|
||||
LaunchVolcano(::MaterialMap.Get("Lava"),
|
||||
Random(GBackWdt),GBackHgt-1,
|
||||
BoundBy(15*GBackHgt/500+Random(10),10,60));
|
||||
}
|
||||
|
@ -199,10 +199,10 @@ BOOL C4Weather::LaunchEarthquake(int32_t iX, int32_t iY)
|
|||
|
||||
BOOL C4Weather::LaunchCloud(int32_t iX, int32_t iY, int32_t iWidth, int32_t iStrength, const char *szPrecipitation)
|
||||
{
|
||||
if (Game.Material.Get(szPrecipitation)==MNone) return FALSE;
|
||||
if (::MaterialMap.Get(szPrecipitation)==MNone) return FALSE;
|
||||
C4Object *pObj;
|
||||
if (pObj=Game.CreateObject(C4Id("FXP1"),NULL,NO_OWNER,iX,iY))
|
||||
if (!!pObj->Call(PSF_Activate,&C4AulParSet(C4VInt(Game.Material.Get(szPrecipitation)),
|
||||
if (!!pObj->Call(PSF_Activate,&C4AulParSet(C4VInt(::MaterialMap.Get(szPrecipitation)),
|
||||
C4VInt(iWidth),
|
||||
C4VInt(iStrength))))
|
||||
return TRUE;
|
||||
|
|
|
@ -34,7 +34,7 @@ int32_t PixCol2MatOld(BYTE pixc)
|
|||
{
|
||||
if (pixc < GBM) return MNone;
|
||||
pixc &= 63; // Substract GBM, ignore IFT
|
||||
if (pixc > Game.Material.Num*C4M_ColsPerMat-1) return MNone;
|
||||
if (pixc > ::MaterialMap.Num*C4M_ColsPerMat-1) return MNone;
|
||||
return pixc / C4M_ColsPerMat;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ int32_t PixCol2MatOld2(BYTE pixc)
|
|||
// equals middle vehicle-color
|
||||
if (iMat==MVehic+1) return MVehic;
|
||||
// above: range check
|
||||
iMat-=2; if (iMat >= Game.Material.Num) return MNone;
|
||||
iMat-=2; if (iMat >= ::MaterialMap.Num) return MNone;
|
||||
return iMat;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue