All pastes #993360 Raw Edit

YSI_SMD.own

public cpp v1 · immutable
#993360 ·published 2008-04-22 16:08 UTC
rendered paste body
/*----------------------------------------------------------------------------*-					===========================					Y Sever Includes - SMD Core					===========================Description:	Loads a Standard Map Definition file into YSI.Legal:	Copyright (C) 2007 Alex "Y_Less" Cole	This program is free software; you can redistribute it and/or	modify it under the terms of the GNU General Public License	as published by the Free Software Foundation; either version 2	of the License, or (at your option) any later version.	This program is distributed in the hope that it will be useful,	but WITHOUT ANY WARRANTY; without even the implied warranty of	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	GNU General Public License for more details.	You should have received a copy of the GNU General Public License	along with this program; if not, write to the Free Software	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,	MA 02110-1301, USA.Version:	0.1Changelog:	22/04.08:		First version.Functions:	Public:		SMD_Objects - Processes objects.		SMD_Vehicles - Processes vehicles.		SMD_Pickups - Processes pickups.		SMD_Teleports - Processes teleports.	Core:		-	Stock:		SMD_Load - Loads a map file.	Static:		-	Inline:		-	API:		-Callbacks:	-Definitions:	-Enums:	-Macros:	-Tags:	-Variables:	Global:		-	Static:		-Commands:	-Compile options:	-Operators:	--*----------------------------------------------------------------------------*/forward SMD_Teleports(identifier[], text[]);forward SMD_Vehicles(identifier[], text[]);forward SMD_Pickups(identifier[], text[]);forward SMD_Objects(identifier[], text[]);/*----------------------------------------------------------------------------*-Function:	SMD_LoadParams:	filename[] - Map file to load.Return:	INI_ParseFileNotes:	--*----------------------------------------------------------------------------*/stock SMD_Load(filename[]){	return INI_ParseFile(filename, "SMD_%s", .bLocal = true);}/*----------------------------------------------------------------------------*-Function:	SMD_ObjectsParams:	identifier[] - INI entry name.	text[] - INI entry value.Return:	-Notes:	The SMD file is not strict INI format so the first value is stored as the	identifier.		Loads obejcts from the file.-*----------------------------------------------------------------------------*/public SMD_Objects(identifier[], text[]){	new		Float:x,		Float:y,		Float:z,		Float:rx,		Float:ry,		Float:rz,		Float:view;	if (sscanf(text, "fffffff", x, y, z, rx, ry, rz, view))	{		return;	}	Object_SetViewDistance(CreateDynamicObject(strval(identifier), x, y, z, rx, ry, rz), view);}/*----------------------------------------------------------------------------*-Function:	SMD_ObjectsParams:	identifier[] - INI entry name.	text[] - INI entry value.Return:	-Notes:	The SMD file is not strict INI format so the first value is stored as the	identifier.		Loads pickups from the file.-*----------------------------------------------------------------------------*/public SMD_Pickups(identifier[], text[]){	new		Float:x,		Float:y,		Float:z,		Float:view;	if (sscanf(text, "ffff", x, y, z, view))	{		return;	}	Pickup_Add(strval(identifier), x, y, z);}/*----------------------------------------------------------------------------*-Function:	SMD_ObjectsParams:	identifier[] - INI entry name.	text[] - INI entry value.Return:	-Notes:	The SMD file is not strict INI format so the first value is stored as the	identifier.		Loads vehicles from the file.-*----------------------------------------------------------------------------*/public SMD_Vehicles(identifier[], text[]){	new		Float:x,		Float:y,		Float:z,		Float:rot,		c1,		c2,		rd;	if (sscanf(text, "ffffiii", x, y, z, rot, c1, c2, rd))	{		return;	}	CreateVehicle(strval(identifier), x, y, z, rot, c1, c2, rd);}/*----------------------------------------------------------------------------*-Function:	SMD_ObjectsParams:	identifier[] - INI entry name.	text[] - INI entry value.Return:	-Notes:	The SMD file is not strict INI format so the first value is stored as the	identifier.		Currently does nothing as YSI teleports are checkpoints, not commands.  And	the command system can't QUITE support this, however does do dynamic	commands.-*----------------------------------------------------------------------------*/public SMD_Teleports(identifier[], text[]){	new		Float:x,		Float:y,		Float:z,		Float:rot,		interior;	if (sscanf(text, "fffi", x, y, z, interior))	{		return;	}}