コード例 #1
0
//-------------------------------------------------------------------------
// Called when user presses "Prev Type" button.  This only works for polygon
// objects and it just selects the prev polygon model for the current object.
//-------------------------------------------------------------------------
static int RobotPrevType()
{
	if (Cur_object_index != object_none )	{
		const auto &&obj = vobjptr(Cur_object_index);
		if (obj->type == OBJ_ROBOT)
		{
			if (obj->id == 0 ) 
				obj->id = N_robot_types-1;
			else
				obj->id--;

			//Set polygon-object-specific data
			obj->rtype.pobj_info.model_num = Robot_info[get_robot_id(obj)].model_num;
			obj->rtype.pobj_info.subobj_flags = 0;
			//set Physics info
			obj->mtype.phys_info.flags |= (PF_LEVELLING);
			obj->shields = Robot_info[get_robot_id(obj)].strength;
			call_init_ai_object(obj, ai_behavior::AIB_NORMAL);

			Cur_object_id = get_robot_id(obj);
		}
	}
	Update_flags |= UF_WORLD_CHANGED;
	return 1;
}
コード例 #2
0
ファイル: dumpmine.cpp プロジェクト: btb/dxx-rebirth
// ----------------------------------------------------------------------------
static const char *object_ids(const object_base &objp)
{
	switch (objp.type)
	{
		case OBJ_ROBOT:
			return Robot_names[get_robot_id(objp)].data();
		case OBJ_POWERUP:
			return Powerup_names[get_powerup_id(objp)].data();
		default:
			return nullptr;
	}
}