本文整理汇总了C++中OBJ_INDEX函数的典型用法代码示例。如果您正苦于以下问题:C++ OBJ_INDEX函数的具体用法?C++ OBJ_INDEX怎么用?C++ OBJ_INDEX使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OBJ_INDEX函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unmark_all
void ship_select::OnOK()
{
object *ptr;
unmark_all();
update_status();
ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list))
{
if (ptr->flags & OF_TEMP_MARKED)
mark_object(OBJ_INDEX(ptr));
ptr = GET_NEXT(ptr);
}
if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) {
Assert(Briefing_dialog);
Briefing_dialog->icon_select(Objects[cur_object_index].instance);
} else {
if (Briefing_dialog)
Briefing_dialog->icon_select(-1);
}
filter_ships = m_filter_ships;
filter_starts = m_filter_starts;
filter_waypoints = m_filter_waypoints;
filter_friendly = m_filter_friendly;
filter_hostile = m_filter_hostile;
filter_neutral = m_filter_neutral;
filter_unknown = m_filter_unknown;
CDialog::OnOK();
}
示例2: isValid
bool cockpit_display_h::isValid() {
if (obj_num < 0 || obj_num > MAX_OBJECTS)
{
return false;
}
if (m_objp == NULL || OBJ_INDEX(m_objp) != obj_num)
{
return false;
}
// Only player has cockpit displays
if (m_objp != Player_obj)
{
return false;
}
if (m_display_num == INVALID_ID)
{
return false;
}
if (m_display_num >= Player_displays.size())
{
return false;
}
return true;
}
示例3: Int3
particle *particle_create( vec3d *pos, vec3d *vel, float lifetime, float rad, int type, int optional_data, float tracer_length, object *objp, bool reverse )
{
particle_info pinfo;
if ( (type < 0) || (type >= NUM_PARTICLE_TYPES) ) {
Int3();
return NULL;
}
// setup old data
pinfo.pos = *pos;
pinfo.vel = *vel;
pinfo.lifetime = lifetime;
pinfo.rad = rad;
pinfo.type = type;
pinfo.optional_data = optional_data;
// setup new data
pinfo.tracer_length = -1.0f;
if(objp == NULL)
{
pinfo.attached_objnum = -1;
pinfo.attached_sig = -1;
}
else
{
pinfo.attached_objnum = OBJ_INDEX(objp);
pinfo.attached_sig = objp->signature;
}
pinfo.reverse = reverse? 1 : 0;
// lower level function
return particle_create(&pinfo);
}
示例4: unmark_all
void ship_select::OnOK()
{
int i;
object *ptr;
unmark_all();
update_status();
ptr = GET_FIRST(&obj_used_list);
while (ptr != END_OF_LIST(&obj_used_list))
{
if (ptr->flags & OF_TEMP_MARKED)
mark_object(OBJ_INDEX(ptr));
ptr = GET_NEXT(ptr);
}
if (query_valid_object() && (Marked == 1) && (Objects[cur_object_index].type == OBJ_POINT)) {
Assert(Briefing_dialog);
Briefing_dialog->icon_select(Objects[cur_object_index].instance);
} else {
if (Briefing_dialog)
Briefing_dialog->icon_select(-1);
}
filter_ships = m_filter_ships;
filter_starts = m_filter_starts;
filter_waypoints = m_filter_waypoints;
for (i = 0; i < MAX_IFFS; i++)
filter_iff[i] = m_filter_iff[i];
CDialog::OnOK();
}
示例5: multi_respawn_as_observer
// respawn myself as an observer
void multi_respawn_as_observer()
{
// configure the hud to be in "observer" mode
hud_config_as_observer(Player_ship,Player_ai);
// blow away my old player object
Player_obj->flags |= OF_SHOULD_BE_DEAD;
obj_delete(OBJ_INDEX(Player_obj));
// create a new shiny observer object for me
multi_obs_create_observer(Net_player);
// set my object to be the observer object
Player_obj = &Objects[Net_player->player->objnum];
Player_ship = &Hud_obs_ship;
Player_ai = &Hud_obs_ai;
// set some flags for myself
Net_player->flags |= NETINFO_FLAG_OBSERVER;
Net_player->flags |= NETINFO_FLAG_OBS_PLAYER;
Net_player->flags &= ~(NETINFO_FLAG_LIMBO);
// clear my auto-match speed flag
Net_player->player->flags &= ~(PLAYER_FLAGS_AUTO_MATCH_SPEED | PLAYER_FLAGS_MATCH_TARGET);
// reset the control info structure
memset(&Player->ci,0,sizeof(control_info));
}
示例6: convert_arg
void convert_arg(lua_State* L, luacpp::LuaValueList& out, object* objp)
{
LuaValue val;
ade_set_object_with_breed(L, OBJ_INDEX(objp));
convert::popValue(L, val);
out.push_back(val);
}
示例7: vm_vec_sub
void initial_status::undock(object *objp1, object *objp2)
{
vec3d v;
int ship_num, other_ship_num;
if (objp1 == NULL || objp2 == NULL)
return;
vm_vec_sub(&v, &objp2->pos, &objp1->pos);
vm_vec_normalize(&v);
ship_num = get_ship_from_obj(OBJ_INDEX(objp1));
other_ship_num = get_ship_from_obj(OBJ_INDEX(objp2));
if (ship_class_compare(Ships[ship_num].ship_info_index, Ships[other_ship_num].ship_info_index) <= 0)
vm_vec_scale_add2(&objp2->pos, &v, objp2->radius * 2.0f);
else
vm_vec_scale_add2(&objp1->pos, &v, objp1->radius * -2.0f);
ai_do_objects_undocked_stuff(objp1, objp2);
// check to see if one of these ships has an arrival cue of false. If so, then
// reset it back to default value of true. be sure to correctly update before
// and after setting data.
// Goober5000 - but don't reset it if it's part of a wing!
Ship_editor_dialog.update_data(1);
if ( Ships[ship_num].arrival_cue == Locked_sexp_false && Ships[ship_num].wingnum < 0 ) {
Ships[ship_num].arrival_cue = Locked_sexp_true;
} else if ( Ships[other_ship_num].arrival_cue == Locked_sexp_false && Ships[other_ship_num].wingnum < 0 ) {
Ships[other_ship_num].arrival_cue = Locked_sexp_true;
}
// if this ship is no longer docked, ensure its dock leader flag is clear
if (!object_is_docked(&Objects[Ships[ship_num].objnum]))
Ships[ship_num].flags.remove(Ship::Ship_Flags::Dock_leader);
// same for the other ship
if (!object_is_docked(&Objects[Ships[other_ship_num].objnum]))
Ships[other_ship_num].flags.remove(Ship::Ship_Flags::Dock_leader);
Ship_editor_dialog.initialize_data(1);
}
示例8: OnSelchangeShipList
void ship_select::OnSelchangeShipList()
{
int i, j, k, count;
if (activity)
return;
activity = ACTIVITY_SHIP;
for (i=0; i<wlist_size; i++) {
count = 0;
for (j=0; j<Wings[wing_index[i]].wave_count; j++)
for (k=0; k<list_size; k++)
if (OBJ_INDEX(obj_index[k]) == wing_objects[wing_index[i]][j]) {
if (m_ship_list.GetSel(k))
count++;
break;
}
if (count == Wings[wing_index[i]].wave_count)
wing_sel_last[i] = 1;
else
wing_sel_last[i] = 0;
m_wing_list.SetSel(i, wing_sel_last[i] ? TRUE : FALSE);
}
for (i=wlist_size; i<wplist_size; i++) {
waypoint_list *wp_list = find_waypoint_list_at_index(wing_index[i]);
Assert(wp_list != NULL);
SCP_list<waypoint>::iterator jj;
count = 0;
for (j = 0, jj = wp_list->get_waypoints().begin(); jj != wp_list->get_waypoints().end(); ++j, ++jj) {
for (k=0; k<list_size; k++) {
if ((obj_index[k]->type == OBJ_WAYPOINT) && (obj_index[k]->instance == calc_waypoint_instance(wing_index[i], j))) {
if (m_ship_list.GetSel(k))
count++;
break;
}
}
}
if ((uint) count == wp_list->get_waypoints().size())
wing_sel_last[i] = 1;
else
wing_sel_last[i] = 0;
m_wing_list.SetSel(i, wing_sel_last[i] ? TRUE : FALSE);
}
activity = 0;
}
示例9: observer_delete
void observer_delete(object *obj)
{
int num;
num = obj->instance;
Assert( Observers[num].objnum == OBJ_INDEX(obj));
Observers[num].objnum = -1;
Observers[num].target_objnum = -1;
Observers[num].flags = 0; // mark it as being free
}
示例10: dock_evaluate_tree
void dock_evaluate_tree(object *objp, dock_function_info *infop, void (*function)(object *, dock_function_info *), ubyte *visited_bitstring)
{
// make sure we haven't visited this object already
if (get_bit(visited_bitstring, OBJ_INDEX(objp)))
return;
// mark as visited
set_bit(visited_bitstring, OBJ_INDEX(objp));
// call the function for this object, and return if instructed
function(objp, infop);
if (infop->early_return_condition) return;
// iterate through all docked objects
for (dock_instance *ptr = objp->dock_list; ptr != NULL; ptr = ptr->next)
{
// start another tree with the docked object as the root, and return if instructed
dock_evaluate_tree(ptr->docked_objp, infop, function, visited_bitstring);
if (infop->early_return_condition) return;
}
}
示例11: SignalInvolvesWidget
/*
* Called with a signal message id that is reporting a property value or metadata change. Finds out
* which widget is involved and if the signal is reporting a value change or a metadata change.
*/
static void* SignalInvolvesWidget(uint32_t identifier, uint8_t* isProperty)
{
const char* member;
AJ_MemberType mt = AJ_GetMemberType(identifier, &member, NULL);
if (mt == AJ_SIGNAL_MEMBER) {
*isProperty = (member[0] == 'V');
return objectList[OBJ_INDEX(identifier)].context;
} else {
return NULL;
}
}
示例12: update_danger_weapon
/**
* If weapon_obj is likely to hit ship_obj sooner than current aip->danger_weapon_objnum,
* then update danger_weapon_objnum.
*/
void update_danger_weapon(object *pship_obj, object *weapon_obj)
{
ai_info *aip;
Assert(pship_obj->type == OBJ_SHIP);
aip = &Ai_info[Ships[pship_obj->instance].ai_index];
if (aip->danger_weapon_objnum == -1) {
aip->danger_weapon_objnum = OBJ_INDEX(weapon_obj);
aip->danger_weapon_signature = weapon_obj->signature;
} else if (aip->danger_weapon_signature == Objects[aip->danger_weapon_objnum].signature) {
float danger_old_time, danger_new_time;
danger_old_time = ai_endangered_time(pship_obj, &Objects[aip->danger_weapon_objnum]);
danger_new_time = ai_endangered_time(pship_obj, weapon_obj);
if (danger_new_time < danger_old_time) {
aip->danger_weapon_objnum = OBJ_INDEX(weapon_obj);
aip->danger_weapon_signature = weapon_obj->signature;
}
}
}
示例13: hud_escort_ship_hit
/**
* Called whenever a ship is hit to determine if that ship is in the escort list. If it
* is, then start timers to flash the name hull/shield icon for that ship.
*
* @param objp The object hit
* @param quadrant Shield quadrant on the object that was hit, alternatively -1 if no shield
*/
void hud_escort_ship_hit(object *objp, int quadrant)
{
// no ships on the escort list in multiplayer dogfight
if(MULTI_DOGFIGHT){
return;
}
for ( int i = 0; i < Num_escort_ships; i++ ) {
if ( Escort_ships[i].objnum == OBJ_INDEX(objp) ) {
hud_gauge_popup_start(HUD_ESCORT_VIEW);
Escort_ships[i].escort_hit_timer = timestamp(SHIELD_HIT_DURATION);
Escort_ships[i].escort_hit_next_flash = timestamp(SHIELD_FLASH_INTERVAL);
}
}
}
示例14: OnSelchangeShipList
void ship_select::OnSelchangeShipList()
{
int i, j, k, count;
if (activity)
return;
activity = ACTIVITY_SHIP;
for (i=0; i<wlist_size; i++) {
count = 0;
for (j=0; j<Wings[wing_index[i]].wave_count; j++)
for (k=0; k<list_size; k++)
if (OBJ_INDEX(obj_index[k]) == wing_objects[wing_index[i]][j]) {
if (m_ship_list.GetSel(k))
count++;
break;
}
if (count == Wings[wing_index[i]].wave_count)
wing_sel_last[i] = 1;
else
wing_sel_last[i] = 0;
m_wing_list.SetSel(i, wing_sel_last[i] ? TRUE : FALSE);
}
for (i=wlist_size; i<wplist_size; i++) {
count = 0;
for (j=0; j<Waypoint_lists[wing_index[i]].count; j++)
for (k=0; k<list_size; k++)
if ((obj_index[k]->type == OBJ_WAYPOINT) && (obj_index[k]->instance == wing_index[i] * 65536 + j)) {
if (m_ship_list.GetSel(k))
count++;
break;
}
if (count == Waypoint_lists[wing_index[i]].count)
wing_sel_last[i] = 1;
else
wing_sel_last[i] = 0;
m_wing_list.SetSel(i, wing_sel_last[i] ? TRUE : FALSE);
}
activity = 0;
}
示例15: cmeasure_maybe_alert_success
void cmeasure_maybe_alert_success(object *objp)
{
//Is this a countermeasure, and does it have a parent
if ( objp->type != OBJ_WEAPON || objp->parent < 0) {
return;
}
Assert(Weapon_info[Weapons[objp->instance].weapon_info_index].wi_flags[Weapon::Info_Flags::Cmeasure]);
if ( objp->parent == OBJ_INDEX(Player_obj) ) {
hud_start_text_flash(XSTR("Evaded", 1430), 800);
snd_play(gamesnd_get_game_sound(ship_get_sound(Player_obj, SND_MISSILE_EVADED_POPUP)));
} else if ( Objects[objp->parent].flags[Object::Object_Flags::Player_ship] ) {
send_countermeasure_success_packet( objp->parent );
}
}