


Code: Select all
//baneling
if (unit->unitId==infested_terran && unit->orderSignal!=1 && unit->status & 0x1){
// orderSignal is 1 when is self exploding. The last condition prevents some bug if baneling is killed in its born animation .
if(unit->rankIncrease!=30 && unit->mainOrderId!=Burrow && unit->healthPoints==0)){
// rankIncrease is just used as a control mark to prevent multiple explosions on death
unit->mainOrderId=SapLocation;
unit->orderTargetX=unit->currentXPos;
unit->orderTargetY=unit->currentYPos;
unit->current_speed1=0;
unit->current_speed2=0;
unit->rankIncrease=30;
}
}
Code: Select all
if (unit->healthPoints>0 && unit->mainOrderId==Die)
unit->healthPoints=0;
Code: Select all
InfestedTerranSpecialState1:
attackwith 1
sigorder 1
goto InfestedTerranLocal00
Code: Select all
struct SightStruct {
DWORD tileSightWidth;
DWORD tileSightHeight;
DWORD unknown1;
DWORD unknown2;
DWORD unknown3;
DWORD unknown4;
DWORD unknown5;
};
#define CREATE_SIGHT_STRUCT(range) { (range) * 2 + 3, (range) * 2 + 3, 3, 3, 0, 0, 0 }
const DWORD InitializeSightValues_Func = 0x0042AD60;
void UseCustomSightValues(SightStruct* sarr, DWORD arraySize) {
DWORD* const SightStructRef = (DWORD*)0x00480709;
DWORD OldProt = 0;
VirtualProtect((LPVOID)SightStructRef, 4, PAGE_EXECUTE_READWRITE, &OldProt);
*SightStructRef = (DWORD)sarr;
VirtualProtect((LPVOID)SightStructRef, 4, OldProt, &OldProt);
__asm {
PUSHAD
MOVZX eax, WORD PTR DS:[0x0057F1D4]
PUSH eax
MOV eax, arraySize
MOV ecx, sarr
CALL DWORD ptr [InitializeSightValues_Func]
POPAD
}
}
Code: Select all
SightStruct sightValues[] = {
CREATE_SIGHT_STRUCT(0),
CREATE_SIGHT_STRUCT(1),
CREATE_SIGHT_STRUCT(2),
CREATE_SIGHT_STRUCT(3),
CREATE_SIGHT_STRUCT(4),
CREATE_SIGHT_STRUCT(5),
CREATE_SIGHT_STRUCT(6),
CREATE_SIGHT_STRUCT(7),
CREATE_SIGHT_STRUCT(8),
CREATE_SIGHT_STRUCT(9),
CREATE_SIGHT_STRUCT(10),
CREATE_SIGHT_STRUCT(11),
CREATE_SIGHT_STRUCT(12),
CREATE_SIGHT_STRUCT(13),
CREATE_SIGHT_STRUCT(14),
CREATE_SIGHT_STRUCT(15),
CREATE_SIGHT_STRUCT(16),
CREATE_SIGHT_STRUCT(17),
CREATE_SIGHT_STRUCT(18),
CREATE_SIGHT_STRUCT(19),
CREATE_SIGHT_STRUCT(20),
CREATE_SIGHT_STRUCT(21),
CREATE_SIGHT_STRUCT(22),
CREATE_SIGHT_STRUCT(23),
CREATE_SIGHT_STRUCT(24)
};
Code: Select all
UseCustomSightValues(sightValues, 25);
Code: Select all
#include "asm.cpp"
//global declarations
SightStruct sightValues[] ={
?
};
bool nextFrame(){
/*...*/
return true;
}
bool gameOn(){
UseCustomSightValues(sightValues, 25);
/*...*/
return true;
}
bool gameEnd(){
/*...*/
return true;
}
Users browsing this forum: No registered users and 1 guest