Add two new Material Shapes Octagon and Smoother, more chunk antialias

Previously, smooth materials would get extra triangles at the top to create
slopes instead of steps. Now those also appear at the bottom.

Smooth also gets generally smoother at the bottom, while Rough gets rougher
at the top. The new Smoother material is somewhere between Flat and Smooth.
Octagon is like Flat but also gets straight slope triangles.
Günther Brammer 2011-09-07 14:25:32 +02:00
parent 6524f5b9d5
commit 6d6737a022
24 changed files with 226 additions and 162 deletions

View File

@ -3,16 +3,16 @@
# PeterW <Peter.Wortmann@gmx.de>
# Sven2 <sven2@goldwipf.de>
# Armin Burgmeier <armin@arbur.net>, 2010.
# Günther Brammer <gbrammer@gmx.de>, 2009, 2010, 2011.
# Benedict Etzel <benedict.etzel@gmail.com>, 2011.
# Günther Brammer <gbrammer@gmx.de>, 2009, 2010, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: OpenClonk documentation\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-09-05 22:05+0200\n"
"PO-Revision-Date: 2011-07-01 15:00+0100\n"
"Last-Translator: Benedict Etzel <benedict.etzel@gmail.com>\n"
"POT-Creation-Date: 2011-09-06 23:32+0200\n"
"PO-Revision-Date: 2011-09-06 23:16+0200\n"
"Last-Translator: Günther Brammer <gbrammer@gmx.de>\n"
"Language-Team: German <>\n"
"Language: German\n"
"MIME-Version: 1.0\n"
@ -153,7 +153,6 @@ msgstr "Scripte"
#: sdk/particle/index.xml:161(h)
#: sdk/definition/properties.xml:6(title)
#: sdk/definition/properties.xml:7(h)
#: sdk/definition/properties.xml:22(caption)
msgid "Properties"
msgstr "Eigenschaften"
@ -13822,8 +13821,8 @@ msgid "Shape"
msgstr "Shape"
#: sdk/material/ocm.xml:31(col)
msgid "Shape of surface: 0 smooth, 1 smooth on top, 2 semi rough, 3 rough."
msgstr "Landschaftsform: 0 glatt, 1 oben glatt, 2 halbrauh, 3 komplett rauh."
msgid "Shape of surface: Flat (0), Octagon, FlatTop (1), Smoother, Smooth (2) or Rough (3)."
msgstr "Form der Oberfläche: Flat (0, flach), Octagon (achteckig), FlatTop (1, oben flach), Smoother (weicher), Smooth (2, weich) oder Rough (3, rau)."
#: sdk/material/ocm.xml:34(col)
msgid "Density"
@ -15367,6 +15366,10 @@ msgstr "Die Engine ruft zu Zeiten die folgenden Funktionen in Objektscripten auf
msgid "Every object has a number of properties that are handled by the engine. Typically, these are inherited from the object's Prototype, an <emlink href=\"definition/index.html#Objektdefinitionen\">Object Definition</emlink>. A Property of an Object Definition is defined with the <code>local</code> keyword in the <emlink href=\"definition/script.html#Objektscripte\">Definition's script</emlink>:"
msgstr "Jedes Objekt besitzt Properties die von der engine interpretiert werden. Normalerweise werden diese vom Prototyp des objekts abgeleitet, seiner <emlink href=\"definition/index.html#Objektdefinitionen\">Objektdefinition</emlink>. Eine Property einer Objektdefinition wird mit dem <code>local</code>-Schlüsselwort im <emlink href=\"definition/script.html#Objektscripte\">Definitionsscript</emlink> definiert."
#: sdk/definition/properties.xml:22(caption)
msgid "Object Properties"
msgstr "Objekteigenschaften"
#: sdk/definition/properties.xml:30(col)
#: sdk/definition/properties.xml:50(col)
#: sdk/definition/properties.xml:90(col)
@ -15398,11 +15401,11 @@ msgstr "[int, int]"
#: sdk/definition/properties.xml:121(col)
msgid "The Objects's major Z-Position. See <placeholder-1/>."
msgstr ""
msgstr "Die hauptsächliche Z-Position des Objekts. Siehe auch <placeholder-1/>."
#: sdk/definition/properties.xml:126(col)
msgid "The Object's minor Z-Position. Negative values are behind the landscape, positive values before it."
msgstr ""
msgstr "Die sekundäre Z-Position des Objekts. Negative Werte sind hinter der Landschaft, positive vor ihr."
#: sdk/definition/procedures.xml:8(text)
msgid "For object activity the engine offers various standard procedures which perform typical physcial behaviour. In procedure WALK, for instance, the activity automatically changes to \"Jump\" if the ground under the feet is lost."
@ -16989,6 +16992,9 @@ msgstr "c4group.exe (Windows) c4group (Linux) c4group (Mac)"
msgid "This command line program is used for processing group files. A list of command line options is available by starting the program without parameters via command line (<i>not</i> by double clicking)."
msgstr "Dieses Kommandozeilen-Programm dient zum Bearbeiten von Gruppendateien. Es kann nicht per Doppelklick, sondern nur per Kommandozeile (Eingabeaufforderung) gestartet werden. Auskunft über alle verfügbaren Kommandozeilenparameter erhält man, indem man das Programm ohne weitere Parameter über die Kommandozeile startet."
#~ msgid "Shape of surface: 0 smooth, 1 smooth on top, 2 semi rough, 3 rough."
#~ msgstr "Landschaftsform: 0 glatt, 1 oben glatt, 2 halbrauh, 3 komplett rauh."
#~ msgid "The object will only be visible for it's owner and the spectators."
#~ msgstr "Das Objekt wird nur für seinen Besitzer und Zuschauer sichtbar."

View File

@ -28,7 +28,7 @@
<row>
<col>Shape</col>
<col>Integer</col>
<col>Shape of surface: 0 smooth, 1 smooth on top, 2 semi rough, 3 rough.</col>
<col>Shape of surface: Flat (0), Octagon, FlatTop (1), Smoother, Smooth (2) or Rough (3).</col>
</row>
<row>
<col>Density</col>

View File

@ -1,6 +1,6 @@
[Material]
Name=Ice
Shape=1
Shape=TopFlat
Density=50
Friction=15
BlastFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Snow
Shape=2
Shape=Smooth
Density=50
Friction=40
DigFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Ametyst
Shape=3
Shape=Rough
Density=50
Friction=15
BlastFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Ruby
Shape=3
Shape=Rough
Density=50
Friction=15
BlastFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Brick
Shape=0
Shape=Flat
Density=50
Friction=15
Placement=80

View File

@ -1,6 +1,6 @@
[Material]
Name=BrickSoft
Shape=0
Shape=Flat
Density=50
Placement=60
TextureOverlay=brick1

View File

@ -1,6 +1,6 @@
[Material]
Name=Coal
Shape=3
Shape=Rough
Density=50
Friction=75
DigFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Earth
Shape=2
Shape=Smooth
Density=50
Friction=80
DigFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Gold
Shape=3
Shape=Rough
Density=50
Friction=100
BlastFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Granite
Shape=3
Shape=Rough
Density=50
Friction=100
MaxAirSpeed=100

View File

@ -1,6 +1,6 @@
[Material]
Name=Ice
Shape=1
Shape=TopFlat
Density=50
Friction=15
DigFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Ore
Shape=3
Shape=Rough
Density=50
Friction=100
BlastFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Rock
Shape=3
Shape=Rough
Density=50
Friction=100
BlastFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Sand
Shape=2
Shape=Smooth
Density=50
Friction=80
DigFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=SandDry
Shape=2
Shape=Smooth
Density=50
Friction=30
DigFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Snow
Shape=2
Shape=Smooth
Density=50
Friction=40
DigFree=1

View File

@ -1,6 +1,6 @@
[Material]
Name=Sulphur
Shape=3
Shape=Rough
Density=50
Friction=75
DigFree=1

View File

@ -1,5 +1,5 @@
[Material]
Name=Tunnel
Shape=2
Shape=Smooth
Placement=5
TextureOverlay=tunnel

View File

@ -1586,56 +1586,64 @@ uint32_t C4Landscape::ChunkyRandom(uint32_t & iOffset, uint32_t iRange)
return (iOffset ^ MapSeed) % iRange;
}
void C4Landscape::DrawChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, int32_t iChunkType, uint32_t cro)
void C4Landscape::DrawChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, C4MaterialCoreShape Shape, uint32_t cro)
{
BYTE top_rough = 0; BYTE side_rough = 0;
unsigned int top_rough = 0, side_rough = 0, bottom_rough = 0;
// what to do?
switch (iChunkType)
switch (Shape)
{
case C4M_Flat:
case C4M_Flat: case C4M_Octagon:
Surface8->Box(tx, ty, tx + wdt, ty + hgt, mcol);
return;
case C4M_TopFlat:
top_rough = 0; side_rough = 1;
top_rough = 0; side_rough = 2; bottom_rough = 4;
break;
case C4M_Smooth:
top_rough = 1; side_rough = 1;
top_rough = 2; side_rough = 2; bottom_rough = 2;
break;
case C4M_Rough:
top_rough = 1; side_rough = 2;
top_rough = 4; side_rough = 4; bottom_rough = 4;
break;
case C4M_Smoother:
top_rough = 1; side_rough = 1; bottom_rough = 1;
break;
case C4M_None: // no drawing
return;
}
int vtcs[16];
uint32_t rx = Max(wdt / 2, 1);
unsigned int rx = Max(wdt / 2, 1);
vtcs[0] = tx - ChunkyRandom(cro, rx / 2); vtcs[1] = ty - ChunkyRandom(cro, rx / 2 * top_rough);
vtcs[2] = tx - ChunkyRandom(cro, rx * side_rough); vtcs[3] = ty + hgt / 2;
vtcs[4] = tx - ChunkyRandom(cro, rx); vtcs[5] = ty + hgt + ChunkyRandom(cro, rx);
vtcs[6] = tx + wdt / 2; vtcs[7] = ty + hgt + ChunkyRandom(cro, 2 * rx);
vtcs[8] = tx + wdt + ChunkyRandom(cro, rx); vtcs[9] = ty + hgt + ChunkyRandom(cro, rx);
vtcs[10] = tx + wdt + ChunkyRandom(cro, rx * side_rough); vtcs[11] = ty + hgt / 2;
vtcs[12] = tx + wdt + ChunkyRandom(cro, rx / 2); vtcs[13] = ty - ChunkyRandom(cro, rx / 2 * top_rough);
vtcs[14] = tx + wdt / 2; vtcs[15] = ty - ChunkyRandom(cro, rx * top_rough);
vtcs[0] = tx - ChunkyRandom(cro, rx * side_rough / 4); vtcs[1] = ty - ChunkyRandom(cro, rx * top_rough / 4);
vtcs[2] = tx - ChunkyRandom(cro, rx * side_rough / 2); vtcs[3] = ty + hgt / 2;
vtcs[4] = tx - ChunkyRandom(cro, rx * side_rough / 4); vtcs[5] = ty + hgt + ChunkyRandom(cro, rx * bottom_rough / 4);
vtcs[6] = tx + wdt / 2; vtcs[7] = ty + hgt + ChunkyRandom(cro, rx * bottom_rough / 2);
vtcs[8] = tx + wdt + ChunkyRandom(cro, rx * side_rough / 4); vtcs[9] = ty + hgt + ChunkyRandom(cro, rx * bottom_rough / 4);
vtcs[10] = tx + wdt + ChunkyRandom(cro, rx * side_rough / 2); vtcs[11] = ty + hgt / 2;
vtcs[12] = tx + wdt + ChunkyRandom(cro, rx * side_rough / 4); vtcs[13] = ty - ChunkyRandom(cro, rx * top_rough / 4);
vtcs[14] = tx + wdt / 2; vtcs[15] = ty - ChunkyRandom(cro, rx * top_rough / 2);
ForPolygon(vtcs, 8, NULL, NULL, mcol);
}
void C4Landscape::DrawSmoothOChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, BYTE flip, uint32_t cro)
void C4Landscape::DrawSmoothOChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, int flip, uint32_t cro)
{
int vtcs[8];
uint32_t rx = Max(wdt / 2, 1);
unsigned int rx = Max(wdt / 2, 1);
vtcs[0] = tx; vtcs[1] = ty - ChunkyRandom(cro, rx / 2);
vtcs[0] = tx; vtcs[1] = ty;
vtcs[2] = tx; vtcs[3] = ty + hgt;
vtcs[4] = tx + wdt; vtcs[5] = ty + hgt;
vtcs[6] = tx + wdt; vtcs[7] = ty - ChunkyRandom(cro, rx / 2);
vtcs[6] = tx + wdt; vtcs[7] = ty;
if (flip)
{ vtcs[0] = tx + wdt / 2; vtcs[1] = ty + hgt / 3; }
else
{ vtcs[6] = tx + wdt / 2; vtcs[7] = ty + hgt / 3; }
switch (flip)
{
case 0: vtcs[0] = tx + wdt / 2; vtcs[1] += hgt / 3; vtcs[7] -= ChunkyRandom(cro, rx / 2); break;
case 1: vtcs[2] = tx + wdt / 2; vtcs[3] -= hgt / 3; vtcs[5] += ChunkyRandom(cro, rx / 2); break;
case 2: vtcs[4] = tx + wdt / 2; vtcs[5] -= hgt / 3; vtcs[3] += ChunkyRandom(cro, rx / 2); break;
case 3: vtcs[6] = tx + wdt / 2; vtcs[7] += hgt / 3; vtcs[1] -= ChunkyRandom(cro, rx / 2); break;
case 4: vtcs[0] = tx + wdt / 2; vtcs[1] += hgt / 2; break;
case 5: vtcs[2] = tx + wdt / 2; vtcs[3] -= hgt / 2; break;
case 6: vtcs[4] = tx + wdt / 2; vtcs[5] -= hgt / 2; break;
case 7: vtcs[6] = tx + wdt / 2; vtcs[7] += hgt / 2; break;
}
ForPolygon(vtcs, 4, NULL, NULL, mcol);
}
@ -1700,67 +1708,93 @@ void C4Landscape::DrawCustomShape(CSurface8 * sfcMap, C4MaterialShape *shape, in
void C4Landscape::ChunkOZoom(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iTexture, int32_t iOffX, int32_t iOffY)
{
int32_t iX,iY,iChunkWidth,iChunkHeight,iToX,iToY;
int32_t iIFT;
BYTE byMapPixel, byMapPixelBelow;
int iMapWidth,iMapHeight;
C4Material *pMaterial = ::TextureMap.GetEntry(iTexture)->GetMaterial();
if (!pMaterial) return;
int32_t iChunkType=pMaterial->MapChunkType;
BYTE byColor=MatTex2PixCol(iTexture);
C4MaterialCoreShape iChunkType = pMaterial->MapChunkType;
BYTE byColor = MatTex2PixCol(iTexture);
// Get map & landscape size
sfcMap->GetSurfaceSize(iMapWidth,iMapHeight);
int iMapWidth, iMapHeight;
sfcMap->GetSurfaceSize(iMapWidth, iMapHeight);
// Clip desired map segment to map size
iMapX=BoundBy<int32_t>(iMapX,0,iMapWidth-1); iMapY=BoundBy<int32_t>(iMapY,0,iMapHeight-1);
iMapWdt=BoundBy<int32_t>(iMapWdt,0,iMapWidth-iMapX); iMapHgt=BoundBy<int32_t>(iMapHgt,0,iMapHeight-iMapY);
iMapX = BoundBy<int32_t>(iMapX, 0, iMapWidth - 1);
iMapY = BoundBy<int32_t>(iMapY, 0, iMapHeight - 1);
iMapWdt = BoundBy<int32_t>(iMapWdt, 0, iMapWidth - iMapX);
iMapHgt = BoundBy<int32_t>(iMapHgt, 0, iMapHeight - iMapY);
// get chunk size
iChunkWidth=MapZoom; iChunkHeight=MapZoom;
int iChunkWidth = MapZoom, iChunkHeight = MapZoom;
// Scan map lines
if (pMaterial->MapChunkType != C4M_None)
for (int iY = iMapY; iY < iMapY + iMapHgt; iY++)
{
for (iY=iMapY; iY<iMapY+iMapHgt; iY++)
// Landscape target coordinate vertical
int iToY = iY * iChunkHeight + iOffY;
// Scan map line
for (int iX = iMapX; iX < iMapX + iMapWdt; iX++)
{
// Landscape target coordinate vertical
iToY=iY*iChunkHeight+iOffY;
// Scan map line
for (iX=iMapX; iX<iMapX+iMapWdt; iX++)
int32_t iIFT;
// Map scan line start
uint8_t MapPixel=sfcMap->_GetPix(iX, iY);
// Landscape target coordinate horizontal
int iToX = iX * iChunkWidth + iOffX;
// Here's a chunk of the texture-material to zoom
if ((MapPixel & 127) == iTexture)
{
// Determine IFT
iIFT = 0; if (MapPixel >= 128) iIFT = IFT;
// Draw chunk
DrawChunk(iToX, iToY, iChunkWidth, iChunkHeight, byColor + iIFT, iChunkType, (iX<<16)+iY);
}
// Other chunk, check for slope smoothers
else if (iChunkType == C4M_Smooth || iChunkType == C4M_Smoother || iChunkType == C4M_Octagon)
{
// Map scan line start
byMapPixel=sfcMap->_GetPix(iX, iY);
// Map scan line pixel below
byMapPixelBelow = sfcMap->GetPix(iX, iY + 1);
// Landscape target coordinate horizontal
iToX=iX*iChunkWidth+iOffX;
// Here's a chunk of the texture-material to zoom
if ((byMapPixel & 127) == iTexture)
uint8_t below = sfcMap->GetPix(iX, iY + 1) & 127;
uint8_t above = sfcMap->GetPix(iX, iY - 1) & 127;
uint8_t left = sfcMap->GetPix(iX - 1, iY) & 127;
uint8_t right = sfcMap->GetPix(iX + 1, iY) & 127;
// do not fill a tiny hole
if (below == iTexture && above == iTexture && left == iTexture && right == iTexture)
continue;
int flat = iChunkType == C4M_Octagon ? 4 : 0;
// Smooth chunk & same texture-material below
if (iY < iMapHeight - 1 && below == iTexture)
{
// Determine IFT
iIFT=0; if (byMapPixel>=128) iIFT=IFT;
// Draw chunk
DrawChunk(iToX,iToY,iChunkWidth,iChunkHeight,byColor+iIFT,pMaterial->MapChunkType,(iX<<16)+iY);
}
// Other chunk, check for slope smoothers
else
// Smooth chunk & same texture-material below
if ((iChunkType==C4M_Smooth) && (iY<iMapHeight-1) && ((byMapPixelBelow & 127)==iTexture))
// Same texture-material on left
if (iX > 0 && left == iTexture)
{
// Same texture-material on left
if ((iX>0) && ((sfcMap->GetPix(iX-1, iY) & 127)==iTexture))
{
// Determine IFT
iIFT=0; if (sfcMap->GetPix(iX-1, iY) >= 128) iIFT=IFT;
// Draw smoother
DrawSmoothOChunk(iToX,iToY,iChunkWidth,iChunkHeight,byColor+iIFT,0,(iX<<16)+iY);
}
// Same texture-material on right
if ((iX<iMapWidth-1) && ((sfcMap->GetPix(iX+1, iY) & 127)==iTexture))
{
// Determine IFT
iIFT=0; if (sfcMap->GetPix(iX+1, iY) >= 128) iIFT=IFT;
// Draw smoother
DrawSmoothOChunk(iToX,iToY,iChunkWidth,iChunkHeight,byColor+iIFT,1,(iX<<16)+iY);
}
// Determine IFT
iIFT = 0; if (sfcMap->GetPix(iX-1, iY) >= 128) iIFT = IFT;
// Draw smoother
DrawSmoothOChunk(iToX, iToY, iChunkWidth, iChunkHeight, byColor + iIFT, 3 + flat, (iX<<16) + iY);
}
// Same texture-material on right
if (iX < iMapWidth - 1 && right == iTexture)
{
// Determine IFT
iIFT = 0; if (sfcMap->GetPix(iX+1, iY) >= 128) iIFT = IFT;
// Draw smoother
DrawSmoothOChunk(iToX, iToY, iChunkWidth, iChunkHeight, byColor + iIFT, 0 + flat, (iX<<16)+iY);
}
}
// Smooth chunk & same texture-material above
if (iY > 0 && above == iTexture)
{
// Same texture-material on left
if (iX > 0 && left == iTexture)
{
// Determine IFT
iIFT = 0; if (sfcMap->GetPix(iX - 1, iY) >= 128) iIFT = IFT;
// Draw smoother
DrawSmoothOChunk(iToX, iToY, iChunkWidth, iChunkHeight, byColor + iIFT, 2 + flat, (iX<<16)+iY);
}
// Same texture-material on right
if (iX < iMapWidth - 1 && right == iTexture)
{
// Determine IFT
iIFT = 0; if (sfcMap->GetPix(iX + 1, iY) >= 128) iIFT = IFT;
// Draw smoother
DrawSmoothOChunk(iToX, iToY, iChunkWidth, iChunkHeight, byColor + iIFT, 1 + flat, (iX<<16)+iY);
}
}
}
}
}

View File

@ -210,8 +210,8 @@ protected:
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); // return static random value, according to offset and MapSeed
void DrawChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, int32_t iChunkType, uint32_t cro);
void DrawSmoothOChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, BYTE flip, uint32_t cro);
void DrawChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, C4MaterialCoreShape Shape, uint32_t cro);
void DrawSmoothOChunk(int32_t tx, int32_t ty, int32_t wdt, int32_t hgt, int32_t mcol, int flip, uint32_t cro);
void DrawCustomShapePoly(const C4MaterialShape::Poly &poly, int32_t off_x, int32_t off_y, int32_t mcol);
void DrawCustomShape(CSurface8 * sfcMap, C4MaterialShape *shape, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iTexture, int32_t mcol, int32_t iOffX, int32_t iOffY);
void ChunkOZoom(CSurface8 * sfcMap, int32_t iMapX, int32_t iMapY, int32_t iMapWdt, int32_t iMapHgt, int32_t iTexture,int32_t iOffX=0,int32_t iOffY=0);

View File

@ -232,7 +232,7 @@ void C4MaterialCore::Clear()
sBelowTempConvertTo.Clear();
sAboveTempConvertTo.Clear();
*Name='\0';
MapChunkType = 0;
MapChunkType = C4M_Flat;
ShapeTexture.Clear();
Density = 0;
Friction = 0;
@ -303,54 +303,73 @@ void C4MaterialCore::CompileFunc(StdCompiler *pComp)
{
if (pComp->isCompiler()) Clear();
pComp->Name("Material");
pComp->Value(mkNamingAdapt(toC4CStr(Name), "Name", "" ));
pComp->Value(mkNamingAdapt(ColorAnimation, "ColorAnimation", 0 ));
pComp->Value(mkNamingAdapt(MapChunkType, "Shape", 0 ));
pComp->Value(mkNamingAdapt(mkParAdapt(ShapeTexture, StdCompiler::RCT_All),"ShapeTexture", "" ));
pComp->Value(mkNamingAdapt(Density, "Density", 0 ));
pComp->Value(mkNamingAdapt(Friction, "Friction", 0 ));
pComp->Value(mkNamingAdapt(DigFree, "DigFree", 0 ));
pComp->Value(mkNamingAdapt(BlastFree, "BlastFree", 0 ));
pComp->Value(mkNamingAdapt(Blast2Object,"Blast2Object", C4ID::None ));
pComp->Value(mkNamingAdapt(Dig2Object, "Dig2Object", C4ID::None ));
pComp->Value(mkNamingAdapt(Dig2ObjectRatio, "Dig2ObjectRatio", 0 ));
pComp->Value(mkNamingAdapt(Dig2ObjectCollect, "Dig2ObjectCollect", 0 ));
pComp->Value(mkNamingAdapt(Blast2ObjectRatio, "Blast2ObjectRatio", 0 ));
pComp->Value(mkNamingAdapt(Blast2PXSRatio, "Blast2PXSRatio", 0 ));
pComp->Value(mkNamingAdapt(Instable, "Instable", 0 ));
pComp->Value(mkNamingAdapt(MaxAirSpeed, "MaxAirSpeed", 0 ));
pComp->Value(mkNamingAdapt(MaxSlide, "MaxSlide", 0 ));
pComp->Value(mkNamingAdapt(WindDrift, "WindDrift", 0 ));
pComp->Value(mkNamingAdapt(Inflammable, "Inflammable", 0 ));
pComp->Value(mkNamingAdapt(Incindiary, "Incindiary", 0 ));
pComp->Value(mkNamingAdapt(Corrode, "Corrode", 0 ));
pComp->Value(mkNamingAdapt(Corrosive, "Corrosive", 0 ));
pComp->Value(mkNamingAdapt(Extinguisher, "Extinguisher", 0 ));
pComp->Value(mkNamingAdapt(Soil, "Soil", 0 ));
pComp->Value(mkNamingAdapt(Placement, "Placement", 0 ));
pComp->Value(mkNamingAdapt(mkParAdapt(sTextureOverlay, StdCompiler::RCT_IdtfAllowEmpty),"TextureOverlay", "" ));
pComp->Value(mkNamingAdapt(OverlayType, "OverlayType", 0 ));
pComp->Value(mkNamingAdapt(mkParAdapt(sPXSGfx, StdCompiler::RCT_IdtfAllowEmpty), "PXSGfx", "" ));
pComp->Value(mkNamingAdapt(PXSGfxRt, "PXSGfxRt", TargetRect0 ));
pComp->Value(mkNamingAdapt(PXSGfxSize, "PXSGfxSize", PXSGfxRt.Wdt ));
pComp->Value(mkNamingAdapt(TempConvStrength, "TempConvStrength", 0 ));
pComp->Value(mkNamingAdapt(mkParAdapt(sBlastShiftTo, StdCompiler::RCT_IdtfAllowEmpty),"BlastShiftTo", "" ));
pComp->Value(mkNamingAdapt(mkParAdapt(sInMatConvert, StdCompiler::RCT_IdtfAllowEmpty),"InMatConvert", "" ));
pComp->Value(mkNamingAdapt(mkParAdapt(sInMatConvertTo, StdCompiler::RCT_IdtfAllowEmpty),"InMatConvertTo", "" ));
pComp->Value(mkNamingAdapt(InMatConvertDepth, "InMatConvertDepth", 0 ));
pComp->Value(mkNamingAdapt(AboveTempConvert, "AboveTempConvert", 0 ));
pComp->Value(mkNamingAdapt(AboveTempConvertDir, "AboveTempConvertDir",0 ));
pComp->Value(mkNamingAdapt(mkParAdapt(sAboveTempConvertTo, StdCompiler::RCT_IdtfAllowEmpty),"AboveTempConvertTo", "" ));
pComp->Value(mkNamingAdapt(BelowTempConvert, "BelowTempConvert", 0 ));
pComp->Value(mkNamingAdapt(BelowTempConvertDir, "BelowTempConvertDir",0 ));
pComp->Value(mkNamingAdapt(mkParAdapt(sBelowTempConvertTo, StdCompiler::RCT_IdtfAllowEmpty),"BelowTempConvertTo", "" ));
pComp->Value(mkNamingAdapt(MinHeightCount, "MinHeightCount", 0 ));
pComp->Value(mkNamingAdapt(SplashRate, "SplashRate", 10 ));
pComp->Value(mkNamingAdapt(toC4CStr(Name), "Name", ""));
pComp->Value(mkNamingAdapt(ColorAnimation, "ColorAnimation", 0));
const StdEnumEntry<C4MaterialCoreShape> Shapes[] =
{
{ "Flat", C4M_Flat },
{ "TopFlat", C4M_TopFlat },
{ "Smooth", C4M_Smooth },
{ "Rough", C4M_Rough },
{ "Octagon", C4M_Octagon },
{ "Smoother", C4M_Smoother },
{ NULL, C4M_Flat }
};
pComp->Value(mkNamingAdapt(mkEnumAdaptT<uint8_t>(MapChunkType, Shapes),
"Shape", C4M_Flat));
pComp->Value(mkNamingAdapt(mkParAdapt(ShapeTexture, StdCompiler::RCT_All),
"ShapeTexture", ""));
pComp->Value(mkNamingAdapt(Density, "Density", 0));
pComp->Value(mkNamingAdapt(Friction, "Friction", 0));
pComp->Value(mkNamingAdapt(DigFree, "DigFree", 0));
pComp->Value(mkNamingAdapt(BlastFree, "BlastFree", 0));
pComp->Value(mkNamingAdapt(Blast2Object, "Blast2Object", C4ID::None));
pComp->Value(mkNamingAdapt(Dig2Object, "Dig2Object", C4ID::None));
pComp->Value(mkNamingAdapt(Dig2ObjectRatio, "Dig2ObjectRatio", 0));
pComp->Value(mkNamingAdapt(Dig2ObjectCollect, "Dig2ObjectCollect", 0));
pComp->Value(mkNamingAdapt(Blast2ObjectRatio, "Blast2ObjectRatio", 0));
pComp->Value(mkNamingAdapt(Blast2PXSRatio, "Blast2PXSRatio", 0));
pComp->Value(mkNamingAdapt(Instable, "Instable", 0));
pComp->Value(mkNamingAdapt(MaxAirSpeed, "MaxAirSpeed", 0));
pComp->Value(mkNamingAdapt(MaxSlide, "MaxSlide", 0));
pComp->Value(mkNamingAdapt(WindDrift, "WindDrift", 0));
pComp->Value(mkNamingAdapt(Inflammable, "Inflammable", 0));
pComp->Value(mkNamingAdapt(Incindiary, "Incindiary", 0));
pComp->Value(mkNamingAdapt(Corrode, "Corrode", 0));
pComp->Value(mkNamingAdapt(Corrosive, "Corrosive", 0));
pComp->Value(mkNamingAdapt(Extinguisher, "Extinguisher", 0));
pComp->Value(mkNamingAdapt(Soil, "Soil", 0));
pComp->Value(mkNamingAdapt(Placement, "Placement", 0));
pComp->Value(mkNamingAdapt(mkParAdapt(sTextureOverlay, StdCompiler::RCT_IdtfAllowEmpty),
"TextureOverlay", ""));
pComp->Value(mkNamingAdapt(OverlayType, "OverlayType", 0));
pComp->Value(mkNamingAdapt(mkParAdapt(sPXSGfx, StdCompiler::RCT_IdtfAllowEmpty),
"PXSGfx", ""));
pComp->Value(mkNamingAdapt(PXSGfxRt, "PXSGfxRt", TargetRect0));
pComp->Value(mkNamingAdapt(PXSGfxSize, "PXSGfxSize", PXSGfxRt.Wdt));
pComp->Value(mkNamingAdapt(TempConvStrength, "TempConvStrength", 0));
pComp->Value(mkNamingAdapt(mkParAdapt(sBlastShiftTo, StdCompiler::RCT_IdtfAllowEmpty),
"BlastShiftTo", ""));
pComp->Value(mkNamingAdapt(mkParAdapt(sInMatConvert, StdCompiler::RCT_IdtfAllowEmpty),
"InMatConvert", ""));
pComp->Value(mkNamingAdapt(mkParAdapt(sInMatConvertTo, StdCompiler::RCT_IdtfAllowEmpty),
"InMatConvertTo", ""));
pComp->Value(mkNamingAdapt(InMatConvertDepth, "InMatConvertDepth", 0));
pComp->Value(mkNamingAdapt(AboveTempConvert, "AboveTempConvert", 0));
pComp->Value(mkNamingAdapt(AboveTempConvertDir, "AboveTempConvertDir", 0));
pComp->Value(mkNamingAdapt(mkParAdapt(sAboveTempConvertTo, StdCompiler::RCT_IdtfAllowEmpty),
"AboveTempConvertTo", ""));
pComp->Value(mkNamingAdapt(BelowTempConvert, "BelowTempConvert", 0));
pComp->Value(mkNamingAdapt(BelowTempConvertDir, "BelowTempConvertDir", 0));
pComp->Value(mkNamingAdapt(mkParAdapt(sBelowTempConvertTo, StdCompiler::RCT_IdtfAllowEmpty),
"BelowTempConvertTo", ""));
pComp->Value(mkNamingAdapt(MinHeightCount, "MinHeightCount", 0));
pComp->Value(mkNamingAdapt(SplashRate, "SplashRate", 10));
pComp->NameEnd();
// material reactions
pComp->Value(mkNamingAdapt(
mkSTLContainerAdapt(CustomReactionList),
"Reaction", std::vector<C4MaterialReaction>()));
pComp->Value(mkNamingAdapt(mkSTLContainerAdapt(CustomReactionList),
"Reaction", std::vector<C4MaterialReaction>()));
}

View File

@ -124,17 +124,27 @@ public:
typedef std::map<StdCopyStrBuf, C4MaterialShape> C4MaterialShapeMap;
enum C4MaterialCoreShape
{
C4M_Flat = 0,
C4M_TopFlat = 1,
C4M_Smooth = 2,
C4M_Rough = 3,
C4M_Octagon = 4,
C4M_Smoother= 5,
};
class C4MaterialCore
{
public:
C4MaterialCore();
~C4MaterialCore() { Clear(); }
public:
std::vector<C4MaterialReaction> CustomReactionList;
public:
char Name[C4M_MaxName+1];
int32_t MapChunkType;
C4MaterialCoreShape MapChunkType;
StdCopyStrBuf ShapeTexture;
int32_t Density;
int32_t Friction;
@ -176,7 +186,7 @@ public:
int32_t TempConvStrength;
int32_t MinHeightCount; // minimum material thickness in order for it to be counted
int32_t SplashRate;
public:
void Clear();
void Default();
bool Load(C4Group &hGroup, const char *szEntryName);
@ -248,13 +258,8 @@ protected:
extern C4MaterialMap MaterialMap;
const int32_t C4M_Flat = 0,
C4M_TopFlat = 1,
C4M_Smooth = 2,
C4M_Rough = 3,
C4M_None = 4,
// Material Density Levels
C4M_Vehicle = 100,
// Material Density Levels
const int32_t C4M_Vehicle = 100,
C4M_Solid = 50,
C4M_SemiSolid = 25,
C4M_Liquid = 25,