示例#1
0
LRESULT CRenderingDlg::OnRenderDone(WPARAM wParam, LPARAM lParam)
{
	m_View->SendMessage(UWM_RENDERDONE, wParam, lParam);	// forward message to view
	if (FinishJob())	// if job finished OK
		StartNextJob();	// start next one
	return(0);
}
示例#2
0
void ai_agent::AddAgent() {

	
	tempBrain = new sprite_memory;

	brainMemory.push_back(tempBrain);
	EntMemory = brainMemory.at(brainMemory.size()-1);
	this->unitNum++;
	//this->Entities = ptrWorld->Units;
	//Ent = Entities.at(Entities.size()-1);

	//Ent ptr is now set in ai_agent::Process() before addagent is called
	Ent->ptrBrain = EntMemory;

	//State Inits
	SetMMState(states::AI_MM_IDLE);
	tempBrain->jobData = new jobInfo();
	tempBrain->jobData->nextJob = NewJob(tempBrain->jobData,states::AI_JOB_STATE_BIRTH);
	SetPri1State(states::AI_PRI1_STATE_SELF);

	//unused?
	tempBrain->collision = false;
	
	//tempBrain->hasNav = false;

	//Get some nav memory, GetNav returns recycled navdata or new if all else used up
	
	tempBrain->navData = Nav->GetNav();
	
	
	tempBrain->safe = true;
	tempBrain->dangerlevel = 0;
	tempBrain->defaultJob = this->stateToDefaultJob_Pri1.at(tempBrain->state_pri1);

	
	StartNextJob();
	

	tempBrain->hasTargetToGuard = false;

	//this->ptrWorld->lock_newunit = false;
	//this->ptrWorld->ask_newai = false;
	Ent->fullyCreated = true;

	//not used
	Ent->fullyCreatedSafety = 44;
	

	//this->SetTarget(this->ptrWorld->ptrPhysics->GetClosestSpriteID((((phys_obj* )Ent)),true));
	//this->SetTarget(this->getRandEnemyID());
	
	

	//int dsdfsd = this->Entities.size();
}
示例#3
0
void ai_agent::CheckCollision() {
	EntMemory->phys_state = Ent->getState();

	if (EntMemory->phys_state == states::PHYS_STATE_COLLIDE_MAP) {

		//Stop();
		
		/*EntMemory->jobData->jobVars.SleepUntil = Ent->ptrWorld->runTime + 30;
		EntMemory->jobData->ptrMM = &ai_agent::Wait;
		EntMemory->jobData->nextJob = NewJob(EntMemory->jobData);
		EntMemory->jobData->nextJob->ptrMM = &ai_agent::Listen;*/

		//EntMemory->hasTarget = false;

		//WHAT?! FIX MEEEEEEEEEEEEEEE
		if (EntMemory->state_job == states::AI_JOB_STATE_WAYPOINTS) {
			if (EntMemory->hasTarget()) {
				//threada::startPathfind(Ent_Target->position.x,Ent_Target->position.y,Nav);
				/*if (LOSCheck(Ent->position.x/ts,Ent->position.y/ts,X/ts,Y/ts)) {
					bool weee = true;
					EntMemory->jobData->nextJob = NewJob(EntMemory->jobData,states::AI_JOB_STATE_WAYPOINTS);
					StartNextJob();
					//dont pathfind, move to target
				}*/
				Nav->SetupPathfind(Ent_Target->position.x,Ent_Target->position.y);
				//EntMemory->jobData->nextJob = NewJob(EntMemory->jobData,states::AI_JOB_STATE_PATHFIND);
				StartNextJob();
			}
		} 

	} else if (EntMemory->phys_state == states::PHYS_STATE_COLLIDE_UNIT) {
		//Stop();

		//EntMemory->jobData->nextJob = NewJob(EntMemory->jobData,states::AI_JOB_STATE_EVADE);
		//StartNewJob();
	}
}
示例#4
0
LRESULT CRenderingDlg::OnStartNextJob(WPARAM wParam, LPARAM lParam)
{
	StartNextJob();
	return(0);
}