Recovered from microbel
This commit is contained in:
6
server/lib/Makefile.am
Normal file
6
server/lib/Makefile.am
Normal file
@@ -0,0 +1,6 @@
|
||||
INCLUDES = -I../../common/include -I.. -I../driver @X_CFLAGS@ @GL_CFLAGS@
|
||||
|
||||
noinst_LIBRARIES = libsrvlib.a
|
||||
|
||||
libsrvlib_a_SOURCES = actionclose.C actionopen.C chest.C door.C magicchest.C viewpoint_1p.C viewpoint_3p.C viewpoint_free.C
|
||||
|
331
server/lib/Makefile.in
Normal file
331
server/lib/Makefile.in
Normal file
@@ -0,0 +1,331 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
CC = @CC@
|
||||
CXX = @CXX@
|
||||
GL_CFLAGS = @GL_CFLAGS@
|
||||
GL_LIBS = @GL_LIBS@
|
||||
LEX = @LEX@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NETLIBS = @NETLIBS@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
TIFF_CFLAGS = @TIFF_CFLAGS@
|
||||
TIFF_LIBS = @TIFF_LIBS@
|
||||
VERSION = @VERSION@
|
||||
YACC = @YACC@
|
||||
|
||||
INCLUDES = -I../../common/include -I.. -I../driver @X_CFLAGS@ @GL_CFLAGS@
|
||||
|
||||
noinst_LIBRARIES = libsrvlib.a
|
||||
|
||||
libsrvlib_a_SOURCES = actionclose.C actionopen.C chest.C door.C magicchest.C viewpoint_1p.C viewpoint_3p.C viewpoint_free.C
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(noinst_LIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir)
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
libsrvlib_a_LIBADD =
|
||||
libsrvlib_a_OBJECTS = actionclose.o actionopen.o chest.o door.o \
|
||||
magicchest.o viewpoint_1p.o viewpoint_3p.o viewpoint_free.o
|
||||
AR = ar
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@
|
||||
DIST_COMMON = Makefile.am Makefile.in TODO
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/actionclose.P .deps/actionopen.P .deps/chest.P \
|
||||
.deps/door.P .deps/magicchest.P .deps/viewpoint_1p.P \
|
||||
.deps/viewpoint_3p.P .deps/viewpoint_free.P
|
||||
SOURCES = $(libsrvlib_a_SOURCES)
|
||||
OBJECTS = $(libsrvlib_a_OBJECTS)
|
||||
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .C .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --foreign server/lib/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-noinstLIBRARIES:
|
||||
|
||||
clean-noinstLIBRARIES:
|
||||
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
|
||||
|
||||
distclean-noinstLIBRARIES:
|
||||
|
||||
maintainer-clean-noinstLIBRARIES:
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
libsrvlib.a: $(libsrvlib_a_OBJECTS) $(libsrvlib_a_DEPENDENCIES)
|
||||
-rm -f libsrvlib.a
|
||||
$(AR) cru libsrvlib.a $(libsrvlib_a_OBJECTS) $(libsrvlib_a_LIBADD)
|
||||
$(RANLIB) libsrvlib.a
|
||||
.C.o:
|
||||
$(CXXCOMPILE) -c $<
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = server/lib
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign server/lib/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
maintainer-clean-depend:
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
|
||||
%.o: %.C
|
||||
@echo '$(CXXCOMPILE) -c $<'; \
|
||||
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-cp .deps/$(*F).pp .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm .deps/$(*F).pp
|
||||
|
||||
%.lo: %.C
|
||||
@echo '$(LTCXXCOMPILE) -c $<'; \
|
||||
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
|
||||
< .deps/$(*F).pp > .deps/$(*F).P; \
|
||||
tr ' ' '\012' < .deps/$(*F).pp \
|
||||
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
|
||||
>> .deps/$(*F).P; \
|
||||
rm -f .deps/$(*F).pp
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am:
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(LIBRARIES)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-tags mostlyclean-depend mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-depend \
|
||||
clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-noinstLIBRARIES distclean-compile \
|
||||
distclean-tags distclean-depend distclean-generic \
|
||||
clean-am
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-tags \
|
||||
maintainer-clean-depend maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
|
||||
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
|
||||
mostlyclean-compile distclean-compile clean-compile \
|
||||
maintainer-clean-compile tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
1
server/lib/TODO
Normal file
1
server/lib/TODO
Normal file
@@ -0,0 +1 @@
|
||||
Delete createworld.*
|
32
server/lib/actionclose.C
Normal file
32
server/lib/actionclose.C
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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 "server.H"
|
||||
/*
|
||||
#include "actionclose.H"
|
||||
|
||||
CActionClose::CActionClose(CChest * chest):CSrvAction("Close",chest){
|
||||
|
||||
}
|
||||
|
||||
void CActionClose::execute(){
|
||||
CChest * chest = (CChest*)getMasterObject();
|
||||
chest->close();
|
||||
}
|
||||
*/
|
37
server/lib/actionclose.H
Normal file
37
server/lib/actionclose.H
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _ACTIONCLOSE_H
|
||||
#define _ACTIONCLOSE_H
|
||||
|
||||
/*
|
||||
|
||||
#include "srvaction.H"
|
||||
#include "chest.H"
|
||||
|
||||
class CActionClose: public CSrvAction {
|
||||
|
||||
public:
|
||||
CActionClose(CChest * chest);
|
||||
virtual void execute();
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#endif // _ACTIONCLOSE_H
|
32
server/lib/actionopen.C
Normal file
32
server/lib/actionopen.C
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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 "server.H"
|
||||
/*
|
||||
#include "actionopen.H"
|
||||
|
||||
CActionOpen::CActionOpen(CChest * chest):CSrvAction("Open",chest){
|
||||
|
||||
}
|
||||
|
||||
void CActionOpen::execute(){
|
||||
CChest * chest = (CChest*)getMasterObject();
|
||||
chest->open();
|
||||
}
|
||||
*/
|
38
server/lib/actionopen.H
Normal file
38
server/lib/actionopen.H
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _ACTIONOPEN_H
|
||||
#define _ACTIONOPEN_H
|
||||
|
||||
/*
|
||||
|
||||
|
||||
#include "srvaction.H"
|
||||
#include "chest.H"
|
||||
|
||||
class CActionOpen: public CSrvAction {
|
||||
|
||||
public:
|
||||
CActionOpen(CChest * chest);
|
||||
virtual void execute();
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#endif // _ACTIONOPEN_H
|
102
server/lib/chest.C
Normal file
102
server/lib/chest.C
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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 <stdio.h>
|
||||
/*
|
||||
#include "server.H"
|
||||
#include "chest.H"
|
||||
#include "actionopen.H"
|
||||
#include "actionclose.H"
|
||||
|
||||
CChest::CChest():CSrvObject(){
|
||||
|
||||
setName("Chest");
|
||||
|
||||
state = CHESTSTATE_OPENED;
|
||||
doorAngle = 45;
|
||||
|
||||
CGeometryObject * geometry = new CGeometryObject("Chest",7);
|
||||
geometry->setBBox( new CBBox(-0.25,0.4,0,0.25,-0.4,0.5) );
|
||||
|
||||
doorGeometry = new CGeometryObject("Chest door",8);
|
||||
doorGeometry->setPosition( CPosition(-0.25,0,0.5) );
|
||||
doorGeometry->setDirection( CDirection(0,-doorAngle,0) );
|
||||
doorGeometry->setBBox( new CBBox(0.0,0.4,0,0.5,-0.4,0.5) );
|
||||
|
||||
geometry->addGeometryObject( doorGeometry );
|
||||
|
||||
setGeometry(geometry);
|
||||
|
||||
addAction( new CActionOpen(this) );
|
||||
addAction( new CActionClose(this) );
|
||||
|
||||
}
|
||||
|
||||
int CChest::open(){
|
||||
if (state == CHESTSTATE_CLOSED) {
|
||||
printf("Chest: open!\n");
|
||||
state = CHESTSTATE_OPEN;
|
||||
} else return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CChest::close(){
|
||||
if (state == CHESTSTATE_OPENED) {
|
||||
printf("Chest: close!\n");
|
||||
state = CHESTSTATE_CLOSE;
|
||||
} else return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CChest::animate( double time ){
|
||||
// printf("Chest: animate( %f )\n",time );
|
||||
switch (state) {
|
||||
case CHESTSTATE_OPENED:
|
||||
case CHESTSTATE_CLOSED:
|
||||
return ;
|
||||
break;
|
||||
case CHESTSTATE_OPEN:
|
||||
doorAngle += CHESTANGLE_SPEED*time;
|
||||
if (doorAngle > 45.0){
|
||||
doorAngle = 45.0;
|
||||
state = CHESTSTATE_OPENED;
|
||||
doorOpened();
|
||||
}
|
||||
doorGeometry->updateDirection( CDirection(0,-doorAngle,0) );
|
||||
break;
|
||||
case CHESTSTATE_CLOSE:
|
||||
doorAngle -= CHESTANGLE_SPEED*time;
|
||||
if (doorAngle < 0.0){
|
||||
doorAngle = 0.0;
|
||||
state = CHESTSTATE_CLOSED;
|
||||
doorClosed();
|
||||
}
|
||||
doorGeometry->updateDirection( CDirection(0,-doorAngle,0) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CChest::doorOpened(){
|
||||
printf("Chest: doorOpened!\n");
|
||||
}
|
||||
|
||||
void CChest::doorClosed(){
|
||||
printf("Chest: doorClosed!\n");
|
||||
}
|
||||
*/
|
60
server/lib/chest.H
Normal file
60
server/lib/chest.H
Normal file
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _CHEST_H
|
||||
#define _CHEST_H
|
||||
|
||||
/*
|
||||
|
||||
#include "srvobject.H"
|
||||
#include "geometryobject.H"
|
||||
|
||||
#define CHESTSTATE_NO 0
|
||||
#define CHESTSTATE_OPENED 1
|
||||
#define CHESTSTATE_CLOSED 2
|
||||
#define CHESTSTATE_OPEN 3
|
||||
#define CHESTSTATE_CLOSE 4
|
||||
|
||||
#define CHESTANGLE_SPEED 360/60 // 360 grader per min
|
||||
|
||||
|
||||
class CChest: public CSrvObject {
|
||||
|
||||
CGeometryObject * doorGeometry;
|
||||
double doorAngle;
|
||||
|
||||
public:
|
||||
int state;
|
||||
|
||||
public:
|
||||
|
||||
CChest();
|
||||
|
||||
int open();
|
||||
int close();
|
||||
|
||||
virtual void animate( double time );
|
||||
|
||||
virtual void doorOpened();
|
||||
virtual void doorClosed();
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
#endif // _CHEST_H
|
91
server/lib/door.C
Normal file
91
server/lib/door.C
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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 <stdio.h>
|
||||
/*
|
||||
#include "server.H"
|
||||
#include "door.H"
|
||||
|
||||
CDoor::CDoor():CSrvObject(){
|
||||
|
||||
state = DOORSTATE_OPENED;
|
||||
doorAngle = 45;
|
||||
|
||||
CGeometryObject * geometry = new CGeometryObject("Door",7);
|
||||
geometry->setBBox( new CBBox(-0.4,-0.1,0,0.4,0.1,1.8) );
|
||||
|
||||
setGeometry(geometry);
|
||||
|
||||
setDirection( CDirection(0,-doorAngle,0) );
|
||||
|
||||
}
|
||||
|
||||
int CDoor::open(){
|
||||
if (state == DOORSTATE_CLOSED) {
|
||||
printf("Door: open!\n");
|
||||
state = DOORSTATE_OPEN;
|
||||
} else return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int CDoor::close(){
|
||||
if (state == DOORSTATE_OPENED) {
|
||||
printf("Door: close!\n");
|
||||
state = DOORSTATE_CLOSE;
|
||||
} else return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CDoor::animate( double time ){
|
||||
// printf("Door: animate( %f )\n",time );
|
||||
switch (state) {
|
||||
case DOORSTATE_OPENED:
|
||||
case DOORSTATE_CLOSED:
|
||||
return ;
|
||||
break;
|
||||
case DOORSTATE_OPEN:
|
||||
doorAngle += DOORANGLE_SPEED*time;
|
||||
if (doorAngle > 45.0){
|
||||
doorAngle = 45.0;
|
||||
state = DOORSTATE_OPENED;
|
||||
doorOpened();
|
||||
}
|
||||
updateDirection( CDirection(0,-doorAngle,0) );
|
||||
break;
|
||||
case DOORSTATE_CLOSE:
|
||||
doorAngle -= DOORANGLE_SPEED*time;
|
||||
if (doorAngle < 0.0){
|
||||
doorAngle = 0.0;
|
||||
state = DOORSTATE_CLOSED;
|
||||
doorClosed();
|
||||
}
|
||||
updateDirection( CDirection(0,-doorAngle,0) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CDoor::doorOpened(){
|
||||
printf("Door: doorOpened!\n");
|
||||
}
|
||||
|
||||
void CDoor::doorClosed(){
|
||||
printf("Door: doorClosed!\n");
|
||||
}
|
||||
|
||||
*/
|
59
server/lib/door.H
Normal file
59
server/lib/door.H
Normal file
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _DOOR_H
|
||||
#define _DOOR_H
|
||||
/*
|
||||
|
||||
#include "srvobject.H"
|
||||
#include "geometryobject.H"
|
||||
|
||||
#define DOORSTATE_NO 0
|
||||
#define DOORSTATE_OPENED 1
|
||||
#define DOORSTATE_CLOSED 2
|
||||
#define DOORSTATE_OPEN 3
|
||||
#define DOORSTATE_CLOSE 4
|
||||
|
||||
#define DOORANGLE_SPEED 360/60 // 360 grader per min
|
||||
|
||||
|
||||
class CDoor: public CSrvObject {
|
||||
|
||||
double doorAngle;
|
||||
|
||||
public:
|
||||
int state;
|
||||
|
||||
public:
|
||||
|
||||
CDoor();
|
||||
|
||||
int open();
|
||||
int close();
|
||||
|
||||
virtual void animate( double time );
|
||||
|
||||
virtual void doorOpened();
|
||||
virtual void doorClosed();
|
||||
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#endif // _DOOR_H
|
127
server/lib/gamefunction.C
Normal file
127
server/lib/gamefunction.C
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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 "gamefunction.H"
|
||||
|
||||
CGameFunctionObject :: CGameFunctionObject () {
|
||||
type=-1;
|
||||
func.c=NULL;
|
||||
}
|
||||
|
||||
CGameFunctionObject :: ~CGameFunctionObject () {
|
||||
type=-1;
|
||||
func.c=NULL;
|
||||
}
|
||||
|
||||
CGameFunction :: ~CGameFunction() {
|
||||
funchash::iterator i;
|
||||
for(i=hash.begin();i!=hash.end();i++) delete (*i).second;
|
||||
hash.clear();
|
||||
}
|
||||
|
||||
void CGameFunction :: add(char *name, void (*function)()) {
|
||||
CGameFunctionObject *gfo;
|
||||
|
||||
gfo=new CGameFunctionObject;
|
||||
|
||||
gfo->type = 0;
|
||||
gfo->func.c = function;
|
||||
|
||||
hash[name] = gfo;
|
||||
}
|
||||
|
||||
void CGameFunction :: add(char *name, char *function) {
|
||||
CGameFunctionObject *gfo;
|
||||
|
||||
gfo=new CGameFunctionObject;
|
||||
|
||||
gfo->type = 1;
|
||||
gfo->func.scriptSource = function;
|
||||
|
||||
hash[name] = gfo;
|
||||
}
|
||||
|
||||
void CGameFunction :: add(char *name, WORD *function) {
|
||||
CGameFunctionObject *gfo;
|
||||
|
||||
gfo=new CGameFunctionObject;
|
||||
|
||||
gfo->type = 2;
|
||||
gfo->func.scriptByteCode = function;
|
||||
|
||||
hash[name] = gfo;
|
||||
}
|
||||
|
||||
void CGameFunction :: remove(char *name) {
|
||||
CGameFunctionObject *gfo;
|
||||
|
||||
free(hash[name]);
|
||||
hash.erase(name);
|
||||
}
|
||||
|
||||
bool CGameFunction :: execute(char *name, CGameEvent *gameEvent) {
|
||||
CGameFunctionObject *gfo;
|
||||
|
||||
gfo=getGameFuncObj(name);
|
||||
return(execute(gfo,gameEvent));
|
||||
}
|
||||
|
||||
CGameFunctionObject *CGameFunction::getGameFuncObj(char *name) {
|
||||
CGameFunctionObject *gfo=NULL;
|
||||
|
||||
gfo=hash[name];
|
||||
return gfo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CGameFunctionObject :: execute (CGameEvent *gameEvent) {
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
return(func->c());
|
||||
// case 1:
|
||||
// return(executeScript(func.scriptSource,gameEvent));
|
||||
// case 2:
|
||||
// return(executeByteCode(func.scriptByteCode,gameEvent));
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
bool CGameFunction :: execute(CGameFunctionObject *gfo,
|
||||
CGameEvent *gameEvent) {
|
||||
|
||||
if (gfo == NULL) return;
|
||||
return (gfo->execute(gameEvent));
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CGameFunction :: load(iostream &readFile) {
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
bool CGameFunction :: save(iostream &writeFile {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
83
server/lib/gamefunction.H
Normal file
83
server/lib/gamefunction.H
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _GAMEFUNCTION_H
|
||||
#define _GAMEFUNCTION_H
|
||||
|
||||
#include "pvvmud.H"
|
||||
#include <hash_map>
|
||||
#include <iostream>
|
||||
|
||||
class CGameFunctionObject {
|
||||
|
||||
public:
|
||||
|
||||
CGameFunctionObject(void);
|
||||
~CGameFunctionObject(void);
|
||||
|
||||
int type;
|
||||
union {
|
||||
bool (*c)();
|
||||
char *scriptSource;
|
||||
WORD *scriptByteCode;
|
||||
} func;
|
||||
|
||||
bool execute(CGameEvent *gameEvent);
|
||||
};
|
||||
|
||||
class CGameFunction {
|
||||
struct eqstr {
|
||||
bool operator()(const char* s1,const char* s2) const
|
||||
{
|
||||
return strcmp(s1,s2)==0;
|
||||
}
|
||||
};
|
||||
typedef hash_map<const char*, CGameFunctionObject *, hash<const char*>, eqstr> funchash;
|
||||
funchash hash;
|
||||
|
||||
public:
|
||||
|
||||
CGameFunction(void) {};
|
||||
~CGameFunction(void);
|
||||
|
||||
// Handling of C++ functions
|
||||
void add(char *name, void (*function) (CGameEvent *gameEvent));
|
||||
// Handling of functions in script code
|
||||
void add(char *name, char *function,CGameEvent *gameEvent);
|
||||
// Handling of byte code functions
|
||||
void add(char *name, WORD *function,CGameEvent *gameEvent);
|
||||
void remove(char *name);
|
||||
|
||||
bool execute(char *name, CGameEvent *gameEvent);
|
||||
bool execute(CGameFunctionObject *gfo, CGameEvent *gameEvent);
|
||||
|
||||
CGameFunctionObject *getGameFuncObj(char *name);
|
||||
|
||||
bool load(iostream &readFile);
|
||||
bool save(iostream &writeFile);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
97
server/lib/gamelistener.C
Normal file
97
server/lib/gamelistener.C
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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 "gamelistener.H"
|
||||
|
||||
|
||||
CGameListenerItem::CGameListenerItem() {
|
||||
m_s=0;
|
||||
m_v=NULL;
|
||||
m_priority=0;
|
||||
}
|
||||
|
||||
CGameListenerItem::CGameListenerItem(DWORD gameObject, CGameFunctionObject
|
||||
*func, int priority) {
|
||||
m_s=gameObject;
|
||||
m_v=func;
|
||||
m_priority=priority;
|
||||
}
|
||||
|
||||
CGameListenerItem::~CGameListenerItem() {
|
||||
}
|
||||
|
||||
void CGameListenerList::CGameListenerList() {
|
||||
}
|
||||
|
||||
void CGameListenerList::CGameListenerList() {
|
||||
listenerlist.clear();
|
||||
}
|
||||
|
||||
void CGameListenerList::add(DWORD gameObject, CGameFunctionObject *func,
|
||||
int priority) {
|
||||
list<CGameListenerItem>::iterator i;
|
||||
|
||||
for(i=listenerlist.begin();i!=listenerlist.end;i++) {
|
||||
if ( (*i).second.priority > priority) {
|
||||
listenerlist.insert(i,CGameListenerItem(gameObject, func, priority));
|
||||
return;
|
||||
};
|
||||
};
|
||||
listenerlist.push_back(CGameListenerItem(gameObject, func, priority));
|
||||
}
|
||||
|
||||
void CGameListenerList::execute(CGameEvent *gameEvent) {
|
||||
list<CGameListenerItem>::iterator i;
|
||||
|
||||
for(i=i.begin(); i!=i.end; i++) {
|
||||
if (!(*i).second.m_v->execute(gameEvent)) return;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void CGameListener::CGameListener() {
|
||||
}
|
||||
|
||||
void CGameListener::~CGameListener() {
|
||||
hash.clear();
|
||||
}
|
||||
|
||||
void CGameListener::add(DWORD event, DWORD gameObject,
|
||||
CGameFunctionObject *func, int priority) {
|
||||
|
||||
key.event = event;
|
||||
key.object = gameObject;
|
||||
|
||||
hash[key]=CGameListenerList();
|
||||
hash[key].add(gameObject, func, priority);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CGameListener::execute(CGameEvent *gameEvent) {
|
||||
|
||||
key.event = gameEvent.id;
|
||||
key.object = gameEvent.subject;
|
||||
|
||||
hash[key].execute(gameEvent);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
95
server/lib/gamelistener.H
Normal file
95
server/lib/gamelistener.H
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _GAMELISTENER_H
|
||||
#define _GAMELISTENER_H
|
||||
|
||||
#include "pvvmud.H"
|
||||
#include "gameevent.H"
|
||||
#include "gamefunction.H"
|
||||
#include "gameobject.H"
|
||||
#include <list>
|
||||
#include <hash_map>
|
||||
|
||||
class CGameListenerItem {
|
||||
|
||||
public:
|
||||
DWORD s;
|
||||
CGameFunctionObject *v;
|
||||
int priority;
|
||||
|
||||
CGameListenerItem::CGameListenerItem(DWORD gameObject, CGameFunctionObject
|
||||
*func, int priority) {
|
||||
CGameListenerItem();
|
||||
~CGameListenerItem();
|
||||
};
|
||||
|
||||
class CGameListenerList {
|
||||
|
||||
list<CGameListenerItem> listenerList;
|
||||
|
||||
public:
|
||||
CGameListenerList();
|
||||
~CGameListenerList();
|
||||
void add(DWORD s, CGameFunctionObject *v, int priority);
|
||||
void execute(CGameEvent *gameEvent);
|
||||
|
||||
};
|
||||
|
||||
class CGameListener {
|
||||
|
||||
struct _key {
|
||||
DWORD event;
|
||||
DWORD object;
|
||||
} key;
|
||||
|
||||
struct eqkey
|
||||
{
|
||||
bool operator()(struct _key s1, struct _key s2) const
|
||||
{
|
||||
return ( (s1.event==s2.event) && (s1.object==s2.object) );
|
||||
}
|
||||
};
|
||||
|
||||
typedef listenerHash = hash_map<const char *, CGameListenerList, hash<const
|
||||
char *>,eqkey);
|
||||
listenerHash hash;
|
||||
|
||||
public:
|
||||
CGameListener();
|
||||
~GameListener();
|
||||
void add(DWORD event, DWORD gameObject, CGameFunctionObject *func,
|
||||
int priority);
|
||||
void execute(CGameEvent *gameEvent);
|
||||
};
|
||||
|
||||
#endif _GAMELISTENER_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
277
server/lib/gamevalue.C
Normal file
277
server/lib/gamevalue.C
Normal file
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
* 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 "gamevalue.H"
|
||||
|
||||
CGameValueObject::CGameValueObject() {
|
||||
type=GV_INVALID;
|
||||
value._dword=0;
|
||||
_ptr=NULL;
|
||||
}
|
||||
|
||||
CGameValueObject::~CGameValueObject() {
|
||||
type=GV_INVALID;
|
||||
value._dword=0;
|
||||
_ptr=NULL;
|
||||
}
|
||||
|
||||
CGameValue::CGameValue() {};
|
||||
|
||||
CGameValue::~CGameValue() {
|
||||
valhash::iterator i;
|
||||
for(i=hash.begin();i!=hash.end();i++) delete (*i).second;
|
||||
hash.clear();
|
||||
}
|
||||
|
||||
void CGameValue::add(char *name, BYTE *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = new CGameValueObject;
|
||||
gvo->type = GV_BYTE;
|
||||
gvo->value._byte = *value;
|
||||
|
||||
hash[name] = gvo;
|
||||
}
|
||||
|
||||
void CGameValue::add(char *name, WORD *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = new CGameValueObject;
|
||||
gvo->type = GV_WORD;
|
||||
gvo->value._word = *value;
|
||||
|
||||
hash[name] = gvo;
|
||||
}
|
||||
|
||||
|
||||
void CGameValue::add(char *name, DWORD *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = new CGameValueObject;
|
||||
gvo->type = GV_DWORD;
|
||||
gvo->value._byte = *value;
|
||||
|
||||
hash[name] = gvo;
|
||||
}
|
||||
|
||||
void CGameValue::add(char *name, float *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = new CGameValueObject;
|
||||
gvo->type = GV_FLOAT;
|
||||
gvo->value._float = *value;
|
||||
|
||||
hash[name] = gvo;
|
||||
}
|
||||
|
||||
void CGameValue::add(char *name, double *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = new CGameValueObject;
|
||||
gvo->type = GV_DOUBLE;
|
||||
gvo->value._double = *value;
|
||||
|
||||
hash[name] = gvo;
|
||||
}
|
||||
|
||||
void CGameValue::add(char *name, char *data, int *length) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = new CGameValueObject;
|
||||
gvo->type = GV_STRING;
|
||||
gvo->value._dword = (DWORD) *length;
|
||||
gvo->_ptr = data;
|
||||
|
||||
hash[name] = gvo;
|
||||
}
|
||||
|
||||
|
||||
bool CGameValue::get(char *name, BYTE *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = hash[name];
|
||||
*value = gvo->value._byte;
|
||||
if (gvo->type != GV_BYTE) {
|
||||
return(FALSE);
|
||||
} else {
|
||||
return(TRUE);
|
||||
};
|
||||
}
|
||||
|
||||
bool CGameValue::get(char *name, WORD *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = hash[name];
|
||||
*value = gvo->value._word;
|
||||
if (gvo->type != GV_WORD) {
|
||||
return(FALSE);
|
||||
} else {
|
||||
return(TRUE);
|
||||
};
|
||||
}
|
||||
|
||||
bool CGameValue::get(char *name, DWORD *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = hash[name];
|
||||
*value = gvo->value._dword;
|
||||
if (gvo->type != GV_DWORD) {
|
||||
return(FALSE);
|
||||
} else {
|
||||
return(TRUE);
|
||||
};
|
||||
}
|
||||
|
||||
bool CGameValue::get(char *name, float *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = hash[name];
|
||||
*value = gvo->value._float;
|
||||
if (gvo->type != GV_FLOAT) {
|
||||
return(FALSE);
|
||||
} else {
|
||||
return(TRUE);
|
||||
};
|
||||
}
|
||||
|
||||
bool CGameValue::get(char *name, double *value) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = hash[name];
|
||||
*value = gvo->value._double;
|
||||
if (gvo->type != GV_DOUBLE) {
|
||||
return(FALSE);
|
||||
} else {
|
||||
return(TRUE);
|
||||
};
|
||||
}
|
||||
|
||||
bool CGameValue::get(char *name, char *data, int *length) {
|
||||
CGameValueObject *gvo;
|
||||
|
||||
gvo = hash[name];
|
||||
*length = gvo->value._dword;
|
||||
data = gvo->_ptr;
|
||||
if (gvo->type != GV_STRING) {
|
||||
return(FALSE);
|
||||
} else {
|
||||
return(TRUE);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
bool CGameValue::load(iostream &readFile) {
|
||||
char name[256];
|
||||
int type;
|
||||
union {
|
||||
BYTE _byte;
|
||||
WORD _word;
|
||||
DWORD _dword;
|
||||
float _float;
|
||||
double _double;
|
||||
} value;
|
||||
char *_ptr;
|
||||
|
||||
valhash::iterator i;
|
||||
for(i=hash.begin();i!=hash.end();i++) delete (*i).second;
|
||||
hash.clear();
|
||||
|
||||
while (!readFile.eof()) {
|
||||
readFile >> name;
|
||||
if (!strcmp(name, "[\\Values]")) break;
|
||||
readFile >> type;
|
||||
switch (type) {
|
||||
|
||||
case GV_BYTE:
|
||||
readFile >> value._byte;
|
||||
add(name,value._byte);
|
||||
break;
|
||||
case GV_WORD:
|
||||
readFile >> value._word;
|
||||
add(name,value._word);
|
||||
break;
|
||||
case GV_DWORD:
|
||||
readFile >> value._dword;
|
||||
add(name,value._dword);
|
||||
break;
|
||||
case GV_FLOAT:
|
||||
readFile >> value._float;
|
||||
add(name,value._float);
|
||||
break;
|
||||
case GV_DOUBLE:
|
||||
readFile >> value._double;
|
||||
add(name,value._double);
|
||||
break;
|
||||
case GV_STRING:
|
||||
readFile >> value._dword;
|
||||
_ptr = new string();
|
||||
for (int n=0;n<value._dword;n++){
|
||||
char ch;
|
||||
readFile >> ch;
|
||||
_ptr += ch;
|
||||
}
|
||||
add(name,value._dword,_ptr);
|
||||
_ptr=NULL;
|
||||
break;
|
||||
default:
|
||||
cout << "Failed : Unknown type of variable";
|
||||
return FALSE;
|
||||
break;
|
||||
};
|
||||
};
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CGameValue::save(iostream &writefile) {
|
||||
writeFile << "[Values]" << newln;
|
||||
|
||||
valhash::iterator i;
|
||||
for(i=hash.begin();i!=hash.end();i++) {
|
||||
writeFile << (*i).first() << (*i).second->type;
|
||||
switch((*i).second->type) {
|
||||
case GV_BYTE:
|
||||
writeFile << (*i).second->value._byte;
|
||||
break;
|
||||
case GV_WORD:
|
||||
writeFile << (*i).second->value._word;
|
||||
break;
|
||||
case GV_DWORD:
|
||||
writeFile << (*i).second->value._dword;
|
||||
break;
|
||||
case GV_FLOAT:
|
||||
writeFile << (*i).second->value._float;
|
||||
break;
|
||||
case GV_DOUBLE:
|
||||
writeFile << (*i).second->value._double;
|
||||
break;
|
||||
case GV_STRING:
|
||||
writeFile << (*i).second->value._dword << newln;
|
||||
for (int n=0;n<(*i).second->value._dword;n++){
|
||||
writeFile << *((*i).second->_ptr+n);
|
||||
}
|
||||
writeFile << newln;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
};
|
||||
|
||||
writeFile << "[\\Values]" << newln;
|
||||
return TRUE;
|
||||
}
|
81
server/lib/gamevalue.H
Normal file
81
server/lib/gamevalue.H
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _GAMEVALUE_H
|
||||
#define _GAMEVALUE_H
|
||||
|
||||
#include "pvvmud.H"
|
||||
#include <hash_map>
|
||||
#include <iostream>
|
||||
|
||||
class CGameValueObject {
|
||||
|
||||
public:
|
||||
|
||||
CGameValueObject();
|
||||
~CGameValueObject();
|
||||
|
||||
int type;
|
||||
union {
|
||||
BYTE _byte;
|
||||
WORD _word;
|
||||
DWORD _dword;
|
||||
float _float;
|
||||
double _double;
|
||||
} value;
|
||||
char *_ptr;
|
||||
|
||||
};
|
||||
|
||||
class CGameValue {
|
||||
enum {GV_INVALID=-1,GV_BYTE,GV_WORD,GV_DWORD,GV_FLOAT,GV_DOUBLE,GV_STRING};
|
||||
|
||||
struct eqstr {
|
||||
bool operator()(const char* s1,const char* s2) const
|
||||
{
|
||||
return strcmp(s1,s2)==0;
|
||||
};
|
||||
};
|
||||
typedef hash_map<const char *, CGameValueObject *, hash<const char *>,eqstr> valhash;
|
||||
valhash hash;
|
||||
|
||||
public:
|
||||
|
||||
CGameValue(void);
|
||||
~CGameValue(void);
|
||||
|
||||
void add(char *, BYTE *);
|
||||
void add(char *, WORD *);
|
||||
void add(char *, DWORD *);
|
||||
void add(char *, float *);
|
||||
void add(char *, double *);
|
||||
void add(char *, char *, int *);
|
||||
|
||||
bool get(char *, BYTE *);
|
||||
bool get(char *, WORD *);
|
||||
bool get(char *, DWORD *);
|
||||
bool get(char *, float *);
|
||||
bool get(char *, double *);
|
||||
bool get(char *, char *, int *);
|
||||
|
||||
bool load(iostream &readFile);
|
||||
bool save(iostream &saveFile);
|
||||
};
|
||||
|
||||
#endif
|
36
server/lib/magicchest.C
Normal file
36
server/lib/magicchest.C
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 <stdio.h>
|
||||
/*
|
||||
#include "server.H"
|
||||
#include "magicchest.H"
|
||||
|
||||
CMagicChest::CMagicChest():CChest(){
|
||||
close();
|
||||
}
|
||||
|
||||
void CMagicChest::doorOpened(){
|
||||
close();
|
||||
}
|
||||
|
||||
void CMagicChest::doorClosed(){
|
||||
open();
|
||||
}
|
||||
*/
|
40
server/lib/magicchest.H
Normal file
40
server/lib/magicchest.H
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _MAGICCHEST_H
|
||||
#define _MAGICCHEST_H
|
||||
|
||||
/*
|
||||
|
||||
#include "chest.H"
|
||||
|
||||
class CMagicChest: public CChest {
|
||||
|
||||
public:
|
||||
|
||||
CMagicChest();
|
||||
|
||||
virtual void doorOpened();
|
||||
virtual void doorClosed();
|
||||
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
#endif // _MAGICCHEST_H
|
72
server/lib/mudlib.C
Normal file
72
server/lib/mudlib.C
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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 "mudlib.H"
|
||||
|
||||
CMudLib::CMudLib() {
|
||||
|
||||
m_gameclass=new CGameClass();
|
||||
load();
|
||||
|
||||
}
|
||||
|
||||
CMudLib::~CMudLib() {
|
||||
|
||||
save();
|
||||
delete CGameClass();
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CMudLib::load() {
|
||||
bool state;
|
||||
|
||||
try {
|
||||
ifstream readFile(DATABASEFILE);
|
||||
state = m_gameclass->load(readFile);
|
||||
readFile.close();
|
||||
} catch (CIOException *err){
|
||||
cdebug << "Failed to load mudlib: " << *err << endl;
|
||||
delete err;
|
||||
return FALSE;
|
||||
};
|
||||
return state;
|
||||
}
|
||||
|
||||
bool CMudLib::save() {
|
||||
bool state;
|
||||
|
||||
try {
|
||||
ofstream writeFile(DATABASEFILE);
|
||||
state = m_gameclass->save(writeFile);
|
||||
writeFile.close();
|
||||
} catch (CIOException *err) {
|
||||
cdebug << "Failed to save mudlib: " << *err << endl;
|
||||
delete err;
|
||||
return FALSE;
|
||||
};
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
57
server/lib/mudlib.H
Normal file
57
server/lib/mudlib.H
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _MUDLIB_H
|
||||
#define _MUDLIB_H
|
||||
|
||||
#include "pvvmud.H"
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include "exception.H"
|
||||
#include "gameclass.H"
|
||||
|
||||
#define DATABASEFILE "mudlib/mud.db"
|
||||
|
||||
class CMudLib {
|
||||
|
||||
CGameClass *m_gameclass;
|
||||
|
||||
public:
|
||||
CMudLib();
|
||||
~CMudLib();
|
||||
|
||||
bool load();
|
||||
bool save();
|
||||
|
||||
void event(CGameEvent *gameEvent);
|
||||
|
||||
};
|
||||
|
||||
#endif _MUDLIB_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
2
server/lib/task.txt
Normal file
2
server/lib/task.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
%s/Open/Close/g
|
||||
w
|
69
server/lib/viewpoint_1p.C
Normal file
69
server/lib/viewpoint_1p.C
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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 <stdio.h>
|
||||
#include "server.H"
|
||||
#include "viewpoint_1p.H"
|
||||
|
||||
CViewpoint_1p::CViewpoint_1p(){
|
||||
persionHeight = 1.5;
|
||||
lookDefault();
|
||||
}
|
||||
|
||||
|
||||
void CViewpoint_1p::update( CWorldObject * target ){
|
||||
// CPosition position = target->getPosition();
|
||||
// CDirection direction = target->getDirection();
|
||||
// position += CPosition(0,0,persionHeight);
|
||||
// position += headPosition ;
|
||||
// direction += headDirection ;
|
||||
// setPosition( position );
|
||||
// setDirection( direction );
|
||||
setPosition( headPosition );
|
||||
setDirection( headDirection );
|
||||
}
|
||||
|
||||
void CViewpoint_1p::lookDefault(){
|
||||
headDirection = CDirection(0,0,0);
|
||||
headPosition = CPosition(0,0,persionHeight);
|
||||
}
|
||||
|
||||
void CViewpoint_1p::lookUp(){
|
||||
headPosition.moveZ(1);
|
||||
}
|
||||
|
||||
void CViewpoint_1p::lookDown(){
|
||||
headPosition.moveZ(-1);
|
||||
}
|
||||
|
||||
void CViewpoint_1p::lookRight(){
|
||||
headDirection.rotateHeading(-5.0);
|
||||
}
|
||||
|
||||
void CViewpoint_1p::lookLeft(){
|
||||
headDirection.rotateHeading(5.0);
|
||||
}
|
||||
|
||||
void CViewpoint_1p::lookForward(){
|
||||
}
|
||||
|
||||
void CViewpoint_1p::lookBackward(){
|
||||
}
|
||||
|
||||
|
45
server/lib/viewpoint_1p.H
Normal file
45
server/lib/viewpoint_1p.H
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _VIEWPOINT_1P_H
|
||||
#define _VIEWPOINT_1P_H
|
||||
|
||||
#include "srvviewpoint.H"
|
||||
|
||||
class CViewpoint_1p: public CSrvViewpoint {
|
||||
|
||||
CDirection headDirection;
|
||||
CPosition headPosition;
|
||||
|
||||
public:
|
||||
CViewpoint_1p();
|
||||
|
||||
// virtual void update(CSrvObject * target);
|
||||
virtual void update(CWorldObject * target);
|
||||
virtual void lookDefault();
|
||||
virtual void lookUp();
|
||||
virtual void lookDown();
|
||||
virtual void lookRight();
|
||||
virtual void lookLeft();
|
||||
virtual void lookForward();
|
||||
virtual void lookBackward();
|
||||
|
||||
};
|
||||
|
||||
#endif // _VIEWPOINT_1P_H
|
55
server/lib/viewpoint_3p.C
Normal file
55
server/lib/viewpoint_3p.C
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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 "server.H"
|
||||
#include "viewpoint_3p.H"
|
||||
|
||||
CViewpoint_3p::CViewpoint_3p(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
//void CViewpoint_3p::update( CSrvObject * target ){
|
||||
void CViewpoint_3p::update( CWorldObject * target ){
|
||||
CPosition position = target->getPosition();
|
||||
CDirection direction = target->getDirection();
|
||||
position += CPosition(0,-3.0,1.0);
|
||||
setPosition( position );
|
||||
// setDirection( direction );
|
||||
}
|
||||
|
||||
void CViewpoint_3p::lookUp(){
|
||||
}
|
||||
|
||||
void CViewpoint_3p::lookDown(){
|
||||
}
|
||||
|
||||
void CViewpoint_3p::lookRight(){
|
||||
}
|
||||
|
||||
void CViewpoint_3p::lookLeft(){
|
||||
}
|
||||
|
||||
void CViewpoint_3p::lookForward(){
|
||||
}
|
||||
|
||||
void CViewpoint_3p::lookBackward(){
|
||||
}
|
||||
|
||||
|
41
server/lib/viewpoint_3p.H
Normal file
41
server/lib/viewpoint_3p.H
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _VIEWPOINT_3P_H
|
||||
#define _VIEWPOINT_3P_H
|
||||
|
||||
#include "srvviewpoint.H"
|
||||
|
||||
class CViewpoint_3p: public CSrvViewpoint {
|
||||
|
||||
public:
|
||||
CViewpoint_3p();
|
||||
|
||||
// virtual void update(CSrvObject * target);
|
||||
virtual void update(CWorldObject * target);
|
||||
virtual void lookUp();
|
||||
virtual void lookDown();
|
||||
virtual void lookRight();
|
||||
virtual void lookLeft();
|
||||
virtual void lookForward();
|
||||
virtual void lookBackward();
|
||||
|
||||
};
|
||||
|
||||
#endif // _VIEWPOINT_3P_H
|
54
server/lib/viewpoint_free.C
Normal file
54
server/lib/viewpoint_free.C
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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 "server.H"
|
||||
#include "viewpoint_free.H"
|
||||
|
||||
CViewpoint_free::CViewpoint_free(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CViewpoint_free::update( CWorldObject * target ){
|
||||
CPosition position = target->getPosition();
|
||||
CDirection direction = target->getDirection();
|
||||
position += CPosition(0,-3.0,1.0);
|
||||
setPosition( position );
|
||||
// setDirection( direction );
|
||||
}
|
||||
|
||||
void CViewpoint_free::lookUp(){
|
||||
}
|
||||
|
||||
void CViewpoint_free::lookDown(){
|
||||
}
|
||||
|
||||
void CViewpoint_free::lookRight(){
|
||||
}
|
||||
|
||||
void CViewpoint_free::lookLeft(){
|
||||
}
|
||||
|
||||
void CViewpoint_free::lookForward(){
|
||||
}
|
||||
|
||||
void CViewpoint_free::lookBackward(){
|
||||
}
|
||||
|
||||
|
40
server/lib/viewpoint_free.H
Normal file
40
server/lib/viewpoint_free.H
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef _VIEWPOINT_FREE_H
|
||||
#define _VIEWPOINT_FREE_H
|
||||
|
||||
#include "srvviewpoint.H"
|
||||
|
||||
class CViewpoint_free: public CSrvViewpoint {
|
||||
|
||||
public:
|
||||
CViewpoint_free();
|
||||
|
||||
virtual void update(CWorldObject * target);
|
||||
virtual void lookUp();
|
||||
virtual void lookDown();
|
||||
virtual void lookRight();
|
||||
virtual void lookLeft();
|
||||
virtual void lookForward();
|
||||
virtual void lookBackward();
|
||||
|
||||
};
|
||||
|
||||
#endif // _VIEWPOINT_FREE_H
|
Reference in New Issue
Block a user