Recovered from microbel
This commit is contained in:
8
client/coreclient/Makefile.am
Normal file
8
client/coreclient/Makefile.am
Normal file
@@ -0,0 +1,8 @@
|
||||
INCLUDES = -I.. -I../renderer -I../gui -I../../common/include @X_CFLAGS@ @GL_CFLAGS@ -DPVVMUDCLIENT
|
||||
|
||||
noinst_LIBRARIES = libcoreclient.a
|
||||
|
||||
libcoreclient_a_SOURCES = cligos.C cliobject.C \
|
||||
clisrvmanager.C clisrvmessage.C clisrvprotocol.C \
|
||||
cliworld.C cliworldmanager.C cliworldmessage.C cliworldprotocol.C \
|
||||
clientcache.C
|
334
client/coreclient/Makefile.in
Normal file
334
client/coreclient/Makefile.in
Normal file
@@ -0,0 +1,334 @@
|
||||
# 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.. -I../renderer -I../gui -I../../common/include @X_CFLAGS@ @GL_CFLAGS@ -DPVVMUDCLIENT
|
||||
|
||||
noinst_LIBRARIES = libcoreclient.a
|
||||
|
||||
libcoreclient_a_SOURCES = cligos.C cliobject.C clisrvmanager.C clisrvmessage.C clisrvprotocol.C cliworld.C cliworldmanager.C cliworldmessage.C cliworldprotocol.C clientcache.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@
|
||||
libcoreclient_a_LIBADD =
|
||||
libcoreclient_a_OBJECTS = cligos.o cliobject.o clisrvmanager.o \
|
||||
clisrvmessage.o clisrvprotocol.o cliworld.o cliworldmanager.o \
|
||||
cliworldmessage.o cliworldprotocol.o clientcache.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
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
DEP_FILES = .deps/clientcache.P .deps/cligos.P .deps/cliobject.P \
|
||||
.deps/clisrvmanager.P .deps/clisrvmessage.P .deps/clisrvprotocol.P \
|
||||
.deps/cliworld.P .deps/cliworldmanager.P .deps/cliworldmessage.P \
|
||||
.deps/cliworldprotocol.P
|
||||
SOURCES = $(libcoreclient_a_SOURCES)
|
||||
OBJECTS = $(libcoreclient_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 client/coreclient/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:
|
||||
|
||||
libcoreclient.a: $(libcoreclient_a_OBJECTS) $(libcoreclient_a_DEPENDENCIES)
|
||||
-rm -f libcoreclient.a
|
||||
$(AR) cru libcoreclient.a $(libcoreclient_a_OBJECTS) $(libcoreclient_a_LIBADD)
|
||||
$(RANLIB) libcoreclient.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 = client/coreclient
|
||||
|
||||
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 client/coreclient/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:
|
109
client/coreclient/clientcache.C
Normal file
109
client/coreclient/clientcache.C
Normal file
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* 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 <sys/param.h>
|
||||
#include "pvvmud.H"
|
||||
#include "clientcache.H"
|
||||
#include "clisrvmanager.H"
|
||||
#include "msggos.H"
|
||||
|
||||
CCliGeometryCache::CCliGeometryCache(CCliSrvManager * manager){
|
||||
m_manager = manager;
|
||||
}
|
||||
|
||||
CObject * CCliGeometryCache::failFunc(int id){
|
||||
char fileName[MAXPATHLEN];
|
||||
|
||||
#ifdef USE_LOCAL_FILE_CACHE
|
||||
// Load from local cache if file exist
|
||||
sprintf(fileName,"goscache/%i.bog",id);
|
||||
FILE * file = fopen(fileName,"r");
|
||||
if (file != NULL){
|
||||
CGeometry * geo = m_manager->newGeometry(id);
|
||||
geo->readBOG(file);
|
||||
fclose(file);
|
||||
return geo;
|
||||
} else {
|
||||
m_manager->request(GOSREQUEST_GEOMETRY,id);
|
||||
CCache::add(id,NULL);
|
||||
}
|
||||
#else
|
||||
m_manager->request(GOSREQUEST_GEOMETRY,id);
|
||||
CCache::add(id,NULL);
|
||||
#endif // USE_LOCAL_FILE_CACHE
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCliMaterialCache::CCliMaterialCache(CCliSrvManager * manager){
|
||||
m_manager = manager;
|
||||
}
|
||||
|
||||
CObject * CCliMaterialCache::failFunc(int id){
|
||||
char fileName[MAXPATHLEN];
|
||||
|
||||
#ifdef USE_LOCAL_FILE_CACHE
|
||||
// Load from local cache if file exist
|
||||
sprintf(fileName,"goscache/%i.bmat",id);
|
||||
FILE * file = fopen(fileName,"r");
|
||||
if (file != NULL){
|
||||
CMaterial * mat = m_manager->newMaterial(id);
|
||||
mat->load(fileName);
|
||||
fclose(file);
|
||||
return mat;
|
||||
} else {
|
||||
m_manager->request(GOSREQUEST_MATERIAL,id);
|
||||
CCache::add(id,NULL);
|
||||
}
|
||||
#else
|
||||
m_manager->request(GOSREQUEST_MATERIAL,id);
|
||||
CCache::add(id,NULL);
|
||||
#endif // USE_LOCAL_FILE_CACHE
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCliTextureCache::CCliTextureCache(CCliSrvManager * manager){
|
||||
m_manager = manager;
|
||||
}
|
||||
|
||||
CObject * CCliTextureCache::failFunc(int id){
|
||||
char fileName[MAXPATHLEN];
|
||||
|
||||
#ifdef USE_LOCAL_FILE_CACHE
|
||||
// Load from local cache if file exist
|
||||
sprintf(fileName,"goscache/%i.tex",id);
|
||||
FILE * file = fopen(fileName,"r");
|
||||
if (file != NULL){
|
||||
CTexture * tex = m_manager->newTexture(id);
|
||||
tex->load(fileName);
|
||||
fclose(file);
|
||||
return tex;
|
||||
} else {
|
||||
m_manager->request(GOSREQUEST_TEXTURE,id);
|
||||
CCache::add(id,NULL);
|
||||
}
|
||||
#else
|
||||
m_manager->request(GOSREQUEST_TEXTURE,id);
|
||||
CCache::add(id,NULL);
|
||||
#endif // USE_LOCAL_FILE_CACHE
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
50
client/coreclient/clientcache.H
Normal file
50
client/coreclient/clientcache.H
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 _CLIENTCACHE_H
|
||||
#define _CLIENTCACHE_H
|
||||
|
||||
#include "geometry.H"
|
||||
#include "material.H"
|
||||
#include "texture.H"
|
||||
|
||||
class CCliSrvManager;
|
||||
|
||||
class CCliGeometryCache: public CGeometryCache {
|
||||
CCliSrvManager * m_manager;
|
||||
public:
|
||||
CCliGeometryCache(CCliSrvManager * manager);
|
||||
virtual CObject * failFunc(int id);
|
||||
};
|
||||
|
||||
class CCliMaterialCache: public CMaterialCache {
|
||||
CCliSrvManager * m_manager;
|
||||
public:
|
||||
CCliMaterialCache(CCliSrvManager * manager);
|
||||
virtual CObject * failFunc(int id);
|
||||
};
|
||||
|
||||
class CCliTextureCache: public CTextureCache {
|
||||
CCliSrvManager * m_manager;
|
||||
public:
|
||||
CCliTextureCache(CCliSrvManager * manager);
|
||||
virtual CObject * failFunc(int id);
|
||||
};
|
||||
|
||||
#endif // _CLIENTCACHE_H
|
67
client/coreclient/cligos.C
Normal file
67
client/coreclient/cligos.C
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* 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 "pvvmud.H"
|
||||
#include <iostream.h>
|
||||
#include "cligos.H"
|
||||
#include "clisrvmanager.H"
|
||||
#include "glgeometry.H"
|
||||
#include "glmaterial.H"
|
||||
#include "gltexture.H"
|
||||
|
||||
CCliGOS::CCliGOS(CCliSrvManager * manager,CTimeKeeper * timeKeeper,CInetAddress *GOSAddress):CGOS(timeKeeper,GOSAddress){
|
||||
this->manager = manager;
|
||||
}
|
||||
|
||||
void CCliGOS::error(){
|
||||
}
|
||||
|
||||
void CCliGOS::geometry(CGeometry * geometry){
|
||||
manager->addGeometry(geometry);
|
||||
}
|
||||
|
||||
void CCliGOS::material(CMaterial * material){
|
||||
manager->addMaterial(material);
|
||||
}
|
||||
|
||||
void CCliGOS::texture(CTexture * texture){
|
||||
manager->addTexture(texture);
|
||||
}
|
||||
|
||||
CGeometry * CCliGOS::newGeometry(int geometryId, int numVertices,
|
||||
int numNormals, int numTexCoords, int numPolygons){
|
||||
CGeometry * geo = manager->newGeometry(geometryId);
|
||||
geo->setSize(numVertices,numNormals,
|
||||
numTexCoords,numPolygons);
|
||||
return geo;
|
||||
|
||||
// return new CGLGeometry(geometryId,numVertices,numNormals,
|
||||
// numTexCoords,numPolygons);
|
||||
}
|
||||
|
||||
CMaterial * CCliGOS::newMaterial(int materialId){
|
||||
return manager->newMaterial(materialId);
|
||||
// return new CGLMaterial(materialId);
|
||||
}
|
||||
|
||||
CTexture * CCliGOS::newTexture(int textureId){
|
||||
return manager->newTexture(textureId);
|
||||
// return new CGLTexture(textureId);
|
||||
}
|
||||
|
45
client/coreclient/cligos.H
Normal file
45
client/coreclient/cligos.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 _CLIGOS_H
|
||||
#define _CLIGOS_H
|
||||
|
||||
#include "gos.H"
|
||||
|
||||
class CCliSrvManager;
|
||||
|
||||
class CCliGOS : public CGOS {
|
||||
CCliSrvManager * manager;
|
||||
|
||||
public:
|
||||
CCliGOS(CCliSrvManager * manager,CTimeKeeper * timeKeeper,CInetAddress *GOSAddress);
|
||||
|
||||
virtual void error();
|
||||
virtual void geometry(CGeometry * geometry);
|
||||
virtual void material(CMaterial * material);
|
||||
virtual void texture(CTexture * texture);
|
||||
|
||||
virtual CGeometry * newGeometry(int geometryId, int numVertices,
|
||||
int numNormals, int numTexCoords, int numPolygons);
|
||||
virtual CMaterial * newMaterial(int materialId);
|
||||
virtual CTexture * newTexture(int textureId);
|
||||
|
||||
};
|
||||
|
||||
#endif // _CLIGOS_H
|
69
client/coreclient/cliobject.C
Normal file
69
client/coreclient/cliobject.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 "pvvmud.H"
|
||||
#include "cliobject.H"
|
||||
#include "geometry.H"
|
||||
#include "material.H"
|
||||
#include "texture.H"
|
||||
#include "renderer.H"
|
||||
#include "pvvmudclient.H"
|
||||
|
||||
CCliObject::CCliObject(DWORD objectId, CWorldWorld * world, DWORD geometryId,const CPosition & position, const CDirection & direction )
|
||||
:CWorldObject(objectId,world,geometryId,position,direction){
|
||||
|
||||
}
|
||||
|
||||
CCliObject::CCliObject(DWORD objectId, CWorldObject * parent, DWORD geometryId,const CPosition & position, const CDirection & direction )
|
||||
:CWorldObject(objectId,parent,geometryId,position,direction){
|
||||
|
||||
}
|
||||
|
||||
CListener * CCliObject::getListener(){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void CCliObject::draw(CRenderer * renderer){
|
||||
CGeometryCache * objGeoCache = renderer->getClient()->getGeometryCache();
|
||||
CTextureCache * materialCache = renderer->getClient()->getTextureCache();
|
||||
CMaterialCache * textureCache = renderer->getClient()->getMaterialCache();
|
||||
|
||||
CGeometry * objGeo = objGeoCache->get( getGeometryId() );
|
||||
|
||||
renderer->prepareDraw(this);
|
||||
|
||||
renderer->transform(getPosition(), getDirection());
|
||||
|
||||
if (objGeo != NULL) objGeo->draw( textureCache, materialCache);
|
||||
|
||||
CObjectListItem * item = getFirst();
|
||||
while (item != NULL){
|
||||
CCliObject * object = (CCliObject*)item->getObject();
|
||||
item = item->getNext();
|
||||
object->draw( renderer );
|
||||
}
|
||||
|
||||
renderer->postDraw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
38
client/coreclient/cliobject.H
Normal file
38
client/coreclient/cliobject.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 _CLIOBJECT_H
|
||||
#define _CLIOBJECT_H
|
||||
|
||||
#include "worldobject.H"
|
||||
#include "renderer.H"
|
||||
|
||||
class CCliObject : public CWorldObject {
|
||||
|
||||
public:
|
||||
CCliObject(DWORD objectId, CWorldWorld * world, DWORD geometryId,const CPosition & position, const CDirection & direction );
|
||||
CCliObject(DWORD objectId, CWorldObject * parent, DWORD geometryId,const CPosition & position, const CDirection & direction );
|
||||
|
||||
virtual CListener * getListener();
|
||||
|
||||
void draw(CRenderer * renderer);
|
||||
|
||||
};
|
||||
|
||||
#endif // _CLIOBJECT_H
|
302
client/coreclient/clisrvmanager.C
Normal file
302
client/coreclient/clisrvmanager.C
Normal file
@@ -0,0 +1,302 @@
|
||||
/*
|
||||
* 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 "client.H"
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <iostream.h>
|
||||
#include <netinet/in.h>
|
||||
#include "socket.H"
|
||||
#include "clisrvmanager.H"
|
||||
#include "msgsrvcli.H"
|
||||
#include "pvvmudclient.H"
|
||||
|
||||
#include "glgeometry.H"
|
||||
#include "glmaterial.H"
|
||||
#include "gltexture.H"
|
||||
|
||||
CCliSrvManager::CCliSrvManager(CCliSrvProtocol * protocol,CTimeKeeper * timeKeeper):CManager(protocol){
|
||||
m_timeKeeper = timeKeeper;
|
||||
getProtocol()->setName("Server");
|
||||
getProtocol()->setManager(this);
|
||||
m_world = new CCliWorld();
|
||||
m_viewpoint = new CCliViewpoint(m_world);
|
||||
m_cligos = NULL;
|
||||
m_worldsrv = NULL;
|
||||
|
||||
}
|
||||
|
||||
CCliSrvManager::~CCliSrvManager(){
|
||||
if (m_world != NULL) delete m_world;
|
||||
if (m_viewpoint != NULL) delete m_viewpoint;
|
||||
#ifndef TEXTURECACHE_USEFILE
|
||||
if (m_cligos != NULL) delete m_cligos;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CCliSrvManager::setClient(CPvvmudClient * client) {
|
||||
m_client = client;
|
||||
}
|
||||
|
||||
CPvvmudClient * CCliSrvManager::getClient() {
|
||||
return m_client;
|
||||
}
|
||||
|
||||
COption * CCliSrvManager::getOption() {
|
||||
return m_client->getOption();
|
||||
}
|
||||
|
||||
void CCliSrvManager::communicate(){
|
||||
getProtocol()->readyToRead();
|
||||
getProtocol()->readyToWrite();
|
||||
}
|
||||
|
||||
void CCliSrvManager::init(){
|
||||
cdebug << "Client manager init\n";
|
||||
// createStartFrame();
|
||||
}
|
||||
|
||||
void CCliSrvManager::hello(){
|
||||
getProtocol()->login(getOption()->getString("username"),
|
||||
getOption()->getString("passwd"),
|
||||
FALSE); // This is not a new user!
|
||||
}
|
||||
|
||||
void CCliSrvManager::serverInfo(CInetAddress * worldSrvAddress,CInetAddress * gosAddress){
|
||||
|
||||
#ifndef TEXTURECACHE_USEFILE
|
||||
try {
|
||||
|
||||
m_cligos = new CCliGOS(this,m_timeKeeper, gosAddress);
|
||||
cdebug << "Client GOS manager connected.\n";
|
||||
|
||||
} catch (CSocketException * e){
|
||||
|
||||
cdebug << "Failed to connect to GOS\n";
|
||||
m_cligos = NULL;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
try {
|
||||
|
||||
CClientSocket * socket =
|
||||
new CClientSocket(worldSrvAddress->getAddress(),worldSrvAddress->getPort());
|
||||
|
||||
socket->setNonBlocking();
|
||||
cdebug << "Client World manager connected.\n";
|
||||
|
||||
m_worldsrv =
|
||||
new CCliWorldManager(this, new CCliWorldProtocol(socket,m_timeKeeper));
|
||||
|
||||
} catch (CSocketException * e){
|
||||
|
||||
cdebug << "Failed to connect to world server\n";
|
||||
m_worldsrv = NULL;
|
||||
|
||||
}
|
||||
|
||||
if (m_cligos != NULL && m_worldsrv != NULL){
|
||||
// getProtocol()->sendGetWorld();
|
||||
// deleteStartFrame();
|
||||
|
||||
getProtocol()->sendOnline();
|
||||
|
||||
} else {
|
||||
quit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CCliSrvManager::quit(){
|
||||
getProtocol()->bye();
|
||||
}
|
||||
|
||||
void CCliSrvManager::exit(){
|
||||
::exit(0);
|
||||
}
|
||||
|
||||
void CCliSrvManager::changeMasterCellId(DWORD newMasterCellId){
|
||||
m_worldsrv->getProtocol()->sendChangeMasterCell(newMasterCellId);
|
||||
}
|
||||
|
||||
void CCliSrvManager::createStartFrame(){
|
||||
double trans[3];
|
||||
trans[0] = 0; trans[1] = 80; trans[2] = 0;
|
||||
double rot[3];
|
||||
rot[0] = 90; rot[1] = 0; rot[2] = 0;
|
||||
// world->addObject(-1,0,0,trans,rot);
|
||||
}
|
||||
|
||||
void CCliSrvManager::deleteStartFrame(){
|
||||
clearWorld();
|
||||
}
|
||||
|
||||
void CCliSrvManager::animate(){
|
||||
m_world->animate();
|
||||
}
|
||||
|
||||
void CCliSrvManager::draw(CRenderer * renderer){
|
||||
m_world->draw(renderer);
|
||||
}
|
||||
|
||||
void CCliSrvManager::updateViewpoint( const CPosition & position,
|
||||
const CDirection & direction,DWORD targetId ){
|
||||
m_viewpoint->setPosition( position );
|
||||
m_viewpoint->setDirection( direction );
|
||||
m_viewpoint->setTargetId( targetId );
|
||||
cdebug << "Viewpoint: Target: " << targetId << " Pos: " << position
|
||||
<< " Dir: " << direction << "\n";
|
||||
}
|
||||
|
||||
void CCliSrvManager::playerMove( int move ){
|
||||
getProtocol()->sendCommand( move);
|
||||
}
|
||||
|
||||
void CCliSrvManager::playerLook( int look ){
|
||||
getProtocol()->sendCommand( look);
|
||||
}
|
||||
|
||||
void CCliSrvManager::userCommand(int num){
|
||||
if ((num >= USERCOMMAND_1) && (num <= USERCOMMAND_5)){
|
||||
doAction(num - USERCOMMAND_1);
|
||||
} else {
|
||||
getProtocol()->sendCommand( num);
|
||||
}
|
||||
}
|
||||
|
||||
void CCliSrvManager::selection(int objectId){
|
||||
getProtocol()->sendSelection( objectId );
|
||||
}
|
||||
|
||||
void CCliSrvManager::sendMsg( const char * msg ){
|
||||
getProtocol()->sendMsg( msg );
|
||||
}
|
||||
|
||||
void CCliSrvManager::sendPing(){
|
||||
if (m_worldsrv != NULL) m_worldsrv->sendPing();
|
||||
}
|
||||
|
||||
void CCliSrvManager::clearWorld(){
|
||||
m_world->clearWorld();
|
||||
}
|
||||
|
||||
void CCliSrvManager::doAction(int actionNum){
|
||||
cdebug << "Do action " << actionNum+1 << " on object "
|
||||
<< actionObjectId[actionNum] << "\n";
|
||||
getProtocol()->sendAction(actionObjectId[actionNum],actionNum+1);
|
||||
}
|
||||
|
||||
void CCliSrvManager::addAction(int objectId, CAction * action){
|
||||
actionObjectId[action->getId()-1] = objectId;
|
||||
}
|
||||
|
||||
int CCliSrvManager::request(int requestType,int requestId){
|
||||
cdebug << "Request("<<requestType<<") for : " << requestId << "\n";
|
||||
if (m_cligos != NULL) {
|
||||
m_cligos->request(requestType,requestId);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CCliSrvManager::addGeometry(CGeometry * geometry){
|
||||
|
||||
CGeometry * geo = getClient()->getGeometryCache()->add(geometry);
|
||||
if (geo != NULL) delete geo;
|
||||
|
||||
cdebug << "Geometry " << geometry->getId() << " loaded\n";
|
||||
|
||||
#ifdef USE_LOCAL_FILE_CACHE
|
||||
DIR * dir = opendir("goscache");
|
||||
if (dir != NULL){
|
||||
closedir(dir);
|
||||
} else {
|
||||
mkdir("goscache",S_IRWXU);
|
||||
}
|
||||
char fileName[256];
|
||||
sprintf(fileName,"goscache/%i.bog",geometry->getId());
|
||||
geometry->save(fileName);
|
||||
#endif // USE_LOCAL_FILE_CACHE
|
||||
|
||||
}
|
||||
|
||||
void CCliSrvManager::addMaterial(CMaterial * material){
|
||||
|
||||
CMaterial * mat = getClient()->getMaterialCache()->add(material);
|
||||
if (mat != NULL) delete mat;
|
||||
|
||||
cdebug << "Material " << material->getId() << " loaded\n";
|
||||
|
||||
#ifdef USE_LOCAL_FILE_CACHE
|
||||
DIR * dir = opendir("goscache");
|
||||
if (dir != NULL){
|
||||
closedir(dir);
|
||||
} else {
|
||||
mkdir("goscache",S_IRWXU);
|
||||
}
|
||||
char fileName[256];
|
||||
sprintf(fileName,"goscache/%i.bmat",material->getId());
|
||||
material->save(fileName);
|
||||
#endif // USE_LOCAL_FILE_CACHE
|
||||
|
||||
}
|
||||
|
||||
void CCliSrvManager::addTexture(CTexture * texture){
|
||||
|
||||
CTexture * tex = getClient()->getTextureCache()->add(texture);
|
||||
if (tex != NULL) delete tex;
|
||||
|
||||
cdebug << "Texture " << texture->getId() << " loaded\n";
|
||||
|
||||
#ifdef USE_LOCAL_FILE_CACHE
|
||||
DIR * dir = opendir("goscache");
|
||||
if (dir != NULL){
|
||||
closedir(dir);
|
||||
} else {
|
||||
mkdir("goscache",S_IRWXU);
|
||||
}
|
||||
char fileName[256];
|
||||
sprintf(fileName,"goscache/%i.tex",texture->getId());
|
||||
texture->save(fileName);
|
||||
#endif // USE_LOCAL_FILE_CACHE
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CCliSrvManager::dump(){
|
||||
m_world->dump();
|
||||
}
|
||||
|
||||
CGeometry * CCliSrvManager::newGeometry(int geometryId){
|
||||
return new CGLGeometry(geometryId);
|
||||
}
|
||||
|
||||
CMaterial * CCliSrvManager::newMaterial(int materialId){
|
||||
return new CGLMaterial(materialId);
|
||||
}
|
||||
|
||||
CTexture * CCliSrvManager::newTexture(int textureId){
|
||||
return new CGLTexture(textureId);
|
||||
}
|
||||
|
101
client/coreclient/clisrvmanager.H
Normal file
101
client/coreclient/clisrvmanager.H
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* 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 _CLISRVMANAGER_H
|
||||
#define _CLISRVMANAGER_H
|
||||
|
||||
#include "clisrvprotocol.H"
|
||||
#include "cliworld.H"
|
||||
#include "cliviewpoint.H"
|
||||
#include "action.H"
|
||||
#include "manager.H"
|
||||
#include "cligos.H"
|
||||
#include "cliworldmanager.H"
|
||||
#include "option.H"
|
||||
|
||||
|
||||
class CPvvmudClient;
|
||||
class CCliSrvManager: public CManager {
|
||||
CCliWorld * m_world;
|
||||
CCliViewpoint * m_viewpoint;
|
||||
CCliGOS * m_cligos;
|
||||
CCliWorldManager * m_worldsrv;
|
||||
CPvvmudClient * m_client;
|
||||
|
||||
// Action list
|
||||
int actionObjectId[5];
|
||||
CTimeKeeper * m_timeKeeper;
|
||||
|
||||
public:
|
||||
CCliSrvManager(CCliSrvProtocol * protocol,CTimeKeeper * timeKeeper);
|
||||
virtual ~CCliSrvManager();
|
||||
|
||||
CCliSrvProtocol * getProtocol(){ return (CCliSrvProtocol*)CManager::getCommunicate();}
|
||||
CCliWorld* getWorld(){ return m_world; }
|
||||
|
||||
void setClient(CPvvmudClient * client);
|
||||
CPvvmudClient * getClient();
|
||||
COption * getOption();
|
||||
|
||||
void communicate();
|
||||
|
||||
void init();
|
||||
void hello();
|
||||
void serverInfo(CInetAddress * worldSrvAddress,CInetAddress * gosAddress);
|
||||
void quit();
|
||||
void exit();
|
||||
void changeMasterCellId(DWORD newMasterCellId);
|
||||
|
||||
void createStartFrame();
|
||||
void deleteStartFrame();
|
||||
|
||||
void animate();
|
||||
void draw(CRenderer * renderer);
|
||||
|
||||
void updateViewpoint( const CPosition & position,
|
||||
const CDirection & direction,
|
||||
DWORD targetId);
|
||||
|
||||
void playerMove( int move );
|
||||
void playerLook( int look );
|
||||
void userCommand(int num);
|
||||
void selection( int objectId );
|
||||
void sendMsg( const char * msg );
|
||||
void sendPing();
|
||||
|
||||
void clearWorld();
|
||||
void doAction(int actionNum);
|
||||
void addAction(int objectId,CAction * action);
|
||||
|
||||
CCliViewpoint * getViewpoint(){ return m_viewpoint; }
|
||||
int request(int requestType,int requestId);
|
||||
void addGeometry(CGeometry * geometry);
|
||||
void addMaterial(CMaterial * material);
|
||||
void addTexture(CTexture * texture);
|
||||
|
||||
void dump();
|
||||
|
||||
virtual CGeometry * newGeometry(int geometryId);
|
||||
virtual CMaterial * newMaterial(int materialId);
|
||||
virtual CTexture * newTexture(int textureId);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // _CLISRVMANAGER_H
|
309
client/coreclient/clisrvmessage.C
Normal file
309
client/coreclient/clisrvmessage.C
Normal file
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* 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 "pvvmud.H"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "client.H"
|
||||
#include "clisrvmessage.H"
|
||||
#include "clisrvmanager.H"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgHelloCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgHelloCli::CMsgHelloCli():CMsgHello(){
|
||||
}
|
||||
|
||||
CMsgHelloCli * CMsgHelloCli::createMsg(){
|
||||
return new CMsgHelloCli();
|
||||
}
|
||||
|
||||
int CMsgHelloCli::executeMsg(){
|
||||
cdebug << "Hello from server!\n";
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
if (getVersion() != PROTOCOL_VERSION){
|
||||
cdebug << "ERROR: Wrong protocol version!\n";
|
||||
exit(2);
|
||||
}
|
||||
manager->hello();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgServerInfoCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgServerInfoCli::CMsgServerInfoCli():CMsgServerInfo(){
|
||||
}
|
||||
|
||||
CMsgServerInfoCli * CMsgServerInfoCli::createMsg(){
|
||||
return new CMsgServerInfoCli();
|
||||
}
|
||||
|
||||
int CMsgServerInfoCli::executeMsg(){
|
||||
CInetAddress * worldSrvAddress, * gosAddress;
|
||||
worldSrvAddress = getWorldSrvAddress();
|
||||
gosAddress = getGOSAddress();
|
||||
cdebug << "Server info: WorldSrv" << worldSrvAddress->getAddressString() << "GOS" << worldSrvAddress->getAddressString() << " world " << gosAddress->getAddressString() << "\n";
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
manager->serverInfo(worldSrvAddress,gosAddress);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgByeCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgByeCli::CMsgByeCli():CMsgBye(){
|
||||
}
|
||||
|
||||
CMsgByeCli * CMsgByeCli::createMsg(){
|
||||
return new CMsgByeCli();
|
||||
}
|
||||
|
||||
int CMsgByeCli::executeMsg(){
|
||||
cout << "Bye from server: " << getReasonString(getReason()) << "\n";
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
manager->exit();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgGeometryObjectCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgGeometryObjectCli::CMsgGeometryObjectCli():CMsgGeometryObject(){
|
||||
}
|
||||
|
||||
CMsgGeometryObjectCli * CMsgGeometryObjectCli::createMsg(){
|
||||
return new CMsgGeometryObjectCli();
|
||||
}
|
||||
|
||||
int CMsgGeometryObjectCli::executeMsg(){
|
||||
double pos[3],dir[3];
|
||||
cdebug << "New geometryobject(" << getWorldObjectId() << ") from server with geometry(" << getGeometryId() << ") and parent(" << getParentId() << ")!\n",
|
||||
getPosition(pos);
|
||||
getDirection(dir);
|
||||
cdebug ("Pos: %f %f %f Dir: %f %f %f\n",pos[0],pos[1],pos[2],dir[0],dir[1],dir[2]);
|
||||
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
manager->addWorldObject(getParentId(),getWorldObjectId(),
|
||||
getGeometryId(),pos,dir);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgGeoObjRemoveCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgGeoObjRemoveCli::CMsgGeoObjRemoveCli():CMsgGeoObjRemove(){
|
||||
}
|
||||
|
||||
CMsgGeoObjRemoveCli * CMsgGeoObjRemoveCli::createMsg(){
|
||||
return new CMsgGeoObjRemoveCli();
|
||||
}
|
||||
|
||||
int CMsgGeoObjRemoveCli::executeMsg(){
|
||||
cdebug("Remove geometryobject(%i) from parent(%i)\n",getWorldObjectId(),
|
||||
getParentId());
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
manager->removeWorldObject(getWorldObjectId(),getParentId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgUpdatePosition
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgUpdatePositionCli::CMsgUpdatePositionCli():CMsgUpdatePosition(){
|
||||
}
|
||||
|
||||
CMsgUpdatePositionCli * CMsgUpdatePositionCli::createMsg(){
|
||||
return new CMsgUpdatePositionCli();
|
||||
}
|
||||
|
||||
int CMsgUpdatePositionCli::executeMsg(){
|
||||
double pos[3];
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
getPosition(pos);
|
||||
manager->updatePosition(getWorldObjectId(),pos);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgUpdateDirection
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgUpdateDirectionCli::CMsgUpdateDirectionCli():CMsgUpdateDirection(){
|
||||
}
|
||||
|
||||
CMsgUpdateDirectionCli * CMsgUpdateDirectionCli::createMsg(){
|
||||
return new CMsgUpdateDirectionCli();
|
||||
}
|
||||
|
||||
int CMsgUpdateDirectionCli::executeMsg(){
|
||||
double dir[3];
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
getDirection(dir);
|
||||
manager->updateDirection(getWorldObjectId(),dir);
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCommand
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCommandCli::CMsgCommandCli():CMsgCommand(){
|
||||
}
|
||||
|
||||
CMsgCommandCli * CMsgCommandCli::createMsg(){
|
||||
return new CMsgCommandCli();
|
||||
}
|
||||
|
||||
int CMsgCommandCli::executeMsg(){
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
switch(getCommand()){
|
||||
case MSGCOMMAND_CLIENTCLEARWORLD:
|
||||
cdebug << "MsgCommand: Clear world\n";
|
||||
manager->clearWorld();
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgViewpointCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgViewpointCli::CMsgViewpointCli():CMsgViewpoint(){
|
||||
}
|
||||
|
||||
CMsgViewpointCli * CMsgViewpointCli::createMsg(){
|
||||
return new CMsgViewpointCli();
|
||||
}
|
||||
|
||||
int CMsgViewpointCli::executeMsg(){
|
||||
CPosition pos; CDirection dir;
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
getPosition(pos); getDirection(dir);
|
||||
manager->updateViewpoint(pos,dir,getTargetId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgMsgCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgMsgCli::CMsgMsgCli():CMsgMsg(){
|
||||
}
|
||||
|
||||
CMsgMsgCli * CMsgMsgCli::createMsg(){
|
||||
return new CMsgMsgCli();
|
||||
}
|
||||
|
||||
int CMsgMsgCli::executeMsg(){
|
||||
char * msg = (char*)malloc(getMsgLength());
|
||||
getMsg(msg);
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
manager->getClient()->getConsole()->addMsg(msg);
|
||||
cdebug << "MSG: " << msg << "\n";
|
||||
free(msg);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgActionListCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgActionListCli::CMsgActionListCli():CMsgActionList(){
|
||||
}
|
||||
|
||||
CMsgActionListCli * CMsgActionListCli::createMsg(){
|
||||
return new CMsgActionListCli();
|
||||
}
|
||||
|
||||
int CMsgActionListCli::executeMsg(){
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
cdebug << "Action list for object: " << getObjectId() << "\n";
|
||||
CObjectListItem * item = getActionList()->getFirst();
|
||||
while (item != NULL){
|
||||
CAction * action = (CAction*)item->getObject();
|
||||
cdebug << "Action: " << action->getId() << " " << action->getName() << "\n";
|
||||
manager->addAction(getObjectId(),action);
|
||||
item = item->getNext();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgPlayerInfoCli
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgPlayerInfoCli::CMsgPlayerInfoCli():CMsgPlayerInfo(){
|
||||
}
|
||||
|
||||
CMsgPlayerInfoCli * CMsgPlayerInfoCli::createMsg(){
|
||||
return new CMsgPlayerInfoCli();
|
||||
}
|
||||
|
||||
int CMsgPlayerInfoCli::executeMsg(){
|
||||
CCliSrvManager * manager = (CCliSrvManager*)getManager();
|
||||
cdebug << "Player info with mastercell : " << getMasterCellId() << "\n",
|
||||
manager->changeMasterCellId(getMasterCellId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
115
client/coreclient/clisrvmessage.H
Normal file
115
client/coreclient/clisrvmessage.H
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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 _CLISRVMESSAGE_H
|
||||
#define _CLISRVMESSAGE_H
|
||||
|
||||
#include "msgsrvcli.H"
|
||||
#include "msgworld.H"
|
||||
#include "msgmsg.H"
|
||||
#include "msgactionlist.H"
|
||||
#include "pvvmudclient.H"
|
||||
|
||||
class CMsgHelloCli: public CMsgHello {
|
||||
public:
|
||||
CMsgHelloCli();
|
||||
static CMsgHelloCli * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgServerInfoCli: public CMsgServerInfo {
|
||||
public:
|
||||
CMsgServerInfoCli();
|
||||
static CMsgServerInfoCli * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgByeCli: public CMsgBye {
|
||||
public:
|
||||
CMsgByeCli();
|
||||
static CMsgByeCli * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
//class CMsgGeometryObjectCli: public CMsgGeometryObject {
|
||||
//public:
|
||||
// CMsgGeometryObjectCli();
|
||||
// static CMsgGeometryObjectCli * createMsg();
|
||||
// virtual int executeMsg();
|
||||
//};
|
||||
|
||||
//class CMsgGeoObjRemoveCli: public CMsgGeoObjRemove {
|
||||
//public:
|
||||
// CMsgGeoObjRemoveCli();
|
||||
// static CMsgGeoObjRemoveCli * createMsg();
|
||||
// virtual int executeMsg();
|
||||
//};
|
||||
|
||||
//class CMsgUpdatePositionCli: public CMsgUpdatePosition {
|
||||
//public:
|
||||
// CMsgUpdatePositionCli();
|
||||
// static CMsgUpdatePositionCli * createMsg();
|
||||
// virtual int executeMsg();
|
||||
//};
|
||||
|
||||
//class CMsgUpdateDirectionCli: public CMsgUpdateDirection {
|
||||
//public:
|
||||
// CMsgUpdateDirectionCli();
|
||||
// static CMsgUpdateDirectionCli * createMsg();
|
||||
// virtual int executeMsg();
|
||||
//};
|
||||
|
||||
class CMsgCommandCli: public CMsgCommand {
|
||||
public:
|
||||
CMsgCommandCli();
|
||||
static CMsgCommandCli * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgViewpointCli: public CMsgViewpoint {
|
||||
public:
|
||||
CMsgViewpointCli();
|
||||
static CMsgViewpointCli * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgMsgCli: public CMsgMsg {
|
||||
public:
|
||||
CMsgMsgCli();
|
||||
static CMsgMsgCli * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgActionListCli: public CMsgActionList {
|
||||
public:
|
||||
CMsgActionListCli();
|
||||
static CMsgActionListCli * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgPlayerInfoCli: public CMsgPlayerInfo {
|
||||
public:
|
||||
CMsgPlayerInfoCli();
|
||||
static CMsgPlayerInfoCli * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
|
||||
#endif // _CLISRVMESSAGE_H
|
||||
|
75
client/coreclient/clisrvprotocol.C
Normal file
75
client/coreclient/clisrvprotocol.C
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 "pvvmud.H"
|
||||
#include "clisrvprotocol.H"
|
||||
#include "clisrvmessage.H"
|
||||
|
||||
CCliSrvProtocol::CCliSrvProtocol(CSocket * socket,CTimeKeeper * timeKeeper)
|
||||
:CCommunicate(socket,timeKeeper){
|
||||
addMsg((MsgCreateFunc_t)CMsgHelloCli::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgByeCli::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgCommandCli::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgViewpointCli::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgMsgCli::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgActionListCli::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgServerInfoCli::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgPlayerInfoCli::createMsg);
|
||||
}
|
||||
|
||||
void CCliSrvProtocol::login(char * name, char * passwd,BOOL newUser){
|
||||
CMsgLogin * msg = new CMsgLogin(name,passwd,newUser);
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
void CCliSrvProtocol::bye(){
|
||||
CMsgBye * msg = new CMsgBye();
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
void CCliSrvProtocol::sendOnline(){
|
||||
CMsgCommand * msg = new CMsgCommand(MSGCOMMAND_ONLINE);
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
void CCliSrvProtocol::sendGetWorld(){
|
||||
CMsgGetWorld * msg = new CMsgGetWorld();
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
void CCliSrvProtocol::sendCommand(int command){
|
||||
CMsgCommand * msg = new CMsgCommand(command);
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
void CCliSrvProtocol::sendSelection(int objectId){
|
||||
CMsgSelection * msg = new CMsgSelection(objectId);
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
void CCliSrvProtocol::sendAction(int objectId,int actionId){
|
||||
CMsgAction * msg = new CMsgAction(objectId,actionId);
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
||||
void CCliSrvProtocol::sendMsg(const char *msg){
|
||||
CMsgMsg * msgmsg = new CMsgMsg(msg);
|
||||
sendMessage(msgmsg,TRUE);
|
||||
}
|
||||
|
41
client/coreclient/clisrvprotocol.H
Normal file
41
client/coreclient/clisrvprotocol.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 _CLISRVPROTOCOL_H
|
||||
#define _CLISRVPROTOCOL_H
|
||||
|
||||
#include "communicate.H"
|
||||
#include "socket.H"
|
||||
|
||||
class CCliSrvProtocol : public CCommunicate {
|
||||
|
||||
public:
|
||||
CCliSrvProtocol(CSocket * socket,CTimeKeeper * timeKeeper);
|
||||
|
||||
void login(char * name, char * passwd, BOOL newUser);
|
||||
void bye();
|
||||
void sendOnline();
|
||||
void sendGetWorld();
|
||||
void sendCommand(int command);
|
||||
void sendSelection(int objectId);
|
||||
void sendAction(int objectId,int actionId);
|
||||
void sendMsg(const char * msg);
|
||||
};
|
||||
|
||||
#endif // _CLISRVPROTOCOL_H
|
52
client/coreclient/cliworld.C
Normal file
52
client/coreclient/cliworld.C
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 "pvvmud.H"
|
||||
#include "cliworld.H"
|
||||
|
||||
CCliWorld::CCliWorld(){
|
||||
|
||||
}
|
||||
|
||||
CListener * CCliWorld::getListener(){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCliObject * CCliWorld::newObject(char * name, DWORD objectId,
|
||||
CWorldObject * parent, DWORD geometryId,
|
||||
const CPosition & position, const CDirection & direction )
|
||||
{
|
||||
|
||||
if (parent == NULL){
|
||||
return new CCliObject(objectId,this,geometryId,position,direction);
|
||||
}
|
||||
|
||||
return new CCliObject(objectId,parent,geometryId,position,direction);
|
||||
|
||||
}
|
||||
|
||||
void CCliWorld::draw(CRenderer * renderer){
|
||||
CObjectListItem * item = getFirst();
|
||||
while (item != NULL){
|
||||
CCliObject * cell = (CCliObject*)item->getObject();
|
||||
item = item->getNext();
|
||||
cell->draw( renderer );
|
||||
}
|
||||
}
|
||||
|
39
client/coreclient/cliworld.H
Normal file
39
client/coreclient/cliworld.H
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 _CLIWORLD_H
|
||||
#define _CLIWORLD_H
|
||||
|
||||
#include "worldworld.H"
|
||||
#include "cliobject.H"
|
||||
#include "renderer.H"
|
||||
|
||||
class CCliWorld : public CWorldWorld {
|
||||
|
||||
public:
|
||||
CCliWorld();
|
||||
|
||||
virtual CCliObject * newObject(char * name,DWORD objectId, CWorldObject * parent, DWORD geometryId,const CPosition & position, const CDirection & direction );
|
||||
|
||||
virtual CListener * getListener();
|
||||
|
||||
void draw(CRenderer * renderer);
|
||||
};
|
||||
|
||||
#endif // _CLIWORLD_H
|
92
client/coreclient/cliworldmanager.C
Normal file
92
client/coreclient/cliworldmanager.C
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 "client.H"
|
||||
#include <iostream.h>
|
||||
#include "cliworldmanager.H"
|
||||
#include "clisrvmanager.H"
|
||||
#include "msgsrvcli.H"
|
||||
|
||||
CCliWorldManager::CCliWorldManager(CCliSrvManager * client, CCliWorldProtocol * protocol):CManager(protocol){
|
||||
m_client = client;
|
||||
getProtocol()->setName("World");
|
||||
|
||||
m_pingPong = new CPingPong(MAXPINGPONG);
|
||||
m_pingCounter = 0;
|
||||
m_pingCounterMax = 0;
|
||||
|
||||
}
|
||||
|
||||
CCliWorldManager::~CCliWorldManager(){
|
||||
delete m_pingPong;
|
||||
}
|
||||
|
||||
CCliWorldProtocol * CCliWorldManager::getProtocol(){
|
||||
return (CCliWorldProtocol*)CManager::getCommunicate();
|
||||
}
|
||||
|
||||
CCliWorld * CCliWorldManager::getWorld(){
|
||||
return m_client->getWorld();
|
||||
}
|
||||
|
||||
void CCliWorldManager::quit(){
|
||||
cdebug << "Connection to world server lost!\n";
|
||||
}
|
||||
|
||||
void CCliWorldManager::hello(){
|
||||
cdebug << "Hello from world server!\n";
|
||||
}
|
||||
|
||||
void CCliWorldManager::sendPing(){
|
||||
m_pingCounter++;
|
||||
|
||||
if (m_pingCounter > m_pingCounterMax){
|
||||
if (m_pingCounterMax < MAXPINGPONG)
|
||||
m_pingCounterMax = m_pingCounter;
|
||||
m_pingCounter = 0;
|
||||
|
||||
DWORD sendTime = getWorld()->getTime();
|
||||
|
||||
BYTE sequenceNumber = m_pingPong->sendPing(sendTime);
|
||||
|
||||
cout << "PING: " << (int)sequenceNumber
|
||||
<< " time " << sendTime << endl;
|
||||
|
||||
CCliWorldProtocol * protocol = getProtocol();
|
||||
protocol->sendMessage(new CMsgPing( sequenceNumber ),TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
void CCliWorldManager::pong(BYTE sequenceNumber, DWORD serverTime){
|
||||
DWORD reciveTime = getWorld()->getTime();
|
||||
|
||||
long timediff = m_pingPong->recivePong(reciveTime,sequenceNumber,serverTime);
|
||||
|
||||
cout << "PONG: sequence number " << (int)sequenceNumber
|
||||
<< " serverTime " << serverTime
|
||||
<< " recive time " << reciveTime
|
||||
<< " time diff " << timediff << endl;
|
||||
|
||||
cout << "Ping info " << *m_pingPong << endl;
|
||||
|
||||
getWorld()->fixTime(timediff);
|
||||
|
||||
}
|
||||
|
||||
|
56
client/coreclient/cliworldmanager.H
Normal file
56
client/coreclient/cliworldmanager.H
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 _CLIWORLDMANAGER_H
|
||||
#define _CLIWORLDMANAGER_H
|
||||
|
||||
#include "manager.H"
|
||||
#include "cliworldprotocol.H"
|
||||
#include "cliworld.H"
|
||||
#include "pingpong.H"
|
||||
|
||||
|
||||
class CCliSrvManager;
|
||||
|
||||
class CCliWorldManager : public CManager {
|
||||
|
||||
CCliSrvManager * m_client;
|
||||
|
||||
CPingPong * m_pingPong;
|
||||
int m_pingCounter;
|
||||
int m_pingCounterMax;
|
||||
|
||||
|
||||
public:
|
||||
CCliWorldManager(CCliSrvManager * client, CCliWorldProtocol * protocol);
|
||||
virtual ~CCliWorldManager();
|
||||
|
||||
CCliWorldProtocol * getProtocol();
|
||||
|
||||
CCliWorld * getWorld();
|
||||
|
||||
virtual void quit();
|
||||
|
||||
void hello();
|
||||
void sendPing();
|
||||
void pong(BYTE sequenceNumber, DWORD serverTime);
|
||||
|
||||
};
|
||||
|
||||
#endif // _CLIWORLDMANAGER_H
|
234
client/coreclient/cliworldmessage.C
Normal file
234
client/coreclient/cliworldmessage.C
Normal file
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* 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 "pvvmud.H"
|
||||
#include <iostream.h>
|
||||
#include "cliworldmessage.H"
|
||||
#include "cliworldmanager.H"
|
||||
|
||||
CMsgCliWorldHello::CMsgCliWorldHello():CMsgHello(){
|
||||
}
|
||||
|
||||
CMsgCliWorldHello * CMsgCliWorldHello::createMsg(){
|
||||
return new CMsgCliWorldHello();
|
||||
}
|
||||
|
||||
|
||||
int CMsgCliWorldHello::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
if (getVersion() != PROTOCOL_VERSION){
|
||||
cdebug << "ERROR: Wrong protocol version!\n";
|
||||
exit(2);
|
||||
}
|
||||
manager->hello();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldCell
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldCell::CMsgCliWorldCell():CMsgCell(){
|
||||
}
|
||||
|
||||
CMsgCliWorldCell * CMsgCliWorldCell::createMsg(){
|
||||
return new CMsgCliWorldCell();
|
||||
}
|
||||
|
||||
int CMsgCliWorldCell::executeMsg(){
|
||||
cdebug << "Cell " << getCellId() << " with geometry " << getGeometryId()
|
||||
<< " with position " << getPosition() <<"\n";
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
CWorldObject * cell = manager->getWorld()->addCell(getCellId(),getGeometryId());
|
||||
cell->setPosition(getPosition());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldRemoveCell
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldRemoveCell::CMsgCliWorldRemoveCell():CMsgRemoveCell(){
|
||||
}
|
||||
|
||||
CMsgCliWorldRemoveCell * CMsgCliWorldRemoveCell::createMsg(){
|
||||
return new CMsgCliWorldRemoveCell();
|
||||
}
|
||||
|
||||
int CMsgCliWorldRemoveCell::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->removeCell(getCellId());
|
||||
return TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldObject
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldObject::CMsgCliWorldObject():CMsgObject(){
|
||||
}
|
||||
|
||||
CMsgCliWorldObject * CMsgCliWorldObject::createMsg(){
|
||||
return new CMsgCliWorldObject();
|
||||
}
|
||||
|
||||
int CMsgCliWorldObject::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
cdebug << "Object " << getObjectId() << " with parent " << getParentId() << " with geometry " << getGeometryId()
|
||||
<< " with position " << getPosition() <<" with direction " << getDirection() << "\n";
|
||||
if (manager->getWorld()->createObject(getParentId(),"object",getObjectId(),
|
||||
getGeometryId(),getPosition(),
|
||||
getDirection())==NULL){
|
||||
cdebug << "Failed to create object " << getObjectId() << "\n";
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldRemoveObject
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldRemoveObject::CMsgCliWorldRemoveObject():CMsgRemoveObject(){
|
||||
}
|
||||
|
||||
CMsgCliWorldRemoveObject * CMsgCliWorldRemoveObject::createMsg(){
|
||||
return new CMsgCliWorldRemoveObject();
|
||||
}
|
||||
|
||||
int CMsgCliWorldRemoveObject::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
cdebug << "REMOVE : Object: " << getObjectId() << " Parent: " << getParentId() << "\n";
|
||||
manager->getWorld()->removeObject(getObjectId(),getParentId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldUpdatePosition
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldUpdatePosition::CMsgCliWorldUpdatePosition():CMsgUpdatePosition(){
|
||||
}
|
||||
|
||||
CMsgCliWorldUpdatePosition * CMsgCliWorldUpdatePosition::createMsg(){
|
||||
return new CMsgCliWorldUpdatePosition();
|
||||
}
|
||||
|
||||
int CMsgCliWorldUpdatePosition::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->updatePosition(getObjectId(),getPosition());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldUpdateDirection
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldUpdateDirection::CMsgCliWorldUpdateDirection():CMsgUpdateDirection(){
|
||||
}
|
||||
|
||||
CMsgCliWorldUpdateDirection * CMsgCliWorldUpdateDirection::createMsg(){
|
||||
return new CMsgCliWorldUpdateDirection();
|
||||
}
|
||||
|
||||
int CMsgCliWorldUpdateDirection::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->updateDirection(getObjectId(),getDirection());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldUpdateHierarchy
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldUpdateHierarchy::CMsgCliWorldUpdateHierarchy():CMsgUpdateHierarchy(){
|
||||
}
|
||||
|
||||
CMsgCliWorldUpdateHierarchy * CMsgCliWorldUpdateHierarchy::createMsg(){
|
||||
return new CMsgCliWorldUpdateHierarchy();
|
||||
}
|
||||
|
||||
int CMsgCliWorldUpdateHierarchy::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->updateHierarchy(getObjectId(),getParentId());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldPong
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldPong::CMsgCliWorldPong():CMsgPong(){
|
||||
}
|
||||
|
||||
CMsgCliWorldPong * CMsgCliWorldPong::createMsg(){
|
||||
return new CMsgCliWorldPong();
|
||||
}
|
||||
|
||||
int CMsgCliWorldPong::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->pong(getSequenceNumber(),getServerTime());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CMsgCliWorldRotate
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CMsgCliWorldRotate::CMsgCliWorldRotate():CMsgRotate(){
|
||||
}
|
||||
|
||||
CMsgCliWorldRotate * CMsgCliWorldRotate::createMsg(){
|
||||
return new CMsgCliWorldRotate();
|
||||
}
|
||||
|
||||
int CMsgCliWorldRotate::executeMsg(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->getWorld()->rotate(getObjectId(),getAngleSpeed());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
100
client/coreclient/cliworldmessage.H
Normal file
100
client/coreclient/cliworldmessage.H
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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 _CLIWORLDMESSAGE_H
|
||||
#define _CLIWORLDMESSAGE_H
|
||||
|
||||
#include "msgsrvcli.H"
|
||||
#include "msgworld.H"
|
||||
|
||||
class CMsgCliWorldHello : public CMsgHello {
|
||||
public:
|
||||
CMsgCliWorldHello();
|
||||
static CMsgCliWorldHello * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
/*
|
||||
class CMsgCliWorldCell : public CMsgCell {
|
||||
public:
|
||||
CMsgCliWorldCell();
|
||||
static CMsgCliWorldCell * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgCliWorldRemoveCell : public CMsgRemoveCell {
|
||||
public:
|
||||
CMsgCliWorldRemoveCell();
|
||||
static CMsgCliWorldRemoveCell * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
*/
|
||||
|
||||
class CMsgCliWorldObject : public CMsgObject {
|
||||
public:
|
||||
CMsgCliWorldObject();
|
||||
static CMsgCliWorldObject * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgCliWorldRemoveObject : public CMsgRemoveObject {
|
||||
public:
|
||||
CMsgCliWorldRemoveObject();
|
||||
static CMsgCliWorldRemoveObject * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgCliWorldUpdatePosition: public CMsgUpdatePosition {
|
||||
public:
|
||||
CMsgCliWorldUpdatePosition();
|
||||
static CMsgCliWorldUpdatePosition * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgCliWorldUpdateDirection: public CMsgUpdateDirection {
|
||||
public:
|
||||
CMsgCliWorldUpdateDirection();
|
||||
static CMsgCliWorldUpdateDirection * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgCliWorldUpdateHierarchy: public CMsgUpdateHierarchy {
|
||||
public:
|
||||
CMsgCliWorldUpdateHierarchy();
|
||||
static CMsgCliWorldUpdateHierarchy * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgCliWorldPong: public CMsgPong {
|
||||
public:
|
||||
CMsgCliWorldPong();
|
||||
static CMsgCliWorldPong * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
class CMsgCliWorldRotate: public CMsgRotate {
|
||||
public:
|
||||
CMsgCliWorldRotate();
|
||||
static CMsgCliWorldRotate * createMsg();
|
||||
virtual int executeMsg();
|
||||
};
|
||||
|
||||
|
||||
#endif // _CLIWORLDMESSAGE_H
|
||||
|
49
client/coreclient/cliworldprotocol.C
Normal file
49
client/coreclient/cliworldprotocol.C
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 "client.H"
|
||||
#include "cliworldprotocol.H"
|
||||
#include "cliworldmanager.H"
|
||||
#include "cliworldmessage.H"
|
||||
#include "msgworld.H"
|
||||
|
||||
|
||||
CCliWorldProtocol::CCliWorldProtocol(CSocket * socket, CTimeKeeper * timeKeeper):CCommunicate(socket,timeKeeper){
|
||||
addMsg((MsgCreateFunc_t)CMsgCliWorldHello::createMsg);
|
||||
// addMsg((MsgCreateFunc_t)CMsgCliWorldCell::createMsg);
|
||||
// addMsg((MsgCreateFunc_t)CMsgCliWorldRemoveCell::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgCliWorldObject::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgCliWorldRemoveObject::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgCliWorldUpdatePosition::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgCliWorldUpdateDirection::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgCliWorldUpdateHierarchy::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgCliWorldPong::createMsg);
|
||||
addMsg((MsgCreateFunc_t)CMsgCliWorldRotate::createMsg);
|
||||
}
|
||||
|
||||
void CCliWorldProtocol::quit(){
|
||||
CCliWorldManager * manager = (CCliWorldManager*)getManager();
|
||||
manager->quit();
|
||||
}
|
||||
|
||||
void CCliWorldProtocol::sendChangeMasterCell(DWORD newMasterCellId){
|
||||
CMsgChangeMasterCell * msg = new CMsgChangeMasterCell(newMasterCellId);
|
||||
sendMessage(msg,TRUE);
|
||||
}
|
||||
|
37
client/coreclient/cliworldprotocol.H
Normal file
37
client/coreclient/cliworldprotocol.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 _CLIWORLDPROTOCOL_H
|
||||
#define _CLIWORLDPROTOCOL_H
|
||||
|
||||
#include "communicate.H"
|
||||
|
||||
class CCliWorldProtocol : public CCommunicate {
|
||||
|
||||
public:
|
||||
CCliWorldProtocol(CSocket * socket, CTimeKeeper * timeKeeper);
|
||||
|
||||
virtual void quit();
|
||||
|
||||
// Messages
|
||||
void sendChangeMasterCell(DWORD newMasterCellId);
|
||||
|
||||
};
|
||||
|
||||
#endif // _CLIWORLDPROTOCOL_H
|
Reference in New Issue
Block a user