bsdtree
client
common
include
lib
crypto
geometry
gos
srvcli
texture
utils
world
Makefile.am
Makefile.in
cellpvs.C
listener.C
msgworld.C
wacreateobject.C
waobject.C
waremoveobject.C
warotate.C
waupdatedirection.C
waupdatehierarchy.C
waupdateposition.C
worldanimation.C
worldhierarchy.C
worldobject.C
worldworld.C
Makefile.am
Makefile.in
Makefile.am
Makefile.in
doc
download
gos
lib
mudworld
server
util
worldsrv
.cvsignore
LICENSE
Makefile.am
Makefile.in
README
aclocal.m4
configure
configure.in
install-sh
missing
mkinstalldirs
pvvmud.html
88 lines
2.8 KiB
C
88 lines
2.8 KiB
C
/*
|
|
* PVVMUD a 3D MUD
|
|
* Copyright (C) 1998-1999 Programvareverkstedet (pvv@pvv.org)
|
|
*
|
|
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
*/
|
|
#include <stdlib.h>
|
|
|
|
#include "pvvmud.H"
|
|
#include "wacreateobject.H"
|
|
#include "worldworld.H"
|
|
#include "msgworld.H"
|
|
|
|
CWACreateObject::CWACreateObject( CWorldObject * object ) : CWAObject(object->getObjectId()){
|
|
m_object = object;
|
|
m_geometryId = object->getGeometryId();
|
|
m_parentId = object->getParentId();
|
|
m_position = object->getPosition();
|
|
m_direction = object->getDirection();
|
|
m_objectType = (char*)malloc(strlen(object->getObjectType())+1);
|
|
strcpy(m_objectType,object->getObjectType());
|
|
}
|
|
|
|
CWACreateObject::CWACreateObject( char * objectType, DWORD objectId , DWORD geometryId, DWORD parentId, const CPosition & position, const CDirection & direction ): CWAObject(objectId){
|
|
m_object = NULL;
|
|
m_geometryId = geometryId;
|
|
m_parentId = parentId;
|
|
m_position = position;
|
|
m_direction = direction;
|
|
m_objectType = (char*)malloc(strlen(objectType)+1);
|
|
strcpy(m_objectType,objectType);
|
|
}
|
|
|
|
CWACreateObject::~CWACreateObject(){
|
|
if (m_objectType != NULL) free ( m_objectType );
|
|
}
|
|
|
|
|
|
CMessage * CWACreateObject::createMessage(){
|
|
return new CMsgObject(getObjectId(),m_geometryId,m_parentId,m_position,m_direction);
|
|
}
|
|
|
|
int CWACreateObject::animate( DWORD time ){
|
|
cdebug << "CWAObject::animate ( " << time << " ) create object "
|
|
<< getObjectId() << " geometry " << m_geometryId
|
|
<< " parent ";
|
|
(m_parentId == ID_UNKNOWN ? cdebug << "-1" : cdebug << m_parentId);
|
|
cdebug << " position " << m_position
|
|
<< " direction " << m_direction << endl;
|
|
|
|
CWorldObject * object = m_object;
|
|
|
|
if (m_parentId == -1){
|
|
|
|
if (m_object == NULL) object = getWorld()->newObject(m_objectType,getObjectId(),NULL,m_geometryId,m_position,m_direction);
|
|
|
|
getWorld()->_addObject( object );
|
|
|
|
} else {
|
|
|
|
CWorldObject * parent = getWorld()->getObject( m_parentId );
|
|
if (parent == NULL) return FALSE;
|
|
|
|
if (object == NULL){
|
|
|
|
object = getWorld()->newObject( m_objectType, getObjectId(), parent, m_geometryId,m_position,m_direction);
|
|
}
|
|
|
|
parent->_addObject( object );
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|