From 284572e8f3f7d427ca18f4b18740bbb6e311b179 Mon Sep 17 00:00:00 2001 From: driAn Date: Sun, 23 Dec 2007 10:29:21 +0000 Subject: [PATCH] spectator mode fixes git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@1473 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/clients2c.cpp | 7 ++++++- source/src/command.cpp | 1 - source/src/rendergl.cpp | 2 +- source/src/tools.cpp | 2 ++ source/src/tools.h | 2 ++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index 0b2a9874..1cc05783 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -118,7 +118,12 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) player1->clientnum = mycn; // we are now fully connected joining = getint(p); if(getint(p) > 0) conoutf("INFO: this server is password protected"); - if(joining<0 && getclientmap()[0]) changemap(getclientmap()); // we are the first client on this server, set map + if(joining<0 && getclientmap()[0]) // we are the first client on this server, set map + { + string mode; + itoa(mode, gamemode); + callvote(SA_MAP, getclientmap(), mode); // FIXME + } break; } diff --git a/source/src/command.cpp b/source/src/command.cpp index 2e490b3e..1801a881 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -3,7 +3,6 @@ #include "cube.h" -void itoa(char *s, int i) { s_sprintf(s)("%d", i); } char *exchangestr(char *o, char *n) { delete[] o; return newstring(n); } int execcontext = IEXC_CORE; diff --git a/source/src/rendergl.cpp b/source/src/rendergl.cpp index feedc591..ba8aeaa2 100644 --- a/source/src/rendergl.cpp +++ b/source/src/rendergl.cpp @@ -275,7 +275,7 @@ void recomputecamera() playerent *p = players[player1->followplayercn]; static physent followcam; static playerent *lastplayer; - if(lastplayer != p) + if(lastplayer != p || &followcam != camera1) { followcam = *(playerent*)p; followcam.type = ENT_CAMERA; diff --git a/source/src/tools.cpp b/source/src/tools.cpp index 9de952a4..74de3fec 100644 --- a/source/src/tools.cpp +++ b/source/src/tools.cpp @@ -246,6 +246,7 @@ bool cmpf(char *fn, enet_uint32 c) void endianswap(void *memory, int stride, int length) // little endian as storage format { +#ifdef SDL_BYTEORDER #if SDL_BYTEORDER == SDL_BIG_ENDIAN loop(w, length) loop(i, stride/2) { @@ -255,4 +256,5 @@ void endianswap(void *memory, int stride, int length) // little endian as stor p[stride-i-1] = t; } #endif +#endif } diff --git a/source/src/tools.h b/source/src/tools.h index b25e7fba..6af5482f 100644 --- a/source/src/tools.h +++ b/source/src/tools.h @@ -457,6 +457,8 @@ template struct hashtable } }; +#define itoa(s, i) { s_sprintf(s)("%d", i); } + #define enumeratekt(ht,k,e,t,f,b) loopi((ht).size) for(hashtable::chain *enumc = (ht).table[i]; enumc; enumc = enumc->next) { hashtable::const_key &e = enumc->key; t &f = enumc->data; b; } #define enumerate(ht,t,e,b) loopi((ht).size) for((ht).enumc = (ht).table[i]; (ht).enumc; (ht).enumc = (ht).enumc->next) { t &e = (ht).enumc->data; b; } #define enumerateht(ht) loopi((ht).size) for((ht).enumc = (ht).table[i]; (ht).enumc; (ht).enumc = (ht).enumc->next)