Example #1
0
//
// First function called upon actor spawn.
//
void ASiegeNativeActor::InitExecution()
{
	guard(ASiegeNativeActor::InitExecution);

	AActor::InitExecution(); //Validate that actor has been properly spawned in a level
	
	if ( Level->bBegunPlay )
	{
		debugf( NAME_SiegeNative, TEXT("[ERROR] This actor will only apply the hook if spawned via ServerActors!!!"));
		return;
	}
	
	if ( Level->Game && ((Level->NetMode == NM_DedicatedServer) || (Level->NetMode == NM_ListenServer)) )
	{
		RegisterNames();

		debugf( NAME_SiegeNative, TEXT("Level validated, searching for Siege gametype...") );
		for( SiegeClass=Level->Game->GetClass() ; SiegeClass; SiegeClass=SiegeClass->GetSuperClass() ) //Level.Game.IsA('SiegeGI')
			if( appStricmp(SiegeClass->GetName(), TEXT("SiegeGI")) == 0 )
				break;
		if ( SiegeClass )
		{
			debugf( NAME_SiegeNative, TEXT("Siege gametype found: %s, prefetching and validating assets..."), Level->Game->GetClass()->GetFullName() );

			//Let main SiegeIV hold a reference to our class to prevent elimination via garbage collector
			{for( TFieldIterator<UObjectProperty> It(SiegeClass); It && It->GetOwnerClass()==SiegeClass; ++It )
				if ( appStricmp( It->GetName(), TEXT("GCBind")) == 0 )
				{
					//Register in both gameinfo and defaults (SiegeGI.GCBind = class'SiegeNativeActor';)
					*((UObject**) (((DWORD)Level->Game) + It->Offset)) = GetClass();
					*((UObject**) (((DWORD)Level->Game->GetClass()->GetDefaultObject()) + It->Offset)) = GetClass();
					break;
				}
			}
			
			//Get some important offsets
			ActorChannelsOffset = UNetConnection::StaticClass()->GetPropertiesSize() - 16068; //Ends up being 20 in v440/v451
			SGI_Cores_Offset = FindStrictScriptVariable( SiegeClass, TEXT("Cores"))->Offset;


			//Setup individual classes
			UPackage* SiegePackage = (UPackage*) SiegeClass->GetOuter();
			Setup_sgPRI				( SiegePackage, GetLevel());
			Setup_sgCategoryInfo	( SiegePackage, GetLevel());
			Setup_sgBuilding		( SiegePackage, GetLevel());
			Setup_sgProtector		( SiegePackage, GetLevel());
			Setup_sgBaseBuildRule	( SiegePackage, GetLevel());
			Setup_sgBuildRuleCount	( SiegePackage, GetLevel());
			Setup_sgPlayerData		( SiegePackage, GetLevel());
			Setup_sgTranslocator	( SiegePackage, GetLevel());
		}
	}

	unguardobj;
}
Example #2
0
std::string
RiscOperators::commentForVariable(RegisterDescriptor reg, const std::string &accessMode) const {
    const RegisterDictionary *regs = currentState()->registerState()->get_register_dictionary();
    std::string varComment = RegisterNames(regs)(reg) + " first " + accessMode;
    if (pathInsnIndex_ == (size_t)(-1) && currentInstruction() == NULL) {
        varComment += " by initialization";
    } else {
        if (pathInsnIndex_ != (size_t)(-1))
            varComment += " at path position #" + StringUtility::numberToString(pathInsnIndex_);
        if (SgAsmInstruction *insn = currentInstruction())
            varComment += " by " + unparseInstructionWithAddress(insn);
    }
    return varComment;
}