Ejemplo n.º 1
0
void
peek_at_some_memory(const char *who, const char *msg)
{
    int obj_id, ref_count;
    kern_return_t kr;
   
    kr = get_object_id(page_shared, &obj_id, &ref_count);
    printf("%-12s%-8s%-10x%-12x%-10d%s\n",
           who, "SHARED", FIRST_UINT32(page_shared), obj_id, ref_count, msg);
   
    kr = get_object_id(page_cow, &obj_id, &ref_count);
    printf("%-12s%-8s%-10x%-12x%-10d%s\n",
           who, "COW", FIRST_UINT32(page_cow), obj_id, ref_count, msg);
}
Ejemplo n.º 2
0
t_abstract_dialog::~t_abstract_dialog() {
	log_file->write_header("t_abstract_dialog::~t_abstract_dialog", LOG_NORMAL, LOG_DEBUG);
	log_file->write_raw("Destroy dialog, id=");
	log_file->write_raw(get_object_id());
	log_file->write_endl();
	log_file->write_footer();
}
u16 game_state_accumulator::get_object_id(u16 item_object_id)
{
	CObject	*tmp_object = Level().Objects.net_Find(item_object_id);
	if (!tmp_object )
		return 0;

	return get_object_id(tmp_object);
}
Ejemplo n.º 4
0
CORBA::Object_ptr TIDorb::core::poa::CurrentImpl::get_reference()
  throw (PortableServer::Current::NoContext)
{
  PortableServer::POA_var poa = get_POA();
  PortableServer::ObjectId_var oid = get_object_id();
  
  return poa->create_reference_with_id(oid, (const ::CORBA::RepositoryId) "IDL:omg.org/CORBA/Object:1.0");
}
void game_state_accumulator::OnBullet_Hit(CObject const * hitter, CObject const * victim, CObject const * weapon, u16 const bone)
{
	if (!hitter || !victim || !weapon)
		return;

	float bullet_fly_dist  = 0.0f;
	
	bullet_fly_dist = hitter->Position().distance_to(victim->Position());
	
	m_hits.add_hit(hitter->cName(), victim->cName(), get_object_id(weapon), bone, bullet_fly_dist);
	for (accumulative_values_collection_t::iterator i = m_accumulative_values.begin(),
		ie = m_accumulative_values.end(); i != ie; ++i)
	{
		i->second->OnBullet_Hit(hitter, victim, weapon, bone);
	}
}
u16	game_state_accumulator::get_armor_of_player			(game_PlayerState* player)
{
	if (!player)
		return 0;

	CActorMP const* tmp_actor			= smart_cast<CActorMP const*>(
		Level().Objects.net_Find(player->GameID));

	if (!tmp_actor)
		return 0;

	CCustomOutfit* tmp_outfit = tmp_actor->GetOutfit();
	if (!tmp_outfit)
		return 0;
		
	return get_object_id(tmp_outfit);
}
u16	game_state_accumulator::get_active_weapon_of_player	(game_PlayerState* player)
{
	if (!player)
		return 0;

	CActorMP const* tmp_actor			= smart_cast<CActorMP const*>(
		Level().Objects.net_Find(player->GameID));

	if (!tmp_actor)
		return 0;

	u16 tmp_active_slot					= tmp_actor->inventory().GetActiveSlot();
	CInventoryItem const * tmp_inv_item	= tmp_active_slot != NO_ACTIVE_SLOT ?
		tmp_actor->inventory().ItemFromSlot(tmp_active_slot) : NULL;

	if (!tmp_inv_item)
		return 0;

	return get_object_id(tmp_inv_item->object_id());
}
void game_state_accumulator::OnPlayerKilled(u16 killer_id, u16 target_id, u16 weapon_id, std::pair<KILL_TYPE, SPECIAL_KILL_TYPE> kill_type)
{
	if (!is_enemies(killer_id, target_id))
		return;

	CObject* killer_obj = Level().Objects.net_Find(killer_id);
	CObject* victim_obj = Level().Objects.net_Find(target_id);
	if (killer_obj && victim_obj)
	{
		m_kills.add_kill(
			killer_obj->cName(),
			victim_obj->cName(),
			get_object_id(weapon_id),
			kill_type.first, kill_type.second);
	}

	for (accumulative_values_collection_t::iterator i = m_accumulative_values.begin(),
		ie = m_accumulative_values.end(); i != ie; ++i)
	{
		i->second->OnPlayerKilled(killer_id, target_id, weapon_id, kill_type);
	}
}
Ejemplo n.º 9
0
t_abstract_dialog::t_abstract_dialog(t_phone_user *pu) :
	t_id_object()
{
	assert(pu);
	phone_user = pu;
	call_id_owner = false;
	
	local_seqnr = 0;
	remote_seqnr = 0;
	remote_seqnr_set = false;
	
	local_resp_nr = 0;
	remote_resp_nr = 0;
	
	remote_ip_port.clear();
	
	log_file->write_header("t_abstract_dialog::t_abstract_dialog", LOG_NORMAL, LOG_DEBUG);
	log_file->write_raw("Created dialog, id=");
	log_file->write_raw(get_object_id());
	log_file->write_endl();
	log_file->write_footer();
}
Ejemplo n.º 10
0
void do_robot_window()
{
	int	i;
	fix	DeltaTime, Temp;
	int	first_object_index;

	if ( MainWindow == NULL ) return;

	first_object_index = Cur_object_index;
	while (!is_legal_type_for_this_window(Cur_object_index)) {
		LocalObjectSelectNextinMine();
		if (first_object_index == Cur_object_index) {
			break;
		}
	}

	//------------------------------------------------------------
	// Call the ui code..
	//------------------------------------------------------------
	ui_button_any_drawn = 0;
	ui_window_do_gadgets(MainWindow);

	//------------------------------------------------------------
	// If we change objects, we need to reset the ui code for all
	// of the radio buttons that control the ai mode.  Also makes
	// the current AI mode button be flagged as pressed down.
	//------------------------------------------------------------
	if (old_object != Cur_object_index )	{
		for (	i=0; i < NUM_BOXES; i++ )	{
			InitialMode[i]->flag = 0;		// Tells ui that this button isn't checked
			InitialMode[i]->status = 1;	// Tells ui to redraw button
		}
		if ( Cur_object_index > -1 ) {
			int	behavior = Objects[Cur_object_index].ctype.ai_info.behavior;
			if ( !((behavior >= MIN_BEHAVIOR) && (behavior <= MAX_BEHAVIOR))) {
				Objects[Cur_object_index].ctype.ai_info.behavior = AIB_NORMAL;
				behavior = AIB_NORMAL;
			}
			InitialMode[behavior - MIN_BEHAVIOR]->flag = 1;	// Mark this button as checked
		}
	}

	//------------------------------------------------------------
	// If any of the radio buttons that control the mode are set, then
	// update the cooresponding AI state.
	//------------------------------------------------------------
	for (	i=0; i < NUM_BOXES; i++ )	{
		if ( InitialMode[i]->flag == 1 )	
			if (Objects[Cur_object_index].ctype.ai_info.behavior != MIN_BEHAVIOR+i) {
				Objects[Cur_object_index].ctype.ai_info.behavior = MIN_BEHAVIOR+i;		// Set the ai_state to the cooresponding radio button
				call_init_ai_object(&Objects[Cur_object_index], MIN_BEHAVIOR+i);
			}
	}

	//------------------------------------------------------------
	// A simple frame time counter for spinning the objects...
	//------------------------------------------------------------
	Temp = timer_get_fixed_seconds();
	DeltaTime = Temp - Time;
	Time = Temp;

	//------------------------------------------------------------
	// Redraw the object in the little 64x64 box
	//------------------------------------------------------------
	if (Cur_object_index > -1 )	{
		int id;
		gr_set_current_canvas( RobotViewBox->canvas );
		id = get_object_id(&Objects[Cur_object_index]);
		if ( id > -1 )	
			draw_robot_picture(id, &angles, -1 );
		else
			gr_clear_canvas( CGREY );
		angles.h += fixmul(0x1000, DeltaTime );
	} else {
		// no object, so just blank out
		gr_set_current_canvas( RobotViewBox->canvas );
		gr_clear_canvas( CGREY );

//		LocalObjectSelectNextInMine();
	}

	//------------------------------------------------------------
	// Redraw the contained object in the other little box
	//------------------------------------------------------------
	if ((Cur_object_index > -1 ) && (Cur_goody_count > 0))	{
		int id;

		gr_set_current_canvas( ContainsViewBox->canvas );
		id = Cur_goody_id;
		if ( id > -1 )	 {
                        int ol_type=0;
			if (Cur_goody_type == OBJ_ROBOT)
				ol_type = OL_ROBOT;
			else if (Cur_goody_type == OBJ_POWERUP)
				ol_type = OL_POWERUP;
			else
				Int3();	//	Error?  Unknown goody type!

			draw_robot_picture(id, &goody_angles, ol_type );
		} else
			gr_clear_canvas( CGREY );
		goody_angles.h += fixmul(0x1000, DeltaTime );
	} else {
		// no object, so just blank out
		gr_set_current_canvas( ContainsViewBox->canvas );
		gr_clear_canvas( CGREY );

//		LocalObjectSelectNextInMine();
	}

	//------------------------------------------------------------
	// If anything changes in the ui system, redraw all the text that
	// identifies this robot.
	//------------------------------------------------------------

	if (ui_button_any_drawn || (old_object != Cur_object_index) )	{
		int	i;
		char	type_text[STRING_LENGTH+1],id_text[STRING_LENGTH+1];

		if (Cur_object_index != -1) {
			Cur_goody_type = Objects[Cur_object_index].contains_type;
			Cur_goody_id = Objects[Cur_object_index].contains_id;
			if (Objects[Cur_object_index].contains_count < 0)
				Objects[Cur_object_index].contains_count = 0;
			Cur_goody_count = Objects[Cur_object_index].contains_count;
		}

		ui_wprintf_at( MainWindow, GOODY_X, GOODY_Y,    " Type:");
		ui_wprintf_at( MainWindow, GOODY_X, GOODY_Y+24, "   ID:");
		ui_wprintf_at( MainWindow, GOODY_X, GOODY_Y+48, "Count:");

		for (i=0; i<STRING_LENGTH; i++)
			id_text[i] = ' ';
		id_text[i] = 0;

		switch (Cur_goody_type) {
			case OBJ_ROBOT:
				strcpy(type_text, "Robot  ");
				strncpy(id_text, Robot_names[Cur_goody_id], strlen(Robot_names[Cur_goody_id]));
				break;
			case OBJ_POWERUP:
				strcpy(type_text, "Powerup");
				strncpy(id_text, Powerup_names[Cur_goody_id], strlen(Powerup_names[Cur_goody_id]));
				break;
			default:
				editor_status("Illegal contained object type (%i), changing to powerup.", Cur_goody_type);
				Cur_goody_type = OBJ_POWERUP;
				Cur_goody_id = 0;
				strcpy(type_text, "Powerup");
				strncpy(id_text, Powerup_names[Cur_goody_id], strlen(Powerup_names[Cur_goody_id]));
				break;
		}

		ui_wprintf_at( MainWindow, GOODY_X+108, GOODY_Y, type_text);
		ui_wprintf_at( MainWindow, GOODY_X+108, GOODY_Y+24, id_text);
		ui_wprintf_at( MainWindow, GOODY_X+108, GOODY_Y+48, "%i", Cur_goody_count);

		if ( Cur_object_index > -1 )	{
			int	id = Objects[Cur_object_index].id;
			char	id_text[12];
			int	i;

			for (i=0; i<STRING_LENGTH; i++)
				id_text[i] = ' ';
			id_text[i] = 0;

			strncpy(id_text, Robot_names[id], strlen(Robot_names[id]));

			ui_wprintf_at( MainWindow, 12,  6, "Robot: %3d ", Cur_object_index );
			ui_wprintf_at( MainWindow, 12, 22, "   Id: %3d", id);
			ui_wprintf_at( MainWindow, 12, 38, " Name: %8s", id_text);

		}	else {
			ui_wprintf_at( MainWindow, 12,  6, "Robot: none" );
			ui_wprintf_at( MainWindow, 12, 22, " Type: ?  "  );
			ui_wprintf_at( MainWindow, 12, 38, " Name: ________" );
		}
		Update_flags |= UF_WORLD_CHANGED;
	}

	if ( QuitButton->pressed || (last_keypress==KEY_ESC))	{
		robot_close_window();
		return;
	}		

	old_object = Cur_object_index;
}
Ejemplo n.º 11
0
zEventBase::~zEventBase()
{
	// remove events from dispatcher
	zEventDispatcher *ed = zEventDispatcher::inst();
	ed->removeProcessor(get_object_id());	
}