forked from Mirrors/openclonk
Backing out of some unwanted changes
parent
2562c08f0b
commit
fe8d566580
|
@ -25,9 +25,9 @@
|
|||
#include "C4Control.h"
|
||||
#include "C4Game.h"
|
||||
#include "C4Log.h"
|
||||
#include "C4GraphicsSystem.h"
|
||||
#include "C4GraphicsResource.h"
|
||||
#include "C4MouseControl.h"
|
||||
#include "C4GraphicsSystem.h"
|
||||
#include "C4Viewport.h"
|
||||
#include "C4Object.h"
|
||||
#include "C4ObjectMenu.h"
|
||||
|
|
|
@ -210,8 +210,40 @@ bool C4Shape::Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
|
|||
// Until a better solution for designing battlements is found, the old-style
|
||||
// behaviour will be used for Clonks. Both code variants should behave equally
|
||||
// for objects with only one matching vertex to cnat_pos.
|
||||
|
||||
// new-style attachment
|
||||
if (!(cnat_pos & CNAT_MultiAttach))
|
||||
{
|
||||
// old-style attachment
|
||||
for (vtx=0; vtx<VtxNum; vtx++)
|
||||
if (VtxCNAT[vtx] & cnat_pos)
|
||||
{
|
||||
xcd=ycd=0;
|
||||
switch (cnat_pos & (~CNAT_Flags))
|
||||
{
|
||||
case CNAT_Top: ycd=-1; break;
|
||||
case CNAT_Bottom: ycd=+1; break;
|
||||
case CNAT_Left: xcd=-1; break;
|
||||
case CNAT_Right: xcd=+1; break;
|
||||
}
|
||||
xcrng=AttachRange*xcd*(-1); ycrng=AttachRange*ycd*(-1);
|
||||
for (xcnt=xcrng,ycnt=ycrng; (xcnt!=-xcrng) || (ycnt!=-ycrng); xcnt+=xcd,ycnt+=ycd)
|
||||
{
|
||||
int32_t ax=cx+VtxX[vtx]+xcnt+xcd, ay=cy+VtxY[vtx]+ycnt+ycd;
|
||||
if (GBackDensity(ax,ay) >= ContactDensity)
|
||||
{
|
||||
cpix=GBackPix(ax,ay);
|
||||
AttachMat=PixCol2Mat(cpix);
|
||||
iAttachX=ax; iAttachY=ay;
|
||||
iAttachVtx=vtx;
|
||||
cx+=xcnt; cy+=ycnt;
|
||||
fAttached=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // CNAT_MultiAttach
|
||||
{
|
||||
// new-style attachment
|
||||
// determine attachment direction
|
||||
xcd=ycd=0;
|
||||
switch (cnat_pos & (~CNAT_Flags))
|
||||
|
@ -248,7 +280,8 @@ bool C4Shape::Attach(int32_t &cx, int32_t &cy, BYTE cnat_pos)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return fAttached;
|
||||
}
|
||||
|
||||
|
|
|
@ -963,7 +963,11 @@ void C4Player::CheckCrewExPromotion()
|
|||
C4Object *hirank;
|
||||
if ((hirank=GetHiRankActiveCrew(false)))
|
||||
if (hirank->Info)
|
||||
<<<<<<< local
|
||||
if (hirank->Info->Rank<1) // No Fähnrich -> except. promo.
|
||||
=======
|
||||
if (hirank->Info->Rank<1) // No Fähnrich -> except. promo.
|
||||
>>>>>>> other
|
||||
if ((hirank=GetHiExpActiveCrew(false)))
|
||||
hirank->Promote(1,true,false);
|
||||
}
|
||||
|
@ -1730,7 +1734,10 @@ int VisibilityCheck(int iVis, int sx, int sy, int cx, int cy)
|
|||
{
|
||||
int x = (sx * (st - i) + cx * i) / st, y = (sy * (st - i) + cy * i) / st;
|
||||
if(GBackSolid(x, y))
|
||||
return 0;
|
||||
{
|
||||
if((iVis -= 2) <= 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return iVis;
|
||||
}
|
||||
|
@ -1740,11 +1747,11 @@ void C4Player::FoW2Map(CClrModAddMap &rMap, int iOffX, int iOffY)
|
|||
// No fog of war
|
||||
if (!fFogOfWar) return;
|
||||
igOffX = iOffX; igOffY = iOffY;
|
||||
// Add view for all FoW-repellers - keep track of FoW-generators, which should be avaluated last
|
||||
// Add view for all FoW-repellers - keep track of FoW-generators, which should be avaluated finally
|
||||
// so they override repellers
|
||||
bool fAnyGenerators = false;
|
||||
C4Object *cobj; C4ObjectLink *clnk;
|
||||
for (clnk=FoWViewObjs.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
|
||||
C4Object *cobj; C4ObjectLink *clnk;
|
||||
for (clnk=FoWViewObjs.First; clnk && (cobj=clnk->Obj); clnk=clnk->Next)
|
||||
if (!cobj->Contained || cobj->Contained->Def->ClosedContainer != 1)
|
||||
{
|
||||
if (cobj->PlrViewRange > 0)
|
||||
|
|
|
@ -984,13 +984,7 @@ void C4Viewport::Draw(C4TargetFacet &cgo0, bool fDrawOverlay)
|
|||
C4Player *pPlr=::Players.Get(Player);
|
||||
if (pPlr && pPlr->fFogOfWar)
|
||||
{
|
||||
ClrModMap.Reset(Game.C4S.Landscape.FoWRes, Game.C4S.Landscape.FoWRes,
|
||||
ViewWdt/Zoom, ViewHgt/Zoom,
|
||||
cgo.TargetX,
|
||||
cgo.TargetY,
|
||||
0,
|
||||
cgo.X, cgo.Y,
|
||||
Game.FoWColor, cgo.Surface);
|
||||
ClrModMap.Reset(Game.C4S.Landscape.FoWRes, Game.C4S.Landscape.FoWRes, ViewWdt, ViewHgt, int(cgo.TargetX*Zoom), int(cgo.TargetY*Zoom), 0, cgo.X-BorderLeft, cgo.Y-BorderTop, Game.FoWColor, cgo.Surface);
|
||||
pPlr->FoW2Map(ClrModMap, int(float(cgo.X)/Zoom-cgo.TargetX), int(float(cgo.Y)/Zoom-cgo.TargetY));
|
||||
lpDDraw->SetClrModMap(&ClrModMap);
|
||||
lpDDraw->SetClrModMapEnabled(true);
|
||||
|
|
|
@ -272,14 +272,23 @@ CSurface *CClrModAddMap::GetSurface()
|
|||
|
||||
void CClrModAddMap::ReduceModulation(int cx, int cy, int Radius, int (*VisProc)(int, int, int, int, int))
|
||||
{
|
||||
// landscape coordinates: cx, cy, VisProc
|
||||
// display coordinates: zx, zy, x, y
|
||||
float zx = float(cx);
|
||||
float zy = float(cy);
|
||||
lpDDraw->ApplyZoom(zx, zy);
|
||||
Radius = int(lpDDraw->Zoom * Radius);
|
||||
// reveal all within iRadius1; fade off squared until iRadius2
|
||||
int x = OffX, y = OffY, xe = Wdt*ResolutionX+OffX;
|
||||
int RadiusSq = Radius*Radius;
|
||||
for (unsigned int i = 0; i < MapSize; i++)
|
||||
{
|
||||
if ((x-cx)*(x-cx)+(y-cy)*(y-cy) < RadiusSq)
|
||||
if ((x-zx)*(x-zx)+(y-zy)*(y-zy) < RadiusSq)
|
||||
{
|
||||
pMap[i] = 255; // Max<int>(pMap[i], VisProc(255, int(lx), int(ly), int(cx), int(cy)));
|
||||
float lx = float(x);
|
||||
float ly = float(y);
|
||||
lpDDraw->RemoveZoom(lx, ly);
|
||||
pMap[i] = Max<int>(pMap[i], VisProc(255, int(lx), int(ly), int(cx), int(cy)));
|
||||
}
|
||||
// next pos
|
||||
x += ResolutionX;
|
||||
|
@ -287,24 +296,6 @@ void CClrModAddMap::ReduceModulation(int cx, int cy, int Radius, int (*VisProc)(
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void CClrModAddMap::PropagateModulation(int (*VisProc)(int, int, int, int, int))
|
||||
{
|
||||
int x = OffX, y = OffY, xe = Wdt*ResolutionX+OffX;
|
||||
for(unsigned int i = 0; i < MapSize; i++)
|
||||
{
|
||||
if(pMap[i] > 0) {
|
||||
// propagate left?
|
||||
if((i % Wdt) > 0 && pMap[i - 1] < 255)
|
||||
pMap[i - 1] = VisProc(pMap[i - 1],
|
||||
|
||||
// next pos
|
||||
x += ResolutionX;
|
||||
if (x >= xe) { x = OffX; y += ResolutionY; }
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void CClrModAddMap::AddModulation(int cx, int cy, int Radius, uint8_t Transparency)
|
||||
{
|
||||
{
|
||||
|
@ -338,9 +329,6 @@ uint32_t CClrModAddMap::GetModAt(int x, int y) const
|
|||
// slower, more accurate method: Interpolate between 4 neighboured modulations
|
||||
x -= OffX;
|
||||
y -= OffY;
|
||||
|
||||
float lx = x, ly = y; lpDDraw->RemoveZoom(lx, ly); x = lx; y = ly;
|
||||
|
||||
int tx = BoundBy(x / ResolutionX, 0, Wdt-1);
|
||||
int ty = BoundBy(y / ResolutionY, 0, Hgt-1);
|
||||
int tx2 = Min(tx + 1, Wdt-1);
|
||||
|
@ -355,7 +343,7 @@ uint32_t CClrModAddMap::GetModAt(int x, int y) const
|
|||
uint32_t c3 = FadeTransparent ? 0xffffff | (Vis << 24) : 0xff000000|RGB(Vis, Vis, Vis);
|
||||
Vis = pMap[ty2*Wdt+tx2];
|
||||
uint32_t c4 = FadeTransparent ? 0xffffff | (Vis << 24) : 0xff000000|RGB(Vis, Vis, Vis);
|
||||
CColorFadeMatrix clrs(tx*ResolutionX, ty*ResolutionY, ResolutionX, ResolutionY, c1, c1, c1, c1);
|
||||
CColorFadeMatrix clrs(tx*ResolutionX, ty*ResolutionY, ResolutionX, ResolutionY, c1, c2, c3, c4);
|
||||
return clrs.GetColorAt(x, y);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ public:
|
|||
StdCopyStrBuf Name;
|
||||
float Length;
|
||||
|
||||
public:
|
||||
private:
|
||||
std::vector<StdMeshTrack*> Tracks; // bone-indexed
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue