Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
x += _xadd[facing][lastfacing];
y += _yadd[facing][lastfacing];
if (remap != NULL) {
void const *LightningShapes = MixFileClass::Retrieve("LITNING.SHP");
CC_Draw_Shape(LightningShapes, _shape[facing] + (shots ? 4 : 0), x, y, (window != WINDOW_PARTIAL) ? window : WINDOW_TACTICAL, SHAPE_FADING | SHAPE_CENTER | SHAPE_WIN_REL, remap);
} else {
void const *LightningShapes = MixFileClass::Retrieve("LITNING.SHP");
CC_Draw_Shape(LightningShapes, _shape[facing] + (shots ? 4 : 0), x, y, (window != WINDOW_PARTIAL) ? window : WINDOW_TACTICAL, SHAPE_CENTER | SHAPE_WIN_REL);
x += _xadd[facing][lastfacing];
y += _yadd[facing][lastfacing];
DLL_Draw_Intercept(_shape[facing] + (shots ? 4 : 0), x, y, 24, 24, SHAPE_CENTER | SHAPE_WIN_REL, this, "LITNING", -1, 256);
this error shows below, it still doesn't like the word "this". I was having issues with this techno/object error even using the CC_Draw_Shape as well:
const TechnoClass *const this
argument of type "const TechnoClass*" is incompatible with parameter of type "ObjectClass*"
//bool TechnoClass::Electric_Zap(COORDINATE target_coord, int which, WindowNumberType window, COORDINATE source_coord, unsigned char * remap) const // OLD RA CODE.
bool TechnoClass::Electric_Zap(COORDINATE target_coord, int which, WindowNumberType window, COORDINATE source_coord, unsigned char * remap) // NEW TD CODE.
{
//int x,y,x1,y1;
//PG init variables
int x = 0;
int y = 0;
int x1 = 0;
int y1 = 0;
COORDINATE source;
if (source_coord != 0) {
source = source_coord;
} else {
source = Fire_Coord(which);
}
if (What_Am_I() == RTTI_BUILDING) {
((BuildingClass *)this)->IsCharging = false;
}
bool gonnadraw = false;
if (SpecialDialog == SDLG_NONE) {
Map.Coord_To_Pixel(source, x, y);
Map.Coord_To_Pixel(target_coord, x1, y1);
x += Map.TacPixelX;
x1 += Map.TacPixelX;
y += Map.TacPixelY;
y1 += Map.TacPixelY;
gonnadraw = true;
}
static int _shape[]={ 2, 3, 1, 0, 2, 3, 1, 0};
static int _xadd[8][8]={
{ 0, 8, 8, 8, 0, 0, 0, 0},
{ 0, 8, 8, 8, 0, 0, 0, 0},
{ 0, 8, 8, 8, 0, 0, 0, 0},
{ 0, 8, 8, 8, 0, 0, 0, 0},
{ 0, 8, 8, 8, 0, 0, 0, 0},
{-8, 0, 0, 0,-8,-8,-8,-8},
{-8, 0, 0, 0,-8,-8,-8,-8},
{-8, 0, 0, 0,-8,-8,-8,-8}
};
static int _yadd[8][8]={
{-8,-8,-8, 0, 0, 0,-8,-8},
{-8,-8,-8, 0, 0, 0,-8,-8},
{ 0, 0, 0, 8, 8, 8, 0, 0},
{ 0, 0, 0, 8, 8, 8, 0, 0},
{ 0, 0, 0, 8, 8, 8, 0, 0},
{ 0, 0, 0, 8, 8, 8, 0, 0},
{ 0, 0, 0, 8, 8, 8, 0, 0},
{-8,-8,-8, 0, 0, 0,-8,-8}
};
int savex = x, savey = y;
if (gonnadraw) {
for (int shots = 0; shots < 3; shots++) {
x = savex;
y = savey;
int lastfacing = 0;
while (
#ifdef TESLA_COILZ // FUNCTION COMPATIBILITY ERROR BELOW
::Distance
#endif // TESLA_COILZ
(x, y, x1, y1) > 8) {
/*
** Determine true (0..7) facing from current position to
** destination (actually the source coordinate of the zap).
*/
int facing = Dir_Facing(Desired_Facing8(x, y, x1, y1)); // FUNCTION TRANSFERRED OK.
/*
** If there's quite a bit of distance to go,
** we may vary the desired facing to give the
** bolt some randomness.
*/
if (
#ifdef TESLA_COILZ // FUNCTION COMPATIBILITY ERROR BELOW
::Distance
#endif // TESLA_COILZ
(x, y, x1, y1) > 40) {
switch (Sim_Random_Pick(1, 3 + ((shots==0) ? 3 : 0))) {
case 1:
facing++;
break;
case 2:
facing--;
break;
default:
break;
}
facing &= 7;
}
/*
** Now that we have the direction of the bolt,
** draw it and move the x & y coords in the right
** direction for the next piece.
*/
// Electric zap coordinates are always tactical, so don't use the partial window if passed - SKY
x += _xadd[facing][lastfacing];
y += _yadd[facing][lastfacing];
//if (remap != NULL) {
// CC_Draw_Shape(this, "LITNING", LightningShapes, _shape[facing]+(shots ? 4 : 0), x, y, (window != WINDOW_PARTIAL) ? window : WINDOW_TACTICAL, SHAPE_FADING|SHAPE_CENTER|SHAPE_WIN_REL, remap);
//} else {
// CC_Draw_Shape(this, "LITNING", LightningShapes, _shape[facing]+(shots ? 4 : 0), x, y, (window != WINDOW_PARTIAL) ? window : WINDOW_TACTICAL, SHAPE_CENTER|SHAPE_WIN_REL);
//}
DLL_Draw_Intercept(_shape[facing] + (shots ? 4 : 0), x, y, 24, 24, SHAPE_CENTER | SHAPE_WIN_REL, this, "LITNING", -1, 256);
lastfacing = facing;
}
}
}
return (gonnadraw);
}
Here is my Draw_Electric_Zap, see how using the code tag makes it easy to read.
I used a local static function for a long time here which was a copy from RA.
Later I refactored it to use global Distance function.
/*
** Draw electric zap
*/
if ((ElectricZapDelay >= 0) && ElectricZapTarget) {
Draw_Electric_Zap(ElectricZapTarget, ElectricZapWhich, window);
}
I refactored alot of code to fit my liking that is why you see Random::Pick instead of Sim_Random_Pick and DLLExportClass::Draw_Shape instead of DLL_Draw_Intercept. Just use the functions that you have in those places.
Edit: My function was never intended as a copy-paste solution, but rather as an example. And to show how useful it is to format your posts correctly. Also the IsCharging status change is missing in my function because it is done in a different place.
"enum DirType __cdecl Desired_FacingTSLA8(int,int,int,int)" (?Desired_FacingTSLA8@@YA?AW4DirType@@HHHH@Z) already defined in AADATA.obj
I'm also still looking into doing code tags, is there a link or video that shows how to do it? That is a really nice feature and would like to learn how to use it. Until then would creating a steam guide with screen shots that show everything that has been transferred over so far help?
TD doesn't have any Distance function that accepts 4 parameters so idk why you are having problems with it. Anyways I already talked about it in post #7, I'll update the post to make it more clean because I think local function means something else in C++.
Not sure what you problem with the code tag is, you never used format tags in forums? It is like html or xml. Just click on the help button left to the smiley button which is left to the post button.
[code]My formatted source code[/code]
TY for all your help in getting it working, I'll def add you to the credits!