You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(136) |
Dec
(218) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(214) |
Feb
(208) |
Mar
(186) |
Apr
(15) |
May
(3) |
Jun
(35) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(58) |
Aug
(123) |
Sep
(31) |
Oct
(9) |
Nov
|
Dec
(1) |
2006 |
Jan
(25) |
Feb
(10) |
Mar
(25) |
Apr
(61) |
May
|
Jun
(78) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/timewarp/source/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10278/source/util Modified Files: aastr.c base.h errors.cpp errors.h errors_c.c get_time.c get_time.h types.cpp Added Files: profile.cpp profile.h profile2.h Removed Files: t_rarray.h Log Message: removed sintable... again! possible fix for AA div0 bug fixed umgah cone bug tweaked death notification stuff added profiling stuff removed JGMOD dependancy from scp.cpp switch some of my stuff from home-brewed to std::vector more stuff I forgot? --- NEW FILE: profile.cpp --- #include <stdlib.h> #include <stdio.h> #include <string.h> #include <allegro.h> #include "base.h" #include "round.h" #include "errors.h" #include "get_time.h" #include "profile.h" #include "profile2.h" #define SAFE_TIME_FUNC() get_time() #define SAFE_TIME_RATIO 1000.0 #include <algorithm> using namespace std; //static R_Array <DIRECT_PROFILE_DATUM*, 16> _raw_master_profile; static vector<DIRECT_PROFILE_DATUM*> _raw_master_profile; static PROFILE_TIME_TYPE2 _profile_time; static Uint32 _safe_profile_time; static double _time_ratio = -1; static int _last_ratio_update = -1; void init_profiling() { if (!is_time_initialized()) tw_error("init_profiling - you must call init_time() first"); _profile_time = PROFILE_TIME_FUNC(); _safe_profile_time = SAFE_TIME_FUNC(); _time_ratio = 1; _last_ratio_update = _safe_profile_time; } void deinit_profiling() { _time_ratio = -1; } static void update_ratio() { if (_time_ratio == -1) tw_error("update_ratio - forgot to call init_profiling"); Uint32 csafetime = SAFE_TIME_FUNC(); if (_last_ratio_update == csafetime) return; PROFILE_TIME_TYPE2 cprofiletime = PROFILE_TIME_FUNC(); PROFILE_TIME_TYPE2 dtp = (cprofiletime - _profile_time); Uint32 dts = (csafetime - _safe_profile_time); _time_ratio = (double(dts) / double(dtp)) / SAFE_TIME_RATIO; } class _DPD_COMPARE_ALPHA { public: int operator() ( DIRECT_PROFILE_DATUM *a, DIRECT_PROFILE_DATUM *b ) { int r = strcmp(a->srcline->file, b->srcline->file); if (r) return r < 0; r = a->srcline->line - b->srcline->line; if (r) return r > 0; tw_error("this shouldn't happen... (_DPD_COMPARE)"); return r; } }; void _register_profile_datum ( DIRECT_PROFILE_DATUM *data ) { const char *tmp = strstr(data->srcline->file, "source"); if (tmp) data->srcline->file = tmp + 7; int i = _raw_master_profile.size(); //_raw_master_profile.grow(1); //_raw_master_profile[i] = data; _raw_master_profile.push_back(data); stable_sort(&_raw_master_profile[0], &_raw_master_profile[i+1], _DPD_COMPARE_ALPHA() ); } class _PD_COMPARE_ALPHA { public: int operator() ( const PROFILE_DATUM &a, const PROFILE_DATUM &b ) { int r = strcmp(a.srcline->file, b.srcline->file); if (r) return r < 0; r = a.srcline->line - b.srcline->line; if (r) return r > 0; tw_error("this shouldn't happen... (_PD_COMPARE)"); return r; } }; class _PD_COMPARE_TIME { public: int operator() ( const PROFILE_DATUM &a, const PROFILE_DATUM &b ) { return a.time > b.time; } }; Profile::Profile() : total_time(0), active(0), sorted(SORTED_ALPHA) { } Profile::~Profile() { } /* Profile &Profile::operator= ( const Profile &p ) { sorted = p.sorted;//? active = 0;//? total_time = p.total_time; // data.preinit(); // int i = p.data.size(); // data.grow(i); // memcpy(&data[0], &p.data[0], sizeof(PROFILE_DATUM) * i); data = p.data; return *this; } */ Profile &Profile::operator+= ( const Profile &p ) { int i; int mj = 0; bool oo = false; total_time += p.total_time; for (i = 0; i < p.data.size(); i++) { int j; for (j = mj; j < data.size(); j++) { if (p.data[i].srcline == data[j].srcline) { if (j == mj) mj++; break; } } if (j == data.size()) { oo = true; //data.grow(1); data.resize(data.size()+1); data[j].srcline = p.data[i].srcline; data[j].runs = 0; data[j].time = 0; } data[j].runs += p.data[i].runs; data[j].time += p.data[i].time; } if (oo) _sort_alpha(); return *this; } Profile &Profile::operator-= ( const Profile &p ) { int i; int mj = 0; bool oo = false; total_time -= p.total_time; for (i = 0; i < p.data.size(); i++) { int j; for (j = mj; j < data.size(); j++) { if (p.data[i].srcline == data[j].srcline) { if (j == mj) mj++; break; } } if (j == data.size()) { oo = true; // data.grow(1); data.resize(data.size()+1); data[j].srcline = p.data[i].srcline; data[j].runs = 0; data[j].time = 0; } data[j].runs -= p.data[i].runs; data[j].time -= p.data[i].time; } if (oo) _sort_alpha(); return *this; } static Profile *master_profile = NULL; void Profile::_sort_alpha() { stable_sort(&data[0], &data[data.size()], _PD_COMPARE_ALPHA() ); sorted = SORTED_ALPHA; } void Profile::_sort_time() { stable_sort(&data[0], &data[data.size()], _PD_COMPARE_TIME() ); sorted = SORTED_TIME; } void Profile::sort_alpha() {if (sorted != SORTED_ALPHA) _sort_alpha();} void Profile::sort_time() {if (sorted != SORTED_TIME) _sort_time();} void Profile::clear ( ) { int i; for (i = 0; i < data.size(); i++) { data[i].time = 0; data[i].runs = 0; } total_time = 0; } Profile *get_master_profile() { if (!master_profile) master_profile = new Profile(); update_ratio(); int i = _raw_master_profile.size(); int j = master_profile->data.size(); if (i < j) { tw_error("this shouldn't happen (gmp)"); } //if (i > j) master_profile->data.grow(i-j); if (i > j) master_profile->data.resize(i); if (i == j) { master_profile->sort_alpha(); for (j = 0; j < i; j++) { master_profile->data[j].runs = _raw_master_profile[j]->runs; master_profile->data[j].time = _raw_master_profile[j]->time; } } else { for (j = 0; j < i; j++) { master_profile->data[j].srcline = _raw_master_profile[j]->srcline; master_profile->data[j].runs = _raw_master_profile[j]->runs; master_profile->data[j].time = _raw_master_profile[j]->time; } } master_profile->total_time = PROFILE_TIME_FUNC() - _profile_time; return master_profile; } SelectProfile::SelectProfile ( Profile &_data ) : data(_data), temp(NULL) { if (&_data == NULL) tw_error("SelectProfile - NULL profile"); if (_data.active != 0) tw_error("SelectProfile - profile already enabled"); data.sort_alpha(); temp = new Profile(); data.active ++; *temp = *get_master_profile(); } SelectProfile::~SelectProfile () { data -= *temp; data += *get_master_profile(); data.sort_alpha(); data.active --; if (temp) delete temp; } /*void Profile::print ( int i, BITMAP *surface, int x, int y, int c ) { char *tmp; tmp = source_line_to_text ( data[i].srcline ); textprintf ( surface, font, x, y, c, "%3d%% %8d %8d %s", data[i].time * 100.0 / total_time, data[i].runs, int(data[i].time / data[i].runs / 1000), tmp); free(tmp); }*/ int Profile::print ( int i, char *dest, int max ) { if (_time_ratio == -1) {tw_error("Profile::print - forgot to call init_profiling");} if ((i < 0) || (i >= data.size())) { dest[0] = 0; return -1; } const SOURCE_LINE *srcline = data[i].srcline; const char *tmp; tmp = srcline->name;//source_line_to_text ( data[i].srcline ); int runs = data[i].runs; int per = iround(double(data[i].time) * 1000.0 / total_time); if (!runs) runs = 1; #ifdef _MSC_VER int r = _snprintf ( #else int r = snprintf ( #endif dest, max, "%3d.%d%% %8d %8d %s", per / 10, per % 10, iround(data[i].time / double(runs) * _time_ratio * (1000.0 * 1000.0 * 1000)), //1000ths of microseconds data[i].runs, tmp ); //free(tmp); return r; } int bob() { _PROFILE //_STACKTRACE("BOB") // static DIRECT_PROFILE_DATUM _profile_datum = { 1152, "fred", 0, 0, 0 }; // UserStackTraceHelper a( (SOURCE_LINE*) &_profile_datum ); // Profiler b ( _profile_datum ); //STACKTRACE //static const SOURCE_LINE _srcline = { 1152, "fred", 0 }; UserStackTraceHelper _stacktrace_ ( &_srcline ); return 0; } --- NEW FILE: profile.h --- #ifndef _PROFILE_H #define _PROFILE_H #define PROFILE_LEVEL 5 #define PROFILE_STACKTRACE_LEVEL 5 #define PROFILE_TIME_TYPE1 Sint64 #define PROFILE_TIME_TYPE2 Sint64 #define PROFILE_TIME_FUNC() get_time3() #define _PROFILE_STACKTRACE STACKTRACE struct SOURCE_LINE; struct DIRECT_PROFILE_DATUM { SOURCE_LINE *srcline; int runs; PROFILE_TIME_TYPE2 time; }; void _register_profile_datum ( DIRECT_PROFILE_DATUM *data ); struct Profiler { PROFILE_TIME_TYPE1 time; DIRECT_PROFILE_DATUM &data; INLINE Profiler ( DIRECT_PROFILE_DATUM &_data) : time((PROFILE_TIME_TYPE1)PROFILE_TIME_FUNC()), data(_data) { } INLINE ~Profiler() { if (!data.runs) _register_profile_datum ( &data ); data.runs++; data.time += (PROFILE_TIME_TYPE2) (PROFILE_TIME_FUNC() - time); } }; #define _PROFILE static SOURCE_LINE _srcline = { __LINE__, __FILE__, NULL }; static DIRECT_PROFILE_DATUM _profiler_data_ = { &_srcline, 0, 0 }; const Profiler _profiler_ ## __LINE__ ( _profiler_data_ ) ; #define _PROFILE_(A) static SOURCE_LINE _srcline = { __LINE__, __FILE__, A }; static DIRECT_PROFILE_DATUM _profiler_data_ = { &_srcline, 0, 0 }; const Profiler _profiler_ ## __LINE__ ( _profiler_data_ ) ; //#define _PROFILE_STACKTRACE static ProfileData _profiler_data_ ## __LINE__ ( __FILE__, __LINE__ ); const Profiler _profiler_ ## __LINE__ ( & _profiler_data_ ## __LINE__ ) ; #if PROFILE_STACKTRACE_LEVEL >= 1 # define PROFILE_STACKTRACE1 _PROFILE_STACKTRACE1 #else # define PROFILE1 #endif #if PROFILE_STACKTRACE_LEVEL >= 2 # define PROFILE_STACKTRACE2 _PROFILE_STACKTRACE2 #else # define PROFILE2 #endif #if PROFILE_STACKTRACE_LEVEL >= 3 # define PROFILE_STACKTRACE3 _PROFILE_STACKTRACE3 #else # define PROFILE3 #endif #if PROFILE_STACKTRACE_LEVEL >= 4 # define PROFILE_STACKTRACE4 _PROFILE_STACKTRACE4 #else # define PROFILE4 #endif #if PROFILE_STACKTRACE_LEVEL >= 5 # define PROFILE_STACKTRACE5 _PROFILE_STACKTRACE5 #else # define PROFILE5 #endif #if PROFILE_LEVEL >= 1 # define PROFILE1 _PROFILE #else # define PROFILE1 #endif #if PROFILE_LEVEL >= 2 # define PROFILE2 _PROFILE #else # define PROFILE2 #endif #if PROFILE_LEVEL >= 3 # define PROFILE3 _PROFILE #else # define PROFILE3 #endif #if PROFILE_LEVEL >= 4 # define PROFILE4 _PROFILE #else # define PROFILE4 #endif #if PROFILE_LEVEL >= 5 # define PROFILE5 _PROFILE #else # define PROFILE5 #endif //*/ #endif --- NEW FILE: profile2.h --- #include <vector> void init_profiling(); void deinit_profiling(); struct PROFILE_DATUM { const SOURCE_LINE * srcline; int runs; PROFILE_TIME_TYPE2 time; }; class Profile { public: char active; char sorted; enum { SORTED_ALPHA, SORTED_TIME }; std::vector<PROFILE_DATUM> data; public: PROFILE_TIME_TYPE2 total_time; Profile(); ~Profile(); // Profile &operator= (const Profile &p); Profile &operator+=(const Profile &p); Profile &operator-=(const Profile &p); void clear(); int length() const {return data.size();} //int length() const {return data.num();} const PROFILE_DATUM &operator[] ( int i ) const {return data[i];} void _sort_time(); void _sort_alpha(); void sort_time(); //call before reading void sort_alpha(); //call after reading int print ( int index, char *dest, int max ) ; // void print ( int index, BITMAP *surface, int x, int y, int c ); }; Profile *get_master_profile(); class SelectProfile { Profile &data; Profile *temp; PROFILE_TIME_TYPE2 time; public: SelectProfile ( Profile &_data ); ~SelectProfile (); }; Index: aastr.c =================================================================== RCS file: /cvsroot/timewarp/source/util/aastr.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** aastr.c 20 Oct 2003 14:46:14 -0000 1.4 --- aastr.c 14 Feb 2004 13:18:38 -0000 1.5 *************** *** 112,115 **** --- 112,117 ---- } + if ((sw < (1 << (aa_BITS/2))) || (sh < (1 << (aa_BITS/2)))) + return; if ((dw < (1 << (aa_BITS/2))) || (dh < (1 << (aa_BITS/2)))) return; Index: base.h =================================================================== RCS file: /cvsroot/timewarp/source/util/base.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** base.h 10 Jan 2004 22:27:58 -0000 1.6 --- base.h 14 Feb 2004 13:18:38 -0000 1.7 *************** *** 4,12 **** #include "types.h" #ifndef __i386__ ! # if defined(__I386__) || defined(__IA32__) || defined(__ia32__) ! # define __i386__ ! # endif #endif --- 4,22 ---- #include "types.h" + #ifdef _MSC_VER + #define for if (0) ; else for + #ifndef INLINE + #define INLINE __inline + #endif + #else + #ifndef INLINE + #define INLINE inline + #endif + #endif #ifndef __i386__ ! #if defined(__I386__) || defined(__IA32__) || defined(__ia32__) ! #define __i386__ ! #endif #endif Index: errors.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/errors.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** errors.cpp 25 Nov 2003 00:13:08 -0000 1.7 --- errors.cpp 14 Feb 2004 13:18:38 -0000 1.8 *************** *** 2,5 **** --- 2,6 ---- #include <stdio.h> #include <allegro.h> + #include <stdarg.h> #include "../melee.h" *************** *** 8,158 **** - // test GEO. - // creating a looping list of the ## most recent STACKTRACE encounters #if defined DO_STACKTRACE - static const int max_stacklist = 16; // I guess 16 is more than enough. - static const int max_stacktrace = 32; // I guess 32 is more than enough. - static int stacklist_level = 0; // for TRACES in the same subr., the level is inverted cause cleaning-up is inverted... (looks like that anyway) - static int stacklist_current = 0; - static bool stacklist_freeze = false; // this is set to TRUE after a crash by caught_error - static int stacktrace_level = 0; // for TRACES in the same subr., the level is inverted cause cleaning-up is inverted... (looks like that anyway) ! struct StackList { ! const char *file; ! int line; int level; - StackList(); }; ! StackList::StackList() ! { ! file = 0; ! line = 0; ! level = 0; ! } ! ! static StackList stacklist_data[max_stacklist]; ! static StackList stacktrace_data[max_stacklist]; ! ! void add2stacklist(const char *file, int line) ! { ! if (stacklist_freeze) ! return; ! ! stacklist_data[stacklist_current].file = file; ! stacklist_data[stacklist_current].line = line; ! stacklist_data[stacklist_current].level = stacklist_level; ! ! ++stacklist_current; ! if (stacklist_current >= max_stacklist) ! stacklist_current = 0; ! ! ++stacklist_level; ! } ! ! void add2stacktrace(const char *file, int line) ! { ! if (stacklist_freeze) ! return; ! ! stacktrace_data[stacktrace_level].file = file; ! stacktrace_data[stacktrace_level].line = line; ! stacktrace_data[stacktrace_level].level = stacktrace_level; ! ! ++stacktrace_level; ! if (stacktrace_level >= max_stacktrace) ! stacktrace_level = max_stacktrace-1; ! // not neat, just to prevent catastrophy ! ! } ! ! void sub4stacklist() ! { ! if (stacklist_freeze) ! return; ! ! --stacklist_level; ! } ! ! void sub4stacktrace() ! { ! if (stacklist_freeze) ! return; ! ! --stacktrace_level; ! if (stacktrace_level < 0) ! stacktrace_level = 0; ! } ! ! bool get_stacklist_info(int N, const char **filename, int **linenum, int **level) ! { ! int i, k; ! i = stacklist_current; ! k = 0; ! for(;;) ! { ! ++k; ! if (k > N) // find the Nth item (0 = the first) ! break; ! ! --i; // count back to ever older traces ! if (i < 0) ! i = max_stacklist-1; // loop around ! ! if (i == stacklist_current) ! return false; // full loop ! } ! ! // treat this item... ! StackList *s; ! s = &stacklist_data[i]; ! *filename = s->file; ! *linenum = &(s->line); ! *level = &(s->level); ! ! return true; ! } ! ! bool get_stacktrace_info(int N, const char **filename, int **linenum, int **level) ! { ! if ( N >= stacktrace_level) ! return false; ! StackList *s; ! s = &stacktrace_data[N]; ! *filename = s->file; ! *linenum = &(s->line); ! *level = &(s->level); ! return true; } ! ! #endif ! ! ! ! #if defined DO_STACKTRACE ! bool usestacktrace = 0; ! struct StackTraceData { ! const char *file; ! int line; ! }; ! #define MAX_STACKTRACE_LEVELS 64 ! #define MAX_STACKTRACE_LEVELS_MASK (MAX_STACKTRACE_LEVELS-1) ! int _stacktrace_level = 0; ! static StackTraceData _stacktrace_data[MAX_STACKTRACE_LEVELS]; ! UserStackTraceHelper::UserStackTraceHelper(const char *file, int line) { ! _stacktrace_data[_stacktrace_level & MAX_STACKTRACE_LEVELS_MASK].file = file; ! _stacktrace_data[_stacktrace_level & MAX_STACKTRACE_LEVELS_MASK].line = line; ! _stacktrace_level += 1; ! ! // somewhat different info as well: ! add2stacklist(file, line); ! add2stacktrace(file, line); } UserStackTraceHelper::~UserStackTraceHelper() { ! _stacktrace_level -= 1; ! sub4stacklist(); ! sub4stacktrace(); } // why use a class: because it places a count-down automatically at the end --- 9,42 ---- #if defined DO_STACKTRACE ! # define MAX_STACK_LEVELS 64 ! # define MAX_STACK_LEVELS_MASK (MAX_STACK_LEVELS - 1) ! # define MAX_TRACE_LENGTH 64 ! # define MAX_TRACE_LENGTH_MASK (MAX_TRACE_LENGTH - 1) ! ! struct TraceData { ! SOURCE_LINE *srcline; int level; }; ! static int _stack_level = 0; ! static int _trace_calls = 0; ! static SOURCE_LINE *_stack_data[MAX_STACK_LEVELS]; ! static TraceData _trace_data[MAX_TRACE_LENGTH]; ! static void _usth_error() { ! tw_error("Exceeded maximum stacktrace level"); } ! UserStackTraceHelper::UserStackTraceHelper ( SOURCE_LINE *srcline ) { ! int i = (_trace_calls++) & MAX_TRACE_LENGTH_MASK; ! _trace_data[i].srcline = srcline; ! _trace_data[i].level = _stack_level; ! _stack_data[_stack_level++] = srcline; ! if (_stack_level >= MAX_STACK_LEVELS) _usth_error(); } UserStackTraceHelper::~UserStackTraceHelper() { ! _stack_level --; } // why use a class: because it places a count-down automatically at the end *************** *** 161,170 **** int l = 30; int i = 0; ! if (_stacktrace_level < 0) return "\nError in stack trace\n"; // if (_stacktrace_level > 256) return "\n ! if (max > MAX_STACKTRACE_LEVELS) max = MAX_STACKTRACE_LEVELS; ! if (max > _stacktrace_level) max = _stacktrace_level; for (i = 0; i < max; i += 1) { ! l += strlen(_stacktrace_data[(_stacktrace_level-i-1) & MAX_STACKTRACE_LEVELS_MASK].file); l += 25; } --- 45,54 ---- int l = 30; int i = 0; ! if (_stack_level < 0) return "\nError in stack trace\n"; // if (_stacktrace_level > 256) return "\n ! if (max > MAX_STACK_LEVELS) max = MAX_STACK_LEVELS; ! if (max > _stack_level) max = _stack_level; for (i = 0; i < max; i += 1) { ! l += strlen(_stack_data[(_stack_level-i-1) & MAX_STACK_LEVELS_MASK]->file); l += 25; } *************** *** 174,181 **** for (i = 0; i < max; i += 1) { if (i != 0) tmp += sprintf(tmp, "called from"); ! const char *str = _stacktrace_data[(_stacktrace_level-i-1) & MAX_STACKTRACE_LEVELS_MASK].file; const char *tmp2 = strstr(str, "source"); if (tmp2 && tmp2[6]) str = tmp2 + 7; ! int line = _stacktrace_data[(_stacktrace_level-i-1) & MAX_STACKTRACE_LEVELS_MASK].line; tmp += sprintf(tmp, " %s : %d\n", str, line); } --- 58,65 ---- for (i = 0; i < max; i += 1) { if (i != 0) tmp += sprintf(tmp, "called from"); ! const char *str = _stack_data[(_stack_level-i-1) & MAX_STACK_LEVELS_MASK]->file; const char *tmp2 = strstr(str, "source"); if (tmp2 && tmp2[6]) str = tmp2 + 7; ! int line = _stack_data[(_stack_level-i-1) & MAX_STACK_LEVELS_MASK]->line; tmp += sprintf(tmp, " %s : %d\n", str, line); } *************** *** 289,295 **** // add GEO: extern void game_create_errorlog(const char *exitmessage = 0); - add2stacklist(file, line); - add2stacktrace(file, line); - stacklist_freeze = true; #endif --- 173,176 ---- *************** *** 388,392 **** // the following makes calls to subroutines that are monitored; I'll disable // further monitoring by ... - stacklist_freeze = true; int i = tw_alert(error_string, "Okay", "Debug"); if (i == 2) __error_flag |= 1; --- 269,272 ---- Index: errors.h =================================================================== RCS file: /cvsroot/timewarp/source/util/errors.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** errors.h 4 Feb 2004 21:12:00 -0000 1.11 --- errors.h 14 Feb 2004 13:18:38 -0000 1.12 *************** *** 31,49 **** void tw_error_exit(const char* message) ; ! #ifdef DO_STACKTRACE ! extern bool usestacktrace; class UserStackTraceHelper { public: ! UserStackTraceHelper(const char *file, int line); ~UserStackTraceHelper(); }; ! # define STACKTRACE if (usestacktrace != 0) { UserStackTraceHelper _stacktrace_ ## __LINE__ (__FILE__,__LINE__); } ! //# define STACKTRACE UserStackTraceHelper _stacktrace_ ## __LINE__ (__FILE__,__LINE__); // this is defined locally in subroutines, so it's de-allocated on exit of the subroutine. ! //# define STACKTRACE #else # define STACKTRACE #endif - #ifdef DO_STACKTRACE char *get_stack_trace_string(int max); --- 31,63 ---- void tw_error_exit(const char* message) ; ! ! //stacktrace and profiling stuff: ! ! #include "get_time.h" ! ! struct SOURCE_LINE { ! int line; // __LINE__ ! const char *file; // __FILE__ ! const char *name; // NULL or a descriptor string ! }; ! ! #include "profile.h" ! ! #if defined DO_STACKTRACE class UserStackTraceHelper { public: ! UserStackTraceHelper( SOURCE_LINE *srcline); ~UserStackTraceHelper(); }; ! # define STACKTRACE static SOURCE_LINE _srcline = { __LINE__, __FILE__, 0 }; UserStackTraceHelper _stacktrace_ ( &_srcline ); ! //# define STACKTRACE static DIRECT_PROFILE_DATUM _profiler_data_ = { __LINE__, __FILE__, NULL, 0, 0 }; const Profiler _profiler_ ( _profiler_data_ ); UserStackTraceHelper _stacktrace_ ( (SOURCE_LINE*) &_profiler_data_ ); ! # define _STACKTRACE(A) static SOURCE_LINE _srcline = { __LINE__, __FILE__, A }; UserStackTraceHelper _stacktrace_ ( &_srcline ); static DIRECT_PROFILE_DATUM _profiler_data_ = { &_srcline, 0, 0 }; const Profiler _profiler_ ( _profiler_data_ ); ! //# define _STACKTRACE(A) static const SOURCE_LINE _srcline = { __LINE__, __FILE__, A }; UserStackTraceHelper _stacktrace_ ( &_srcline ); // this is defined locally in subroutines, so it's de-allocated on exit of the subroutine. ! char *get_stack_trace_string(int max); #else # define STACKTRACE + # define _STACKTRACE(A) #endif #ifdef DO_STACKTRACE char *get_stack_trace_string(int max); Index: errors_c.c =================================================================== RCS file: /cvsroot/timewarp/source/util/errors_c.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** errors_c.c 29 Jan 2004 21:35:17 -0000 1.6 --- errors_c.c 14 Feb 2004 13:18:38 -0000 1.7 *************** *** 2,5 **** --- 2,6 ---- #include <stdio.h> #include <allegro.h> + #include <stdarg.h> #include "errors.h" Index: get_time.c =================================================================== RCS file: /cvsroot/timewarp/source/util/get_time.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** get_time.c 20 Oct 2003 14:46:14 -0000 1.5 --- get_time.c 14 Feb 2004 13:18:38 -0000 1.6 *************** *** 16,20 **** #ifndef _DEBUG ! # define NO_RDTSC #endif --- 16,20 ---- #ifndef _DEBUG ! //# define NO_RDTSC #endif *************** *** 271,274 **** --- 271,278 ---- static unsigned char timer_attributes = 0; + int is_time_initialized() { + return (timer_attributes & 1); + } + void init_time() { int ms; Index: get_time.h =================================================================== RCS file: /cvsroot/timewarp/source/util/get_time.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** get_time.h 10 Jan 2004 22:27:58 -0000 1.4 --- get_time.h 14 Feb 2004 13:18:38 -0000 1.5 *************** *** 9,12 **** --- 9,14 ---- void deinit_time(); //to de-initialize time stuff + int is_time_initialized(); //returns non-zero if init_time() has been called, otherwise 0 + volatile int get_time(); //to get the current time in milliseconds volatile double get_time2(); //to get the current time in milliseconds at high precision Index: types.cpp =================================================================== RCS file: /cvsroot/timewarp/source/util/types.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** types.cpp 8 Jun 2003 17:55:57 -0000 1.3 --- types.cpp 14 Feb 2004 13:18:38 -0000 1.4 *************** *** 1,4 **** #include "errors.h" - #include "types.h" COMPILE_TIME_ASSERT(sizeof(Uint8 ) == 1); --- 1,5 ---- + #include "base.h" + //#include "types.h" #include "errors.h" COMPILE_TIME_ASSERT(sizeof(Uint8 ) == 1); *************** *** 11,12 **** --- 12,14 ---- COMPILE_TIME_ASSERT(sizeof(Sint32) == 4); COMPILE_TIME_ASSERT(sizeof(Sint64) == 8); + --- t_rarray.h DELETED --- |
From: <or...@us...> - 2004-02-14 13:25:09
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10278/source/melee Modified Files: mframe.cpp mframe.h mgame.cpp mnet1.cpp mnet1.h mview.cpp Log Message: removed sintable... again! possible fix for AA div0 bug fixed umgah cone bug tweaked death notification stuff added profiling stuff removed JGMOD dependancy from scp.cpp switch some of my stuff from home-brewed to std::vector more stuff I forgot? Index: mframe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mframe.cpp 29 Jan 2004 21:20:29 -0000 1.23 --- mframe.cpp 14 Feb 2004 13:18:37 -0000 1.24 *************** *** 395,399 **** void SpaceLocation::death() {STACKTRACE ! } double SpaceLocation::get_angle_ex() const --- 395,399 ---- void SpaceLocation::death() {STACKTRACE ! } double SpaceLocation::get_angle_ex() const *************** *** 500,508 **** } ! void Presence::set_depth(double d) {STACKTRACE _depth = int(floor(ldexp(d, 8))); } ! double Presence::get_depth() {STACKTRACE return ldexp((double)_depth, -8); } --- 500,508 ---- } ! void Presence::set_depth(double d) { _depth = int(floor(ldexp(d, 8))); } ! double Presence::get_depth() { return ldexp((double)_depth, -8); } *************** *** 775,778 **** --- 775,785 ---- } + void SpaceObject::death() {STACKTRACE + if (attributes & ATTRIB_NOTIFY_ON_DEATH) { + physics->object_died(this, NULL); + attributes &= ~ ATTRIB_NOTIFY_ON_DEATH; + } + } + SpaceLine::SpaceLine(SpaceLocation *creator, Vector2 lpos, double langle, double llength, int lcolor) *************** *** 1072,1076 **** } ! void Physics::calculate() {STACKTRACE int i; --- 1079,1083 ---- } ! void Physics::calculate() {_STACKTRACE("Physics::calculate()") int i; *************** *** 1086,1090 **** checksync(); ! {STACKTRACE //move objects for (i = 0; i < num_items; i += 1) { --- 1093,1097 ---- checksync(); ! {_STACKTRACE("Physics::calculate() - item movement") //move objects for (i = 0; i < num_items; i += 1) { *************** *** 1097,1101 **** ! {STACKTRACE //call Presence calculate functions for (i = 0; i < num_presences; i += 1) { --- 1104,1108 ---- ! {_STACKTRACE("Physics::calculate() - presence calculation") //call Presence calculate functions for (i = 0; i < num_presences; i += 1) { *************** *** 1106,1110 **** //call objects calculate functions ! {STACKTRACE for (i = 0; i < num_items; i += 1) { if (item[i]->exists()) item[i]->calculate(); --- 1113,1117 ---- //call objects calculate functions ! {_STACKTRACE("Physics::calculate() - item calculation") for (i = 0; i < num_items; i += 1) { if (item[i]->exists()) item[i]->calculate(); *************** *** 1114,1118 **** //prepare quadrants stuff ! {STACKTRACE for(i = 0; i < QUADS_TOTAL; i += 1) { quadrant[i] = NULL; --- 1121,1125 ---- //prepare quadrants stuff ! {_STACKTRACE("Physics::calculate() - quadrants stuff") for(i = 0; i < QUADS_TOTAL; i += 1) { quadrant[i] = NULL; *************** *** 1133,1142 **** checksync(); //check for collisions collide(); ! checksync(); ! {STACKTRACE //remove presences that have been dead long enough int deleted = 0; --- 1140,1150 ---- checksync(); //check for collisions + {_STACKTRACE("Physics::calculate() - collisions") collide(); ! } checksync(); ! {_STACKTRACE("Physics::calculate() - presence destruction") //remove presences that have been dead long enough int deleted = 0; *************** *** 1164,1168 **** //remove objects that have been dead long enough ! {STACKTRACE int deleted = 0; for(i = 0; i < num_items; i ++) { --- 1172,1176 ---- //remove objects that have been dead long enough ! {_STACKTRACE("Physics::calculate() - item destruction") int deleted = 0; for(i = 0; i < num_items; i ++) { *************** *** 1280,1284 **** #include "../util/pmask.h" ! void Physics::collide() {STACKTRACE int i; PMASKDATA_FLOAT *tmp; --- 1288,1292 ---- #include "../util/pmask.h" ! void Physics::collide() {_STACKTRACE("Physics::collide()") int i; PMASKDATA_FLOAT *tmp; *************** *** 1343,1347 **** return; } ! int Physics::checksum() {STACKTRACE int i; Uint32 g = 0; --- 1351,1355 ---- return; } ! int Physics::checksum() {_STACKTRACE("Physics::checksum") int i; Uint32 g = 0; *************** *** 1393,1395 **** ship_died((Ship*)who, source); } ! } \ No newline at end of file --- 1401,1403 ---- ship_died((Ship*)who, source); } ! } Index: mframe.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mframe.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** mframe.h 10 Jan 2004 22:27:59 -0000 1.13 --- mframe.h 14 Feb 2004 13:18:37 -0000 1.14 *************** *** 301,304 **** --- 301,305 ---- SpaceObject(SpaceLocation *creator, Vector2 opos, double oangle, SpaceSprite *osprite); + virtual void death(); // called after an item is killed SpaceSprite *get_sprite() const {return sprite;} Index: mgame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mgame.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** mgame.cpp 29 Jan 2004 21:20:29 -0000 1.30 --- mgame.cpp 14 Feb 2004 13:18:37 -0000 1.31 *************** *** 299,303 **** } ! int Game::is_local (int channel) {STACKTRACE return (log->get_direction (channel) & Log::direction_write); } --- 299,303 ---- } ! int Game::is_local (int channel) { return (log->get_direction (channel) & Log::direction_write); } *************** *** 337,341 **** } ! void Game::log_char(int channel, char &data) {STACKTRACE if (!log) return; log->log (channel, &data, 1); --- 337,341 ---- } ! void Game::log_char(int channel, char &data) { if (!log) return; log->log (channel, &data, 1); *************** *** 343,347 **** } ! void Game::log_short(int channel, short &data) {STACKTRACE if (!log) return; data = intel_ordering_short(data); --- 343,347 ---- } ! void Game::log_short(int channel, short &data) { if (!log) return; data = intel_ordering_short(data); *************** *** 351,355 **** } ! void Game::log_int(int channel, int &data) {STACKTRACE if (!log) return; data = intel_ordering(data); --- 351,355 ---- } ! void Game::log_int(int channel, int &data) { if (!log) return; data = intel_ordering(data); *************** *** 371,379 **** } ! void Game::animate(Frame *frame) {STACKTRACE Physics::animate(frame); } ! void Game::animate() {STACKTRACE double t = get_time2(); paused_time = 0; --- 371,379 ---- } ! void Game::animate(Frame *frame) {_STACKTRACE("Game::animate(Frame*)") Physics::animate(frame); } ! void Game::animate() {_STACKTRACE("Game::animate(void)") double t = get_time2(); paused_time = 0; *************** *** 426,429 **** --- 426,430 ---- void game_create_errorlog(const char *exitmessage = 0) { + /* STACKTRACE; FILE *f; *************** *** 513,517 **** fclose(f); ! } --- 514,518 ---- fclose(f); ! */ } *************** *** 546,550 **** } ! void Game::do_game_events() {STACKTRACE int i; --- 547,551 ---- } ! void Game::do_game_events() {_STACKTRACE("Game::do_game_events()") int i; *************** *** 640,644 **** ! void Game::calculate() {STACKTRACE int i; double t = get_time2(); --- 641,645 ---- ! void Game::calculate() {_STACKTRACE("Game::calculate") int i; double t = get_time2(); *************** *** 683,687 **** } ! void Game::play() {STACKTRACE set_resolution(window->w, window->h); prepare(); --- 684,688 ---- } ! void Game::play() {_STACKTRACE("Game::play") set_resolution(window->w, window->h); prepare(); *************** *** 696,701 **** } if ((next_tic_time <= time) && (next_render_time > game_time) && game_ready()) { calculate(); ! if (auto_unload) unload_unused_ship_data();//expiremental log->flush(); log->listen(); --- 697,703 ---- } if ((next_tic_time <= time) && (next_render_time > game_time) && game_ready()) { + _STACKTRACE("Game::play - Game physics") calculate(); ! if (auto_unload) unload_unused_ship_data(); log->flush(); log->listen(); *************** *** 713,716 **** --- 715,719 ---- } else if (interpolate_frames || (game_time > next_render_time - msecs_per_render)) { + _STACKTRACE("Game::play - Game rendering") animate(); next_render_time = game_time + msecs_per_render; *************** *** 771,775 **** } ! //#include "mcbodies.h" void Game::fps() {STACKTRACE if ((!log->playback) && ((log->type == Log::log_net1server) || (log->type == Log::log_net1client))) { --- 774,778 ---- } ! #include "../util/profile2.h" void Game::fps() {STACKTRACE if ((!log->playback) && ((log->type == Log::log_net1server) || (log->type == Log::log_net1client))) { *************** *** 847,851 **** } ! void Game::init(Log *_log) {STACKTRACE int i; --- 850,854 ---- } ! void Game::init(Log *_log) {_STACKTRACE("Game::init") int i; Index: mnet1.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mnet1.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mnet1.cpp 29 Jan 2004 21:20:29 -0000 1.8 --- mnet1.cpp 14 Feb 2004 13:18:37 -0000 1.9 *************** *** 154,158 **** len = buffy[0] + (buffy[1] << 8) + (buffy[2] << 16) + (buffy[3] << 24); if (len & 0x80000000) { ! handle_code(len); return; } --- 154,159 ---- len = buffy[0] + (buffy[1] << 8) + (buffy[2] << 16) + (buffy[3] << 24); if (len & 0x80000000) { ! //handle_code(len); ! tw_error("NetLog::recv_packet - this shouldn't happen"); return; } *************** *** 182,226 **** } ! void NetLog::send_code(unsigned int code) { ! STACKTRACE; ! if (!(code & 0x80000000)) { tw_error ("NetLog::send_special -- bade code!"); } ! net.send(sizeof(unsigned int), &code); ! return; ! } ! void NetLog::send_message(char *string) {STACKTRACE; ! int i; ! i = sprintf((char*)&buffy[4], "remote: %s", string); ! if (i > 1000) { tw_error ("net1_send_message -- message length exceeds maximum"); } ! buffy[0] = i & 255; ! buffy[1] = (i >> 8) & 255; ! buffy[2] = (NET1_CODE_MESSAGE >> 16) & 255; ! buffy[3] = (NET1_CODE_MESSAGE >> 24) & 255; ! net.send(i+4, &buffy); ! message.out((char*)&buffy[4], 5000, 9); ! return; ! } ! void NetLog::handle_code(unsigned int code) {STACKTRACE ! switch (code & 0xF0000000) { ! case NET1_CODE_QUIT & 0xF0000000: { ! switch (code) { ! case NET1_CODE_QUIT: { ! message.out("Quitting"); ! tw_error ("Quit: recieved quit signal over network"); ! } ! break; ! } ! } ! break; ! case NET1_CODE_MESSAGE: { ! int len = code - NET1_CODE_MESSAGE; ! if (len > 1000) { tw_error ("net1_handle_code -- message length exceeds maximum"); } ! net.recv(len, len, &buffy); ! buffy[len] = 0; ! message.out((char*)buffy, 5000, 10); ! } ! break; ! } ! return; ! } void NetLog::expand_logs(int num_channels) {STACKTRACE --- 183,187 ---- } ! void NetLog::expand_logs(int num_channels) {STACKTRACE Index: mnet1.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mnet1.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mnet1.h 29 Jan 2004 21:20:29 -0000 1.6 --- mnet1.h 14 Feb 2004 13:18:37 -0000 1.7 *************** *** 54,59 **** void expand_logs(int num_channels) ; //intializes these extensions to the logging unsigned char buffy[4096]; //a buffer for sending and recieving packets ! void handle_code(unsigned int code) ; ! void send_code(unsigned int code) ; enum code { NET1_CODE_QUIT = 0x80000001, --- 54,59 ---- void expand_logs(int num_channels) ; //intializes these extensions to the logging unsigned char buffy[4096]; //a buffer for sending and recieving packets ! // void handle_code(unsigned int code) ; ! // void send_code(unsigned int code) ; enum code { NET1_CODE_QUIT = 0x80000001, *************** *** 64,68 **** NET1_CODE_MESSAGE = 0x90000000 }; ! void send_message(char *string) ; void send_packet(); //sends a packet --- 64,68 ---- NET1_CODE_MESSAGE = 0x90000000 }; ! // void send_message(char *string) ; void send_packet(); //sends a packet Index: mview.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mview.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** mview.cpp 29 Jan 2004 21:20:29 -0000 1.15 --- mview.cpp 14 Feb 2004 13:18:37 -0000 1.16 *************** *** 4,7 **** --- 4,8 ---- #include <float.h> #include <allegro.h> + #include <stdarg.h> |
From: <or...@us...> - 2004-02-14 13:25:09
|
Update of /cvsroot/timewarp/source/sc1ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10278/source/sc1ships Modified Files: shpumgdr.cpp Log Message: removed sintable... again! possible fix for AA div0 bug fixed umgah cone bug tweaked death notification stuff added profiling stuff removed JGMOD dependancy from scp.cpp switch some of my stuff from home-brewed to std::vector more stuff I forgot? Index: shpumgdr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpumgdr.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpumgdr.cpp 29 Jan 2004 21:20:31 -0000 1.11 --- shpumgdr.cpp 14 Feb 2004 13:18:38 -0000 1.12 *************** *** 109,113 **** if (!(umgahship && umgahship->exists())) ! umgahship = 0; pos = ship->normal_pos() + (unit_vector(ship->get_angle()) * dist); --- 109,113 ---- if (!(umgahship && umgahship->exists())) ! umgahship = NULL; pos = ship->normal_pos() + (unit_vector(ship->get_angle()) * dist); *************** *** 162,166 **** void UmgahCone::animate(Frame* space) { // calc_base(); ! if (umgahship && umgahship->exists() && !umgahship->firing) return; int si = sprite_index; sprite_index += ((rand()%6) << 6); --- 162,166 ---- void UmgahCone::animate(Frame* space) { // calc_base(); ! if (!umgahship || !umgahship->exists() || !umgahship->firing) return; int si = sprite_index; sprite_index += ((rand()%6) << 6); |
From: <or...@us...> - 2004-02-14 13:25:08
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10278/source Modified Files: melee.h scp.cpp Log Message: removed sintable... again! possible fix for AA div0 bug fixed umgah cone bug tweaked death notification stuff added profiling stuff removed JGMOD dependancy from scp.cpp switch some of my stuff from home-brewed to std::vector more stuff I forgot? Index: melee.h =================================================================== RCS file: /cvsroot/timewarp/source/melee.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** melee.h 10 Jan 2004 22:27:58 -0000 1.12 --- melee.h 14 Feb 2004 13:18:37 -0000 1.13 *************** *** 509,513 **** int sindex); ! inline int frames() const {return count;} // changed Rob. Vector2 size(int i = 0) const;// const {return Vector2(b[0][i]->w, b[0][i]->h);} --- 509,513 ---- int sindex); ! INLINE int frames() const {return count;} // changed Rob. Vector2 size(int i = 0) const;// const {return Vector2(b[0][i]->w, b[0][i]->h);} Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** scp.cpp 7 Feb 2004 07:43:38 -0000 1.48 --- scp.cpp 14 Feb 2004 13:18:37 -0000 1.49 *************** *** 56,59 **** --- 56,60 ---- #include "util/get_time.h" + #include "util/profile2.h" #include "melee/mview.h" *************** *** 73,79 **** #include "util/sounds.h" - #ifndef NO_JGMOD - #include "jgmod.h" - #endif //deprecated. This mode of using dat files is terrible, I can't believe --- 74,77 ---- *************** *** 238,249 **** if (!scp) tw_error("Couldnt load title music"); ! ! #ifndef NO_JGMOD ! Music * mymusic = load_mod("TitleScreen.dat#TITLEMUSIC"); if (!mymusic) tw_error("Couldnt load title music"); sound.play_music( mymusic, TRUE); ! #endif {DATAFILE * data = load_datafile_object("TitleScreen.dat", "MENUACCEPT"); if (data != NULL && data->type==DAT_SAMPLE) { --- 236,249 ---- if (!scp) tw_error("Couldnt load title music"); ! ! Music * mymusic = sound.load_music("TitleScreen.dat#TITLEMUSIC"); ! ! //Music * mymusic = load_mod("scpgui.dat#SCPMUSIC"); ! if (!mymusic) tw_error("Couldnt load title music"); sound.play_music( mymusic, TRUE); ! {DATAFILE * data = load_datafile_object("TitleScreen.dat", "MENUACCEPT"); if (data != NULL && data->type==DAT_SAMPLE) { *************** *** 773,779 **** set_config_file("client.ini"); ! #ifdef DO_STACKTRACE ! usestacktrace = get_config_int("System", "UseStack", 0); ! #endif int screen_width = 640, screen_height = 480, screen_bpp = 32; --- 773,778 ---- set_config_file("client.ini"); ! init_time(); ! init_profiling(); int screen_width = 640, screen_height = 480, screen_bpp = 32; *************** *** 877,881 **** init_ships(); init_fleet(); - init_time(); meleedata.init();//mainmain --- 876,879 ---- |
From: <or...@us...> - 2004-02-14 13:25:08
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10278/source/newships Modified Files: shpayrbs.cpp Log Message: removed sintable... again! possible fix for AA div0 bug fixed umgah cone bug tweaked death notification stuff added profiling stuff removed JGMOD dependancy from scp.cpp switch some of my stuff from home-brewed to std::vector more stuff I forgot? Index: shpayrbs.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpayrbs.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpayrbs.cpp 29 Jan 2004 21:20:29 -0000 1.18 --- shpayrbs.cpp 14 Feb 2004 13:18:38 -0000 1.19 *************** *** 9,12 **** --- 9,13 ---- #include "../frame.h" #include "../other/shippart.h" + #include "../util/aastr.h" *************** *** 602,606 **** b = spr->get_bitmap(sprite_index); ! masked_stretch_blit(b, space->surface, 0, 0, b->w, b->h, iround(P.x), iround(P.y), iround(W.x), iround(W.y)); space->add_box(P.x, P.y, W.x, W.y); } --- 603,608 ---- b = spr->get_bitmap(sprite_index); ! //masked_stretch_blit(b, space->surface, 0, 0, b->w, b->h, iround(P.x), iround(P.y), iround(W.x), iround(W.y)); ! aa_stretch_sprite(b, space->surface, iround(P.x), iround(P.y), iround(W.x), iround(W.y)); space->add_box(P.x, P.y, W.x, W.y); } |
From: <or...@us...> - 2004-02-14 13:25:08
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10278/source/games Modified Files: gtrug.cpp gtrug.h Log Message: removed sintable... again! possible fix for AA div0 bug fixed umgah cone bug tweaked death notification stuff added profiling stuff removed JGMOD dependancy from scp.cpp switch some of my stuff from home-brewed to std::vector more stuff I forgot? Index: gtrug.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gtrug.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gtrug.cpp 29 Jan 2004 21:20:28 -0000 1.7 --- gtrug.cpp 14 Feb 2004 13:18:37 -0000 1.8 *************** *** 121,132 **** overriden = NULL; this->channel = channel; - ship_roots.preinit(); - ship_codes.preinit(); } void TrugPlayer::calculate() { } TrugPlayer::~TrugPlayer() { - ship_roots.deinit(); - ship_codes.deinit(); } --- 121,128 ---- *************** *** 165,175 **** Game::preinit(); gui = NULL; - players.preinit(); } TrugGame::~TrugGame() { int i; ! for (i = 0; i < players.num; i += 1) delete players[i]; ! players.deinit(); if (gui) delete gui; gui = NULL; --- 161,169 ---- Game::preinit(); gui = NULL; } TrugGame::~TrugGame() { int i; ! for (i = 0; i < players.size(); i += 1) delete players[i]; if (gui) delete gui; gui = NULL; *************** *** 177,182 **** TrugPlayer* TrugGame::add_player ( int channel ) { ! int i = players.num; ! players.add(new TrugPlayer(channel)); return players[i]; } --- 171,176 ---- TrugPlayer* TrugGame::add_player ( int channel ) { ! int i = players.size(); ! players.push_back( players[i] = new TrugPlayer(channel) ); return players[i]; } Index: gtrug.h =================================================================== RCS file: /cvsroot/timewarp/source/games/gtrug.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gtrug.h 29 Jan 2004 21:20:28 -0000 1.6 --- gtrug.h 14 Feb 2004 13:18:37 -0000 1.7 *************** *** 2,6 **** #define __GTRUG_H__ ! #include "../util/t_rarray.h" struct MouseState; --- 2,6 ---- #define __GTRUG_H__ ! #include <vector> struct MouseState; *************** *** 71,76 **** TeamCode team; virtual void calculate(); ! R_Array<int> ship_roots; ! R_Array<int> ship_codes; }; --- 71,76 ---- TeamCode team; virtual void calculate(); ! std::vector<int> ship_roots; ! std::vector<int> ship_codes; }; *************** *** 124,128 **** ! R_Ref_Array<TrugPlayer*> players; TrugGUI *gui; --- 124,128 ---- ! std::vector<TrugPlayer*> players; TrugGUI *gui; |
From: <or...@us...> - 2004-02-14 13:25:07
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10278 Modified Files: client.ini twwin.dsp Log Message: removed sintable... again! possible fix for AA div0 bug fixed umgah cone bug tweaked death notification stuff added profiling stuff removed JGMOD dependancy from scp.cpp switch some of my stuff from home-brewed to std::vector more stuff I forgot? Index: twwin.dsp =================================================================== RCS file: /cvsroot/timewarp/twwin.dsp,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** twwin.dsp 29 Jan 2004 21:20:32 -0000 1.28 --- twwin.dsp 14 Feb 2004 13:18:37 -0000 1.29 *************** *** 80,84 **** LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ./lib/alld.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib wsock32.lib ./lib/libjgmod.lib ./lib/luad.lib /nologo /subsystem:windows /debug /machine:I386 /out:"twwin_DEBUG.exe" /pdbtype:sept !ENDIF --- 80,85 ---- LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 ./lib/alld.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib wsock32.lib ./lib/libjgmod.lib ./lib/luad.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"LIBCMT" /out:"twwin_DEBUG.exe" /pdbtype:sept ! # SUBTRACT LINK32 /pdb:none !ENDIF *************** *** 224,236 **** # Begin Source File ! SOURCE=.\source\util\random.cpp # End Source File # Begin Source File ! SOURCE=.\source\util\round.c # End Source File # Begin Source File ! SOURCE=.\source\util\sintable.cpp # End Source File # Begin Source File --- 225,237 ---- # Begin Source File ! SOURCE=.\source\util\profile.cpp # End Source File # Begin Source File ! SOURCE=.\source\util\random.cpp # End Source File # Begin Source File ! SOURCE=.\source\util\round.c # End Source File # Begin Source File *************** *** 1320,1323 **** --- 1321,1332 ---- # Begin Source File + SOURCE=.\source\util\profile.h + # End Source File + # Begin Source File + + SOURCE=.\source\util\profile2.h + # End Source File + # Begin Source File + SOURCE=.\source\util\random.h # End Source File |
From: <yu...@us...> - 2004-02-07 07:46:34
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29319/source Modified Files: scp.cpp Log Message: cosmetic changes Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** scp.cpp 6 Feb 2004 07:38:38 -0000 1.47 --- scp.cpp 7 Feb 2004 07:43:38 -0000 1.48 *************** *** 298,302 **** int h = screen->h/4; ! int w = ratio * h; stretch_blit(logo, screen, --- 298,302 ---- int h = screen->h/4; ! int w = iround(ratio * h); stretch_blit(logo, screen, *************** *** 1658,1662 **** float r = rotationFrame; float s = type->data->spriteShip->frames(); ! float t = r / s; fractionRotated = (float)((float)rotationFrame / (float)(type->data->spriteShip->frames())); --- 1658,1662 ---- float r = rotationFrame; float s = type->data->spriteShip->frames(); ! //float t = r / s; fractionRotated = (float)((float)rotationFrame / (float)(type->data->spriteShip->frames())); *************** *** 1724,1728 **** 0, 0, bmp->w, bmp->h, 0, 0, fleetDialog[FLEET_DIALOG_SHIP_PICTURE_BITMAP].w, ! fleetDialog[FLEET_DIALOG_SHIP_PICTURE_BITMAP].h);/**/ //unload_datafile_object(data); --- 1724,1728 ---- 0, 0, bmp->w, bmp->h, 0, 0, fleetDialog[FLEET_DIALOG_SHIP_PICTURE_BITMAP].w, ! fleetDialog[FLEET_DIALOG_SHIP_PICTURE_BITMAP].h);*//* //unload_datafile_object(data); |
From: <yu...@us...> - 2004-02-07 07:46:34
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29319/source/melee Modified Files: mmain.cpp msprite.cpp Log Message: cosmetic changes Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** mmain.cpp 29 Jan 2004 21:20:29 -0000 1.21 --- mmain.cpp 7 Feb 2004 07:43:38 -0000 1.22 *************** *** 601,605 **** return; ! Vector2i co1, co2, D; co1 = corner(mother->pos - 0.5 * mother->size).round(); --- 601,605 ---- return; ! Vector2i co1, co2; co1 = corner(mother->pos - 0.5 * mother->size).round(); Index: msprite.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/msprite.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** msprite.cpp 29 Jan 2004 21:20:29 -0000 1.14 --- msprite.cpp 7 Feb 2004 07:43:38 -0000 1.15 *************** *** 378,382 **** SpaceSprite::SpaceSprite(const DATAFILE *images, int sprite_count, int _attributes, int rotations) { STACKTRACE ! int i, j, obpp; BITMAP *bmp, *tmp = NULL; --- 378,382 ---- SpaceSprite::SpaceSprite(const DATAFILE *images, int sprite_count, int _attributes, int rotations) { STACKTRACE ! int i, j, obpp=0; BITMAP *bmp, *tmp = NULL; |
From: <yu...@us...> - 2004-02-07 07:46:34
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29319/source/other Modified Files: gquest.cpp Log Message: cosmetic changes Index: gquest.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gquest.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gquest.cpp 5 Feb 2004 01:36:18 -0000 1.12 --- gquest.cpp 7 Feb 2004 07:43:37 -0000 1.13 *************** *** 208,212 **** tw_error ("Wrong argument count for AddBuckazoids"); } ! int money = lua_tonumber(ls, -1); g_player->buckazoids += money; return 0; --- 208,212 ---- tw_error ("Wrong argument count for AddBuckazoids"); } ! int money = (int)lua_tonumber(ls, -1); g_player->buckazoids += money; return 0; *************** *** 281,284 **** --- 281,285 ---- tw_error("QuestSuccess failed"); }; + lua_settop(Lquest, top); return true; } |
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29319/source/gamex Modified Files: gamedata.cpp gamedialogue.cpp gamegeneral.cpp gamehyper.cpp gameplanetscan.cpp gameplanetview.cpp gamesolarview.cpp Log Message: cosmetic changes Index: gamedata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gamedata.cpp 29 Jan 2004 21:20:28 -0000 1.11 --- gamedata.cpp 7 Feb 2004 07:43:37 -0000 1.12 *************** *** 295,302 **** P = corner(starmap->sub[istar]->position * starmap->scalepos); ! R = patrol.range * starmap->scalepos * space_zoom; //void circlefill(BITMAP *bmp, int x, int y, int radius, int color); ! circlefill(bmp, P.x, P.y, R, race->color); break; } --- 295,302 ---- P = corner(starmap->sub[istar]->position * starmap->scalepos); ! R = iround(patrol.range * starmap->scalepos * space_zoom); //void circlefill(BITMAP *bmp, int x, int y, int radius, int color); ! circlefill(bmp, iround(P.x), iround(P.y), R, race->color); break; } *************** *** 313,320 **** P = corner(solarmap->sub[iplanet]->position * solarmap->scalepos); ! R = 80 * space_zoom; //void circlefill(BITMAP *bmp, int x, int y, int radius, int color); ! circle(bmp, P.x, P.y, R, race->color); break; --- 313,320 ---- P = corner(solarmap->sub[iplanet]->position * solarmap->scalepos); ! R = iround(80 * space_zoom); //void circlefill(BITMAP *bmp, int x, int y, int radius, int color); ! circle(bmp, iround(P.x), iround(P.y), R, race->color); break; *************** *** 359,365 **** patrol.range = 100; ! patrol.numsystemfleets = population / 10; ! patrol.numhyperfleets = population / 1E3; ! patrol.numcapitalfleets = population / 1E6; } --- 359,365 ---- patrol.range = 100; ! patrol.numsystemfleets = iround(population / 10); ! patrol.numhyperfleets = iround(population / 1E3); ! patrol.numcapitalfleets = iround(population / 1E6); } Index: gamedialogue.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gamedialogue.cpp 29 Jan 2004 21:20:28 -0000 1.7 --- gamedialogue.cpp 7 Feb 2004 07:43:37 -0000 1.8 *************** *** 126,130 **** ! int tcol = makecol(255,255,128); A = new TextInfoArea(T, "A/", usefont, 0, 0); // all text should fit on 1 window - no scroll needed !! --- 126,130 ---- ! //int tcol = makecol(255,255,128); A = new TextInfoArea(T, "A/", usefont, 0, 0); // all text should fit on 1 window - no scroll needed !! Index: gamegeneral.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamegeneral.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gamegeneral.cpp 29 Jan 2004 21:20:28 -0000 1.11 --- gamegeneral.cpp 7 Feb 2004 07:43:37 -0000 1.12 *************** *** 119,125 **** { if (vidmem) ! tmpbmp = create_video_bitmap(bmplist[i]->w * scale, bmplist[i]->h * scale); else ! tmpbmp = create_bitmap_ex(bpp, bmplist[i]->w * scale, bmplist[i]->h * scale); stretch_blit(bmplist[i], tmpbmp, 0, 0, bmplist[i]->w, bmplist[i]->h, --- 119,125 ---- { if (vidmem) ! tmpbmp = create_video_bitmap(iround(bmplist[i]->w * scale), iround(bmplist[i]->h * scale)); else ! tmpbmp = create_bitmap_ex(bpp, iround(bmplist[i]->w * scale), iround(bmplist[i]->h * scale)); stretch_blit(bmplist[i], tmpbmp, 0, 0, bmplist[i]->w, bmplist[i]->h, *************** *** 259,264 **** P = corner(pos); ! x = P.x - 0.5 * w; ! y = P.y - 0.5 * h; sprite->draw(x, y, 0, f->surface); --- 259,264 ---- P = corner(pos); ! x = iround(P.x - 0.5 * w); ! y = iround(P.y - 0.5 * h); sprite->draw(x, y, 0, f->surface); *************** *** 274,282 **** P = corner(selection->pos, Vector2(w,h)); ! w *= space_zoom; ! h *= space_zoom; ! rect( f->surface, P.x, P.y, P.x+w, P.y+h, makecol(128,128,0) ); ! f->add_box(P.x, P.y, w, h); /* --- 274,282 ---- P = corner(selection->pos, Vector2(w,h)); ! w *= iround(space_zoom); ! h *= iround(space_zoom); ! rect( f->surface, iround(P.x), iround(P.y), iround(P.x+w), iround(P.y+h), makecol(128,128,0) ); ! f->add_box(iround(P.x), iround(P.y), w, h); /* Index: gamehyper.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamehyper.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** gamehyper.cpp 29 Jan 2004 21:20:28 -0000 1.9 --- gamehyper.cpp 7 Feb 2004 07:43:37 -0000 1.10 *************** *** 86,90 **** Vector2 s = sprite->size(sprite_index); Vector2 p = corner(pos, s ); ! sprite->draw_character(p.x, p.y, sprite_index, makecol(0,0,0), f); } --- 86,90 ---- Vector2 s = sprite->size(sprite_index); Vector2 p = corner(pos, s ); ! sprite->draw_character(iround(p.x), iround(p.y), sprite_index, makecol(0,0,0), f); } *************** *** 178,182 **** : Animation(0, opos, osprite, first_frame, num_frames, ! 1000 * (period / (num_frames - first_frame)), depth, 1.0) { level = olevel; --- 178,182 ---- : Animation(0, opos, osprite, first_frame, num_frames, ! iround(1000 * (period / (num_frames - first_frame))), depth, 1.0) { level = olevel; *************** *** 196,200 **** { // you're within a period. ! frame_step = -waittime; //sprite_index = frame1 - Nframes * waittime / period; //if (sprite_index >= frame1 + Nframes) --- 196,200 ---- { // you're within a period. ! frame_step = iround(-waittime); //sprite_index = frame1 - Nframes * waittime / period; //if (sprite_index >= frame1 + Nframes) *************** *** 222,226 **** //draw(, s * space_zoom, index, space); masked_blit(sprite->get_bitmap(sprite_index), space->surface, ! 0, 0, p.x, p.y, s.x, s.y); } } --- 222,226 ---- //draw(, s * space_zoom, index, space); masked_blit(sprite->get_bitmap(sprite_index), space->surface, ! 0, 0, iround(p.x), iround(p.y), iround(s.x), iround(s.y)); } } *************** *** 1224,1226 **** } ! } \ No newline at end of file --- 1224,1226 ---- } ! } Index: gameplanetscan.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetscan.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gameplanetscan.cpp 29 Jan 2004 21:20:28 -0000 1.8 --- gameplanetscan.cpp 7 Feb 2004 07:43:37 -0000 1.9 *************** *** 332,336 **** ! sprite_index = weight/5; if (sprite_index > 2) sprite_index = 2; --- 332,336 ---- ! sprite_index = iround(weight/5); if (sprite_index > 2) sprite_index = 2; *************** *** 371,376 **** //MapObj::animate(frame2); double s = bmpframe2->w / 400.0; ! int x = pos.x * s / scalesurface - 0.5*sprite->get_bitmap(0)->w; ! int y = pos.y * s / scalesurface - 0.5*sprite->get_bitmap(0)->h; sprite->draw(x, y, sprite_index, bmpframe2); } --- 371,376 ---- //MapObj::animate(frame2); double s = bmpframe2->w / 400.0; ! int x = iround(pos.x * s / scalesurface - 0.5*sprite->get_bitmap(0)->w); ! int y = iround(pos.y * s / scalesurface - 0.5*sprite->get_bitmap(0)->h); sprite->draw(x, y, sprite_index, bmpframe2); } *************** *** 513,518 **** //MapObj::animate(frame2); double s = bmpframe2->w / 400.0; ! int x = pos.x * s / scalesurface - 0.5*sprite->get_bitmap(0)->w; ! int y = pos.y * s / scalesurface - 0.5*sprite->get_bitmap(0)->h; sprite->draw(x, y, sprite_index, bmpframe2); } --- 513,518 ---- //MapObj::animate(frame2); double s = bmpframe2->w / 400.0; ! int x = iround(pos.x * s / scalesurface - 0.5*sprite->get_bitmap(0)->w); ! int y = iround(pos.y * s / scalesurface - 0.5*sprite->get_bitmap(0)->h); sprite->draw(x, y, sprite_index, bmpframe2); } *************** *** 654,658 **** int totfrac = 0; for ( i = 0; i < mineraltypelist->N; ++i ) ! totfrac += frac[i]; for ( i = 0; i < mineraltypelist->N; ++i ) --- 654,658 ---- int totfrac = 0; for ( i = 0; i < mineraltypelist->N; ++i ) ! totfrac += iround(frac[i]); for ( i = 0; i < mineraltypelist->N; ++i ) *************** *** 851,856 **** // exploring it... int x, y; ! x = (maparea->backgr->w - rotatingplanet->size.x) / 2; ! y = (maparea->backgr->h - rotatingplanet->size.y) / 2; rotatingplanet->animate_pre(); rotatingplanet->get_sprite()->draw(x, y, 0, maparea->backgr); --- 851,856 ---- // exploring it... int x, y; ! x = iround((maparea->backgr->w - rotatingplanet->size.x) / 2); ! y = iround((maparea->backgr->h - rotatingplanet->size.y) / 2); rotatingplanet->animate_pre(); rotatingplanet->get_sprite()->draw(x, y, 0, maparea->backgr); *************** *** 862,867 **** int x, y, w, h; ! w = (map_bmp->w * scalesurface) * space_zoom; ! h = (map_bmp->h * scalesurface) * space_zoom; x = -space_center.x * space_zoom + 0.5 * space_view_size.x; --- 862,867 ---- int x, y, w, h; ! w = iround((map_bmp->w * scalesurface) * space_zoom); ! h = iround((map_bmp->h * scalesurface) * space_zoom); x = -space_center.x * space_zoom + 0.5 * space_view_size.x; *************** *** 887,892 **** int d = 5; int c = makecol(250,50,50); ! hline(bmpframe2, P.x-d, P.y, P.x+d, c); ! vline(bmpframe2, P.x, P.y-d, P.y+d, c); } --- 887,892 ---- int d = 5; int c = makecol(250,50,50); ! hline(bmpframe2, iround(P.x-d), iround(P.y), iround(P.x+d), c); ! vline(bmpframe2, iround(P.x), iround(P.y-d), iround(P.y+d), c); } *************** *** 991,995 **** char txt[512]; ! N = random(nmin, nmax); for ( i = 0; i < N; ++i ) --- 991,995 ---- char txt[512]; ! N = random(iround(nmin), iround(nmax)); for ( i = 0; i < N; ++i ) Index: gameplanetview.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetview.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** gameplanetview.cpp 29 Jan 2004 21:20:28 -0000 1.13 --- gameplanetview.cpp 7 Feb 2004 07:43:37 -0000 1.14 *************** *** 341,345 **** // editor stuff ! ptr->newpos(mouse_x - maparea->pos.x, mouse_y - maparea->pos.y); mapeditor->calculate(); --- 341,345 ---- // editor stuff ! ptr->newpos(iround(mouse_x - maparea->pos.x), iround(mouse_y - maparea->pos.y)); mapeditor->calculate(); Index: gamesolarview.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamesolarview.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gamesolarview.cpp 29 Jan 2004 21:20:28 -0000 1.10 --- gamesolarview.cpp 7 Feb 2004 07:43:37 -0000 1.11 *************** *** 414,417 **** --- 414,418 ---- Rmax = 0.1; } + else if (strcmp(t, "small") == 0) { *************** *** 419,422 **** --- 420,424 ---- Rmax = 0.5; } + else if (strcmp(t, "medium") == 0) { *************** *** 424,427 **** --- 426,430 ---- Rmax = 2.0; } + else if (strcmp(t, "big") == 0) { *************** *** 429,432 **** --- 432,436 ---- Rmax = 10.0; } + else if (strcmp(t, "giant") == 0) { *************** *** 434,437 **** --- 438,447 ---- Rmax = 20.0; } + else + { + Rmin = 0; + Rmax = 0; + tw_error("Undefined planet type"); + } double R; *************** *** 816,820 **** // editor stuff ! ptr->newpos(mouse_x - maparea->pos.x, mouse_y - maparea->pos.y); mapeditor->calculate(); --- 826,830 ---- // editor stuff ! ptr->newpos( iround(mouse_x - maparea->pos.x), iround(mouse_y - maparea->pos.y)); mapeditor->calculate(); |
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29319/source/newships Modified Files: shpaktgu.cpp shpglads.cpp shptauda.cpp shptauem.cpp shpvenke.cpp shpvezba.cpp shpwistr.cpp shpxxxas.cpp shpyevme.cpp Log Message: cosmetic changes Index: shpaktgu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpaktgu.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** shpaktgu.cpp 29 Jan 2004 21:20:29 -0000 1.3 --- shpaktgu.cpp 7 Feb 2004 07:43:38 -0000 1.4 *************** *** 239,243 **** tot = normal+direct; if ( tot > 0 ) { ! armour -= tot; if(armour <= 0) { --- 239,243 ---- tot = normal+direct; if ( tot > 0 ) { ! armour -= iround(tot); if(armour <= 0) { Index: shpglads.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpglads.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpglads.cpp 29 Jan 2004 21:20:29 -0000 1.7 --- shpglads.cpp 7 Feb 2004 07:43:38 -0000 1.8 *************** *** 169,173 **** if (state == 0) return; double r = life_counter/(double)lifetime; ! int rr = 80 * r * space_zoom; set_trans_blender(0,0,0,255*(1-r)*(1-r)); drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0); --- 169,173 ---- if (state == 0) return; double r = life_counter/(double)lifetime; ! int rr = iround(80 * r * space_zoom); set_trans_blender(0,0,0,255*(1-r)*(1-r)); drawing_mode(DRAW_MODE_TRANS, NULL, 0, 0); Index: shptauda.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptauda.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shptauda.cpp 29 Jan 2004 21:20:30 -0000 1.9 --- shptauda.cpp 7 Feb 2004 07:43:38 -0000 1.10 *************** *** 73,77 **** { STACKTRACE ! game->add(new TauDaggerBeam(this, Vector2(0,30), weaponRange, weaponDamage, weaponFrameCount, angle)); return true; } --- 73,77 ---- { STACKTRACE ! game->add(new TauDaggerBeam(this, Vector2(0,30), weaponRange, weaponDamage, iround(weaponFrameCount), angle)); return true; } Index: shptauem.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptauem.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shptauem.cpp 29 Jan 2004 21:20:30 -0000 1.10 --- shptauem.cpp 7 Feb 2004 07:43:38 -0000 1.11 *************** *** 127,131 **** if (o->isShip()) { if (((Ship*)o)->nextkeys!=0) ! game->add(new TauEMPJammer(this, (Ship*)o, (1-pow(distance(o)/specialRange, 1/specialAttenuation)) * specialJamTime)); } else --- 127,131 ---- if (o->isShip()) { if (((Ship*)o)->nextkeys!=0) ! game->add(new TauEMPJammer(this, (Ship*)o, iround(1-pow(distance(o)/specialRange, 1/specialAttenuation)) * specialJamTime)); } else *************** *** 176,180 **** int i; for (i=-specialNumber+1;i<=0;i++) { ! set_trans_blender(0,0,0,r2*(1-rc)*(specialNumber+i)*255.0/(specialNumber)); circle_r = (wave_radius+3*i)*space_zoom; circle(space->surface,circle_x0,circle_y0, circle_r, makecol(100,100,255)); --- 176,180 ---- int i; for (i=-specialNumber+1;i<=0;i++) { ! set_trans_blender(0,0,0,iround(r2*(1-rc)*(specialNumber+i)*255.0/(specialNumber))); circle_r = (wave_radius+3*i)*space_zoom; circle(space->surface,circle_x0,circle_y0, circle_r, makecol(100,100,255)); Index: shpvenke.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvenke.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpvenke.cpp 29 Jan 2004 21:20:30 -0000 1.10 --- shpvenke.cpp 7 Feb 2004 07:43:38 -0000 1.11 *************** *** 331,335 **** void VenKekFrigate::createThrust(void) { STACKTRACE ! if(!Thrust==NULL) { Thrust->damage_factor = 1; Thrust->armour = 1; --- 331,335 ---- void VenKekFrigate::createThrust(void) { STACKTRACE ! if(Thrust!=NULL) { Thrust->damage_factor = 1; Thrust->armour = 1; Index: shpvezba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvezba.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpvezba.cpp 29 Jan 2004 21:20:30 -0000 1.10 --- shpvezba.cpp 7 Feb 2004 07:43:38 -0000 1.11 *************** *** 309,313 **** //SpaceObject::inflict_damage(other); if(creator) { ! x = 1 - (damageAbsorbed / resilience); if(x<0)x=0; if(!other->isPlanet()) other->accelerate (other, creator->trajectory_angle(other), creator->specialRepulse / other->mass, MAX_SPEED); --- 309,313 ---- //SpaceObject::inflict_damage(other); if(creator) { ! x = iround(1 - (damageAbsorbed / resilience)); if(x<0)x=0; if(!other->isPlanet()) other->accelerate (other, creator->trajectory_angle(other), creator->specialRepulse / other->mass, MAX_SPEED); Index: shpwistr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpwistr.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpwistr.cpp 29 Jan 2004 21:20:30 -0000 1.9 --- shpwistr.cpp 7 Feb 2004 07:43:38 -0000 1.10 *************** *** 10,18 **** #include "../frame.h" ! static double cross_product( Vector2 a, Vector2 b ) { return a.x*b.y - a.y*b.x; // this is the z-value of a vector (0,0,z). I assume z-value of a and b = 0 } class WissumTripod : public Ship --- 10,19 ---- #include "../frame.h" ! /* static double cross_product( Vector2 a, Vector2 b ) { return a.x*b.y - a.y*b.x; // this is the z-value of a vector (0,0,z). I assume z-value of a and b = 0 } + */ class WissumTripod : public Ship Index: shpxxxas.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpxxxas.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpxxxas.cpp 29 Jan 2004 21:20:30 -0000 1.10 --- shpxxxas.cpp 7 Feb 2004 07:43:38 -0000 1.11 *************** *** 241,247 **** TheSpotAngle = normalize(TheSpotAngle,PI2); ! RelX = (cos(-TheSpotAngle+PI/2) * TheSpotRadius); ! RelY = (sin(-TheSpotAngle+PI/2) * TheSpotRadius); --- 241,247 ---- TheSpotAngle = normalize(TheSpotAngle,PI2); ! RelX = iround(cos(-TheSpotAngle+PI/2) * TheSpotRadius); ! RelY = iround(sin(-TheSpotAngle+PI/2) * TheSpotRadius); *************** *** 413,415 **** REGISTER_SHIP(XXXAssimilator) ! \ No newline at end of file --- 413,415 ---- REGISTER_SHIP(XXXAssimilator) ! Index: shpyevme.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpyevme.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpyevme.cpp 29 Jan 2004 21:20:30 -0000 1.14 --- shpyevme.cpp 7 Feb 2004 07:43:38 -0000 1.15 *************** *** 418,422 **** STACKTRACE if (this->state==0) ship->SaberDestroyed=true; ! return normal + direct; } --- 418,422 ---- STACKTRACE if (this->state==0) ship->SaberDestroyed=true; ! return iround(normal + direct); } |
From: <yu...@us...> - 2004-02-07 07:46:27
|
Update of /cvsroot/timewarp/source/gamex/edit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29319/source/gamex/edit Modified Files: disk_stuff.cpp disk_stuff.h Log Message: cosmetic changes Index: disk_stuff.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/edit/disk_stuff.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** disk_stuff.cpp 29 Jan 2004 21:20:28 -0000 1.3 --- disk_stuff.cpp 7 Feb 2004 07:43:37 -0000 1.4 *************** *** 189,192 **** --- 189,196 ---- } + BlockStore::~BlockStore() + { + } + void BlockStore::fread(char *fname, int minsize) Index: disk_stuff.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/edit/disk_stuff.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** disk_stuff.h 29 Jan 2004 21:20:28 -0000 1.4 --- disk_stuff.h 7 Feb 2004 07:43:37 -0000 1.5 *************** *** 15,19 **** char *data; ! ~MemStore(); void reset(int N); --- 15,19 ---- char *data; ! virtual ~MemStore(); void reset(int N); *************** *** 52,55 **** --- 52,56 ---- BlockStore(); + virtual ~BlockStore(); virtual void fread(char *fname, int minsize); |
From: <yu...@us...> - 2004-02-06 20:26:01
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1438/source Modified Files: ais.h Log Message: suicide compilation error fixed Index: ais.h =================================================================== RCS file: /cvsroot/timewarp/source/ais.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ais.h 10 Jan 2004 22:27:58 -0000 1.6 --- ais.h 6 Feb 2004 20:23:14 -0000 1.7 *************** *** 24,28 **** int prev; int closest; ! int extra1, extra2, extra3, extra4, extra5, extra6; public: virtual void load(const char* inifile, const char* inisection); --- 24,29 ---- int prev; int closest; ! int extra1, extra2, extra3, extra4, extra5; ! int suicide; public: virtual void load(const char* inifile, const char* inisection); |
From: <yu...@us...> - 2004-02-06 20:26:01
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1438/source/melee Modified Files: mship.h Log Message: suicide compilation error fixed Index: mship.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** mship.h 6 Feb 2004 08:50:45 -0000 1.15 --- mship.h 6 Feb 2004 20:23:15 -0000 1.16 *************** *** 7,38 **** typedef short KeyCode; ! #define KEYFLAG_LEFT 1 ! #define KEYFLAG_RIGHT 2 ! #define KEYFLAG_THRUST 4 ! #define KEYFLAG_BACK 8 ! #define KEYFLAG_FIRE 16 ! #define KEYFLAG_SPECIAL 32 ! #define KEYFLAG_ALTFIRE 64 ! #define KEYFLAG_NEXT 128 ! #define KEYFLAG_PREV 256 ! #define KEYFLAG_CLOSEST 512 struct keyflag { enum { ! left = 0x0001, ! right = 0x0002, ! thrust = 0x0004, ! back = 0x0008, ! fire = 0x0010, ! special = 0x0020, ! altfire = 0x0040, ! next = 0x0080, ! prev = 0x0100, ! closest = 0x0200, ! extra1 = 0x0400, ! extra2 = 0x0800, ! extra3 = 0x01000, ! extra4 = 0x02000, ! extra5 = 0x04000, ! suicide = 0x08000 }; }; --- 7,47 ---- typedef short KeyCode; ! enum { ! KEYFLAG_LEFT = (1), ! KEYFLAG_RIGHT = (1<<1), ! KEYFLAG_THRUST = (1<<2), ! KEYFLAG_BACK = (1<<3), ! KEYFLAG_FIRE = (1<<4), ! KEYFLAG_SPECIAL = (1<<5), ! KEYFLAG_ALTFIRE = (1<<6), ! KEYFLAG_NEXT = (1<<7), ! KEYFLAG_PREV = (1<<8), ! KEYFLAG_CLOSEST = (1<<9), ! KEYFLAG_EXTRA1 = (1<<10), ! KEYFLAG_EXTRA2 = (1<<11), ! KEYFLAG_EXTRA3 = (1<<12), ! KEYFLAG_EXTRA4 = (1<<13), ! KEYFLAG_EXTRA5 = (1<<14), ! KEYFLAG_SUICIDE = (1<<15), ! }; ! struct keyflag { enum { ! left = KEYFLAG_LEFT, ! right = KEYFLAG_RIGHT, ! thrust = KEYFLAG_THRUST, ! back = KEYFLAG_BACK, ! fire = KEYFLAG_FIRE, ! special = KEYFLAG_SPECIAL, ! altfire = KEYFLAG_ALTFIRE, ! next = KEYFLAG_NEXT, ! prev = KEYFLAG_PREV, ! closest = KEYFLAG_CLOSEST, ! extra1 = KEYFLAG_EXTRA1, ! extra2 = KEYFLAG_EXTRA2, ! extra3 = KEYFLAG_EXTRA3, ! extra4 = KEYFLAG_EXTRA4, ! extra5 = KEYFLAG_EXTRA5, ! suicide = KEYFLAG_SUICIDE }; }; |
From: <yu...@us...> - 2004-02-06 20:26:01
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1438/source/ais Modified Files: c_input.cpp Log Message: suicide compilation error fixed Index: c_input.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_input.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** c_input.cpp 6 Feb 2004 08:50:44 -0000 1.10 --- c_input.cpp 6 Feb 2004 20:23:15 -0000 1.11 *************** *** 126,130 **** extra4 = get_config_int(inisection, "Extra4", 0); extra5 = get_config_int(inisection, "Extra5", 0); ! suicide = get_config_int(inisection, "Extra6", 0); return; } --- 126,130 ---- extra4 = get_config_int(inisection, "Extra4", 0); extra5 = get_config_int(inisection, "Extra5", 0); ! suicide = get_config_int(inisection, "Extra6", 0); return; } |
From: <you...@us...> - 2004-02-06 08:53:31
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9674/source Modified Files: gui.cpp Log Message: adding suicide button; adding colour changes for buttons... had I checked in the colourful buttons yet...? Index: gui.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gui.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gui.cpp 4 Feb 2004 10:36:27 -0000 1.14 --- gui.cpp 6 Feb 2004 08:50:44 -0000 1.15 *************** *** 1098,1104 **** --- 1098,1115 ---- if (menuFocus != NULL) sound.play(menuFocus, 128); + d->bg = makecol(196,196,255); + break; + + case MSG_LOSTFOCUS: + d->bg = makecol(255,255,255); break; + /*case MSG_DRAW: + if (d->flags & D_GOTFOCUS) + + + break;/**/ }; + return ret; } |
From: <you...@us...> - 2004-02-06 08:53:30
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9674/source/melee Modified Files: mship.cpp mship.h Log Message: adding suicide button; adding colour changes for buttons... had I checked in the colourful buttons yet...? Index: mship.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** mship.cpp 29 Jan 2004 21:20:29 -0000 1.25 --- mship.cpp 6 Feb 2004 08:50:45 -0000 1.26 *************** *** 561,565 **** --- 561,587 ---- this->target_prev = 1&&(nextkeys & keyflag::prev); this->target_closest = 1&&(nextkeys & keyflag::closest); + if (nextkeys & keyflag::suicide) { + crew = 0; + play_sound((SAMPLE *)(melee[MELEE_BOOMSHIP].dat)); + + if (meleedata.xpl1Sprite) { + death_counter = 0; + death_explosion_counter = 0; + collide_flag_anyone = collide_flag_sameship = collide_flag_sameteam = 0; + } + else { + state = 0; + game->add(new Animation(this, pos, meleedata.kaboomSprite, 0, KABOOM_FRAMES, time_ratio, DEPTH_EXPLOSIONS)); + } + if (attributes & ATTRIB_NOTIFY_ON_DEATH) { + game->ship_died(this, NULL); + attributes &= ~ATTRIB_NOTIFY_ON_DEATH; + } + } this->nextkeys = control->keys; + + + + if (!control->exists()) control = NULL; } Index: mship.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mship.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** mship.h 10 Jan 2004 22:27:59 -0000 1.14 --- mship.h 6 Feb 2004 08:50:45 -0000 1.15 *************** *** 34,38 **** extra4 = 0x02000, extra5 = 0x04000, ! extra6 = 0x08000 }; }; --- 34,38 ---- extra4 = 0x02000, extra5 = 0x04000, ! suicide = 0x08000 }; }; |
From: <you...@us...> - 2004-02-06 08:53:30
|
Update of /cvsroot/timewarp/source/ais In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9674/source/ais Modified Files: c_input.cpp Log Message: adding suicide button; adding colour changes for buttons... had I checked in the colourful buttons yet...? Index: c_input.cpp =================================================================== RCS file: /cvsroot/timewarp/source/ais/c_input.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** c_input.cpp 4 Feb 2004 10:36:27 -0000 1.9 --- c_input.cpp 6 Feb 2004 08:50:44 -0000 1.10 *************** *** 126,130 **** extra4 = get_config_int(inisection, "Extra4", 0); extra5 = get_config_int(inisection, "Extra5", 0); ! extra6 = get_config_int(inisection, "Extra6", 0); return; } --- 126,130 ---- extra4 = get_config_int(inisection, "Extra4", 0); extra5 = get_config_int(inisection, "Extra5", 0); ! suicide = get_config_int(inisection, "Extra6", 0); return; } *************** *** 150,154 **** set_config_int(inisection, "Extra4", extra4); set_config_int(inisection, "Extra5", extra5); ! set_config_int(inisection, "Extra6", extra6); return; } --- 150,154 ---- set_config_int(inisection, "Extra4", extra4); set_config_int(inisection, "Extra5", extra5); ! set_config_int(inisection, "Extra6", suicide); return; } *************** *** 178,182 **** if (key_pressed(extra4)) r |= keyflag::extra4; if (key_pressed(extra5)) r |= keyflag::extra5; ! if (key_pressed(extra6)) r |= keyflag::extra6; return r; } --- 178,182 ---- if (key_pressed(extra4)) r |= keyflag::extra4; if (key_pressed(extra5)) r |= keyflag::extra5; ! if (key_pressed(suicide)) r |= keyflag::suicide; return r; } *************** *** 275,280 **** key_to_description ( extra5, s ); s = dialog_string[index]; index += 1; ! s += sprintf ( s, "Extra6: "); ! key_to_description ( extra6, s ); s = dialog_string[index]; index += 1; --- 275,280 ---- key_to_description ( extra5, s ); s = dialog_string[index]; index += 1; ! s += sprintf ( s, "Suicide: "); ! key_to_description ( suicide, s ); s = dialog_string[index]; index += 1; *************** *** 315,319 **** case 14: extra4 = t; break; case 15: extra5 = t; break; ! case 16: extra6 = t; break; case KEY_DIALOG_OK: save("scp.ini", getDescription()); return; case KEY_DIALOG_CANCEL: load("scp.ini", getDescription()); return; --- 315,319 ---- case 14: extra4 = t; break; case 15: extra5 = t; break; ! case 16: suicide = t; break; case KEY_DIALOG_OK: save("scp.ini", getDescription()); return; case KEY_DIALOG_CANCEL: load("scp.ini", getDescription()); return; |
From: <you...@us...> - 2004-02-06 07:41:18
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29681/source Modified Files: scp.cpp Log Message: fixed bad, hard to find typo in the fleet editor... needed |= but it was = Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** scp.cpp 4 Feb 2004 21:20:21 -0000 1.46 --- scp.cpp 6 Feb 2004 07:38:38 -0000 1.47 *************** *** 1610,1614 **** ret = D_USED_CHAR; ! d->flags = D_DIRTY; //scroll such that the selection is shown. --- 1610,1614 ---- ret = D_USED_CHAR; ! d->flags |= D_DIRTY; //scroll such that the selection is shown. |
From: <you...@us...> - 2004-02-05 08:53:24
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9898/source Modified Files: gui.h scp.cpp Log Message: adding meaningful status hints to the user, like showing when loading a new gametype, loading at startup, or waiting on a network connection (bug 28) Index: gui.h =================================================================== RCS file: /cvsroot/timewarp/source/gui.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** gui.h 8 Jun 2003 17:55:47 -0000 1.3 --- gui.h 3 Feb 2004 13:21:30 -0000 1.4 *************** *** 14,18 **** - /* TimeWarps own custom GUI --- 14,17 ---- *************** *** 29,32 **** --- 28,33 ---- + + /*struct { enum { Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** scp.cpp 3 Feb 2004 06:43:01 -0000 1.40 --- scp.cpp 3 Feb 2004 13:21:30 -0000 1.41 *************** *** 229,235 **** Music * mymusic = load_mod("TitleScreen.dat#TITLEMUSIC"); - - //Music * mymusic = load_mod("scpgui.dat#SCPMUSIC"); - if (!mymusic) tw_error("Couldnt load title music"); --- 229,232 ---- *************** *** 238,241 **** --- 235,251 ---- } + /** clears the screen, and displays a loading message to the user. + */ + void showLoadingScreen() { + acquire_screen(); + clear_to_color(screen, palette_color[0]); + + const char * loadString = "Loading..."; + textout_right(screen, font, loadString, + screen->w - 1*text_length(font, loadString), screen->h - 4*text_height(font), + palette_color[15]); + release_screen(); + } + enum { *************** *** 346,350 **** return; set_config_string("Network", "Address", addressaddress); ! message.out("..."); message.animate(0); i = ((NetLog*)log)->net.connect(addressaddress, port, is_escape_pressed); --- 356,360 ---- return; set_config_string("Network", "Address", addressaddress); ! message.out("Connecting to server..."); message.animate(0); i = ((NetLog*)log)->net.connect(addressaddress, port, is_escape_pressed); *************** *** 388,392 **** if (port == -1) return; ! message.out("..."); message.animate(0); log->net.listen(port, is_escape_pressed); --- 398,402 ---- if (port == -1) return; ! message.out("Listening for client..."); message.animate(0); log->net.listen(port, is_escape_pressed); *************** *** 419,422 **** --- 429,434 ---- Game *new_game = NULL; + showLoadingScreen(); + strncpy(gametype_name, _gametype_name, 1000); for (c = strchr(gametype_name, '_'); c; c = strchr(c, '_')) *************** *** 449,455 **** throw "wait a sec... I can't find that game type"; - videosystem.window.lock(); - clear_to_color(videosystem.window.surface, palette_color[8]); - videosystem.window.unlock(); new_game->preinit(); new_game->window = new VideoWindow; --- 461,464 ---- *************** *** 801,804 **** --- 810,815 ---- sound.load(); videosystem.set_resolution(screen_width, screen_height, screen_bpp, fullscreen); + + showLoadingScreen(); View *v = NULL; *************** *** 806,814 **** if (!v) v = get_view ( "Hero", NULL ); set_view(v); init_ships(); init_fleet(); init_time(); ! meleedata.init(); if (auto_play) {// FIX ME --- 817,827 ---- if (!v) v = get_view ( "Hero", NULL ); set_view(v); + + init_ships(); init_fleet(); init_time(); ! meleedata.init();//mainmain if (auto_play) {// FIX ME |
From: <you...@us...> - 2004-02-05 08:45:06
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9898/source/other Modified Files: gquest.cpp gquest.h Log Message: adding meaningful status hints to the user, like showing when loading a new gametype, loading at startup, or waiting on a network connection (bug 28) Index: gquest.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gquest.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gquest.cpp 29 Jan 2004 21:20:30 -0000 1.10 --- gquest.cpp 3 Feb 2004 13:21:30 -0000 1.11 *************** *** 10,13 **** --- 10,14 ---- #include "../games/ggob.h" #include "gdialog.h" + #include "../melee/mview.h" // for message static GobPlayer * g_player = NULL; *************** *** 31,34 **** --- 32,36 ---- lua_register(L, "RemoveObject", l_RemoveObject); lua_register(L, "AddBuckazoids", l_AddBuckazoids); + lua_register(L, "PrintMessage", l_PrintMessage); // Load Quest *************** *** 205,208 **** --- 207,221 ---- return 0; } + int Quest::l_PrintMessage(lua_State*ls) + { + int top = lua_gettop(ls); + if ( top != 1 ) + { + tw_error ("Wrong argument count for PrintMessage"); + } + const char * str = lua_tostring(ls, -1); + message.out((char *)str, 10000, makecol(0,255,0)); + return 0; + } QuestSource::QuestSource() Index: gquest.h =================================================================== RCS file: /cvsroot/timewarp/source/other/gquest.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gquest.h 24 Jan 2004 21:04:04 -0000 1.6 --- gquest.h 3 Feb 2004 13:21:30 -0000 1.7 *************** *** 47,50 **** --- 47,52 ---- /*! \brief Add buckazoids */ static int l_AddBuckazoids(lua_State*ls); + /*! \brief Print message */ + static int l_PrintMessage(lua_State*ls); }; |
From: <yu...@us...> - 2004-02-05 01:38:47
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24726/source/other Modified Files: gevent.h gquest.cpp gquest.h Log Message: Every GOB game quest process through QuestSource. Index: gevent.h =================================================================== RCS file: /cvsroot/timewarp/source/other/gevent.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gevent.h 24 Jan 2004 21:03:46 -0000 1.5 --- gevent.h 5 Feb 2004 01:36:18 -0000 1.6 *************** *** 64,68 **** }; ! class EventCleanQuestTrash: IEvent { public: --- 64,68 ---- }; ! class EventCleanQuestTrash: public IEvent { public: *************** *** 70,74 **** }; ! class EventQuestSuccess: IEvent { public: --- 70,74 ---- }; ! class EventQuestSuccess: public IEvent { public: *************** *** 77,81 **** }; ! class EventQuestFailed: IEvent { public: --- 77,81 ---- }; ! class EventQuestFailed: public IEvent { public: *************** *** 84,88 **** }; ! class EventAskForQuest: IEvent { public: --- 84,88 ---- }; ! class EventAskForQuest: public IEvent { public: Index: gquest.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gquest.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gquest.cpp 3 Feb 2004 13:21:30 -0000 1.11 --- gquest.cpp 5 Feb 2004 01:36:18 -0000 1.12 *************** *** 2,6 **** #ifdef ALLEGRO_MSVC ! #pragma warning (disable:4786) #endif --- 2,6 ---- #ifdef ALLEGRO_MSVC ! #pragma warning (disable:4786) #endif *************** *** 19,70 **** Quest::Quest( const char * szLuaFile, GobPlayer * player ) { ! gob_player = player; ! strName = szLuaFile; ! bExist = true; ! L = lua_open(); ! InitConversationModule( L ); ! // Register C function ! lua_register(L, "Dialog", l_Dialog); ! lua_register(L, "AddObject", l_AddObject); ! lua_register(L, "RemoveObject", l_RemoveObject); ! lua_register(L, "AddBuckazoids", l_AddBuckazoids); ! lua_register(L, "PrintMessage", l_PrintMessage); ! // Load Quest ! lua_dofile(L, szLuaFile); ! // Register Events ! int top = lua_gettop(L); ! lua_pushstring(L, "GAME_EVENT_SHIP_DIE"); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! if ( lua_isfunction(L, -1) ) ! RegisterEvent(GAME_EVENT_SHIP_DIE, gobgame); ! lua_settop(L, top); ! lua_pushstring(L, "GAME_EVENT_SHIP_GET_DAMAGE"); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! if ( lua_isfunction(L, -1) ) ! RegisterEvent(GAME_EVENT_SHIP_GET_DAMAGE, gobgame); ! lua_settop(L, top); ! lua_pushstring(L, "GAME_EVENT_ENTER_STATION"); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! if ( lua_isfunction(L, -1) ) ! RegisterEvent(GAME_EVENT_ENTER_STATION, gobgame); ! lua_settop(L, top); } Quest::~Quest() { ! lua_close(L); } bool Quest::exist() { ! return bExist; } --- 19,70 ---- Quest::Quest( const char * szLuaFile, GobPlayer * player ) { ! gob_player = player; ! strName = szLuaFile; ! bExist = true; ! L = lua_open(); ! InitConversationModule( L ); ! // Register C function ! lua_register(L, "Dialog", l_Dialog); ! lua_register(L, "AddObject", l_AddObject); ! lua_register(L, "RemoveObject", l_RemoveObject); ! lua_register(L, "AddBuckazoids", l_AddBuckazoids); ! lua_register(L, "PrintMessage", l_PrintMessage); ! // Load Quest ! lua_dofile(L, szLuaFile); ! // Register Events ! int top = lua_gettop(L); ! lua_pushstring(L, "GAME_EVENT_SHIP_DIE"); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! if ( lua_isfunction(L, -1) ) ! RegisterEvent(GAME_EVENT_SHIP_DIE, gobgame); ! lua_settop(L, top); ! lua_pushstring(L, "GAME_EVENT_SHIP_GET_DAMAGE"); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! if ( lua_isfunction(L, -1) ) ! RegisterEvent(GAME_EVENT_SHIP_GET_DAMAGE, gobgame); ! lua_settop(L, top); ! lua_pushstring(L, "GAME_EVENT_ENTER_STATION"); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! if ( lua_isfunction(L, -1) ) ! RegisterEvent(GAME_EVENT_ENTER_STATION, gobgame); ! lua_settop(L, top); } Quest::~Quest() { ! lua_close(L); } bool Quest::exist() { ! return bExist; } *************** *** 74,77 **** --- 74,82 ---- } + GobPlayer * Quest::GetPlayer() + { + return gob_player; + } + void Quest::Process() { *************** *** 80,198 **** return; ! // dirty hack, only for experiment ! g_player = gob_player; ! - int top = lua_gettop(L); - lua_pushstring(L, "Process"); - lua_gettable(L, LUA_GLOBALSINDEX); ! if ( !lua_isfunction(L, -1) ) ! { ! tw_error("Quest script is not contain Process function"); ! }; ! // gather information ! int time = gobgame->game_time; ! int enemy = gobgame->gobenemies; ! int kills = gob_player->kills; ! int x = iround(gob_player->ship->normal_pos().x); ! int y = iround(gob_player->ship->normal_pos().y); ! // Pass addition information to lua script ! lua_pushnumber(L, time); ! lua_pushnumber(L, enemy); ! lua_pushnumber(L, kills); ! lua_pushnumber(L, x); ! lua_pushnumber(L, y); ! lua_pushnumber(L, 0); //reserved ! lua_pushnumber(L, 0); //reserved ! lua_pushstring(L, "test"); //reserved ! lua_call(L, 8, 0); ! ! lua_pushstring(L, "Complited"); ! lua_gettable(L, LUA_GLOBALSINDEX); ! if ( lua_isnumber(L, -1) ) ! { ! bExist = lua_tonumber(L, -1); ! } ! else ! { ! tw_error("Unable to read Complited variable from lua script"); ! } ! lua_settop(L, top); ! g_player = NULL; ! return; } void Quest::ProcessEvent ( IEvent* event ) { ! g_player = gob_player; ! int type = event->GetEventType(); ! int top; ! const char * temp; ! switch ( type ) ! { ! case GAME_EVENT_ALL: ! {tw_error ("Process Event failed");} ! break; ! case GAME_EVENT_SHIP_DIE: ! // Test Implementation ! top = lua_gettop(L); ! lua_pushstring ( L, "GAME_EVENT_SHIP_DIE" ); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! ! ! if ( !lua_isfunction(L, -1) ) ! { ! tw_error("Quest script is not contain GAME_EVENT_SHIP_DIE function"); ! }; ! temp = ((EventShipDie*)event)->victim->get_shiptype() -> id; ! lua_pushstring( L, ((EventShipDie*)event)->victim->get_shiptype() -> id ); //reserved ! ! lua_call(L, 1, 0 ); ! lua_settop(L, top); ! break; ! case GAME_EVENT_SHIP_GET_DAMAGE: ! break; ! case GAME_EVENT_ENTER_STATION: ! // Test Implementation ! top = lua_gettop(L); ! lua_pushstring ( L, "GAME_EVENT_ENTER_STATION" ); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(L, -1) ) { ! tw_error("Quest script is not contain GAME_EVENT_ENTER_STATION function"); ! }; ! ! lua_pushnumber( L, 1 ); //need to be implemented ! ! lua_call(L, 1, 0 ); ! lua_settop(L, top); ! ! break; ! default: ! break; ! } ! g_player = NULL; } int Quest::l_Dialog(lua_State* ls) { ! return NOT_IMPLEMENTED; } int Quest::l_AddObject(lua_State* ls) { ! gobgame->add_new_enemy(); ! return NOT_IMPLEMENTED; } int Quest::l_RemoveObject(lua_State* ls) { ! return NOT_IMPLEMENTED; } int Quest::l_AddBuckazoids(lua_State*ls) --- 85,203 ---- return; ! // dirty hack, only for experiment ! g_player = gob_player; ! int top = lua_gettop(L); ! lua_pushstring(L, "Process"); ! lua_gettable(L, LUA_GLOBALSINDEX); ! if ( !lua_isfunction(L, -1) ) ! { ! tw_error("Quest script is not contain Process function"); ! }; ! // gather information ! int time = gobgame->game_time; ! int enemy = gobgame->gobenemies; ! int kills = gob_player->kills; ! int x = iround(gob_player->ship->normal_pos().x); ! int y = iround(gob_player->ship->normal_pos().y); ! // Pass addition information to lua script ! lua_pushnumber(L, time); ! lua_pushnumber(L, enemy); ! lua_pushnumber(L, kills); ! lua_pushnumber(L, x); ! lua_pushnumber(L, y); ! lua_pushnumber(L, 0); //reserved ! lua_pushnumber(L, 0); //reserved ! lua_pushstring(L, "test"); //reserved ! lua_call(L, 8, 0); ! ! lua_pushstring(L, "Exist"); ! lua_gettable(L, LUA_GLOBALSINDEX); ! if ( lua_isnumber(L, -1) ) ! { ! bExist = lua_tonumber(L, -1); ! } ! else ! { ! tw_error("Unable to read Complited variable from lua script"); ! } ! lua_settop(L, top); ! ! g_player = NULL; ! return; } void Quest::ProcessEvent ( IEvent* event ) { ! g_player = gob_player; ! int type = event->GetEventType(); ! int top; ! const char * temp; ! switch ( type ) { ! case GAME_EVENT_ALL: ! {tw_error ("Process Event failed");} ! break; ! case GAME_EVENT_SHIP_DIE: ! // Test Implementation ! top = lua_gettop(L); ! lua_pushstring ( L, "GAME_EVENT_SHIP_DIE" ); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! ! ! if ( !lua_isfunction(L, -1) ) ! { ! tw_error("Quest script is not contain GAME_EVENT_SHIP_DIE function"); ! }; ! temp = ((EventShipDie*)event)->victim->get_shiptype() -> id; ! lua_pushstring( L, ((EventShipDie*)event)->victim->get_shiptype() -> id ); //reserved ! ! lua_call(L, 1, 0 ); ! lua_settop(L, top); ! break; ! case GAME_EVENT_SHIP_GET_DAMAGE: ! break; ! case GAME_EVENT_ENTER_STATION: ! // Test Implementation ! top = lua_gettop(L); ! lua_pushstring ( L, "GAME_EVENT_ENTER_STATION" ); ! lua_gettable ( L, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(L, -1) ) ! { ! tw_error("Quest script is not contain GAME_EVENT_ENTER_STATION function"); ! }; ! ! lua_pushnumber( L, 1 ); //need to be implemented ! ! lua_call(L, 1, 0 ); ! lua_settop(L, top); ! ! break; ! default: ! break; ! } ! g_player = NULL; } int Quest::l_Dialog(lua_State* ls) { ! return NOT_IMPLEMENTED; } int Quest::l_AddObject(lua_State* ls) { ! gobgame->add_new_enemy(); ! return NOT_IMPLEMENTED; } int Quest::l_RemoveObject(lua_State* ls) { ! return NOT_IMPLEMENTED; } int Quest::l_AddBuckazoids(lua_State*ls) *************** *** 214,219 **** tw_error ("Wrong argument count for PrintMessage"); } ! const char * str = lua_tostring(ls, -1); ! message.out((char *)str, 10000, makecol(0,255,0)); return 0; } --- 219,224 ---- tw_error ("Wrong argument count for PrintMessage"); } ! const char * str = lua_tostring(ls, -1); ! message.out((char *)str, 10000, makecol(0,255,0)); return 0; } *************** *** 221,238 **** QuestSource::QuestSource() { ! Lquest = lua_open(); ! // Register C function ! //lua_register(L, "RemoveObject", l_RemoveObject); ! RegisterEvent (GAME_EVENT_CLEANQUESTTRASH, gobgame); // can't generate from quest ! RegisterEvent (GAME_EVENT_QUESTSUCCESS, gobgame ); ! RegisterEvent (GAME_EVENT_QUESTFAILED, gobgame ); ! RegisterEvent (GAME_EVENT_ASKFORQUEST, gobgame ); } QuestSource::~QuestSource() { ! lua_close( Lquest ); } --- 226,246 ---- QuestSource::QuestSource() { ! questList.clear(); ! Lquest = lua_open(); ! // Register C function ! //lua_register(L, "RemoveObject", l_RemoveObject); ! ! RegisterEvent (GAME_EVENT_CLEANQUESTTRASH, gobgame); // can't generate from quest ! RegisterEvent (GAME_EVENT_QUESTSUCCESS, gobgame ); ! RegisterEvent (GAME_EVENT_QUESTFAILED, gobgame ); ! RegisterEvent (GAME_EVENT_ASKFORQUEST, gobgame ); ! RegisterEvent (GAME_EVENT_SHIP_DIE, gobgame ); } QuestSource::~QuestSource() { ! lua_close( Lquest ); } *************** *** 240,390 **** int QuestSource::LoadQuestList ( const char* qlist ) { ! lua_dofile ( Lquest, qlist ); ! int top = lua_gettop ( Lquest ); ! lua_pushstring ( Lquest, "QuestSuccess" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! lua_pushstring ( Lquest, "QuestFailed" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! lua_pushstring ( Lquest, "GetNextQuest" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("GetNextQuest failed"); ! }; ! lua_pushstring ( Lquest, "GetQuest" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! return true; } Quest* QuestSource::GetNextQuest( GobPlayer* p) { ! int top = lua_gettop(Lquest); ! lua_pushstring ( Lquest, "GetNextQuest" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("GetNextQuest failed"); ! }; ! ! lua_call(Lquest, 0, 1 ); ! ! if ( !lua_isstring(Lquest, -1) ) ! { ! tw_error("Wrong argument for GetNextQuest"); ! } ! ! Quest * q = NULL; ! const char * quest = lua_tostring(Lquest, -1); ! if ( !strcmp(quest, "NO_QUEST") ) ! q = new Quest( quest, p ); ! questList.push_back(q); ! lua_settop(Lquest, top); ! ! return q; } Quest* QuestSource::GetQuest ( const char * name, GobPlayer * player ) { ! ASSERT(name); ! Quest * q = new Quest( name, player ); ! return q; } int QuestSource::QuestSuccess( Quest* q ) { ! int top = lua_gettop(Lquest); ! lua_pushstring ( Lquest, "QuestSuccess" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! lua_pushstring( Lquest, q->GetName() ); ! ! lua_call(Lquest, 1, 0 ); ! ! lua_settop(Lquest, top); ! ! return 1; } int QuestSource::QuestFailed( Quest* q ) { ! int top = lua_gettop(Lquest); ! lua_pushstring ( Lquest, "QuestFailed" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! ! lua_pushstring( Lquest, q->GetName() ); ! ! lua_call(Lquest, 1, 0 ); ! ! lua_settop(Lquest, top); ! ! return 1; } ! void QuestSource::RemoveTrash() { ! for (std::list<Quest*>::iterator i = questList.begin(); ! i != questList.end(); i++) ! { ! if ( !((*i)->exist()) ) { ! delete *i; ! questList.erase(i); } - } } void QuestSource::ProcessEvent ( IEvent* event ) { ! int type = event->GetEventType(); ! switch ( type ) ! { ! case GAME_EVENT_ALL: ! {tw_error ("Process Event failed");} ! break; ! case GAME_EVENT_CLEANQUESTTRASH: ! RemoveTrash(); ! break; ! case GAME_EVENT_QUESTSUCCESS: ! QuestSuccess( ((EventQuestSuccess*)event)->quest ); ! break; ! case GAME_EVENT_QUESTFAILED: ! QuestFailed( ((EventQuestFailed*)event)->quest ); ! break; ! case GAME_EVENT_ASKFORQUEST: ! GetNextQuest( ((EventAskForQuest*)event)->player ); ! break; ! default: ! break; ! } } --- 248,419 ---- int QuestSource::LoadQuestList ( const char* qlist ) { ! if (lua_dofile(Lquest, qlist) != 0) ! tw_error("cannot run configuration file"); ! ! int top = lua_gettop ( Lquest ); ! lua_pushstring ( Lquest, "QuestSuccess" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! lua_pushstring ( Lquest, "QuestFailed" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! lua_pushstring ( Lquest, "GetNextQuest" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("GetNextQuest failed"); ! }; ! ! lua_pushstring ( Lquest, "GetQuest" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! return true; } Quest* QuestSource::GetNextQuest( GobPlayer* p) { ! int top = lua_gettop(Lquest); ! lua_pushstring ( Lquest, "GetNextQuest" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("GetNextQuest failed"); ! }; ! ! lua_call(Lquest, 0, 1 ); ! ! if ( !lua_isstring(Lquest, -1) ) ! { ! tw_error("Wrong argument for GetNextQuest"); ! } ! ! Quest * q = NULL; ! const char * quest = lua_tostring(Lquest, -1); ! if ( strcmp(quest, "NO_QUEST")!=0 ) ! { ! q = new Quest( quest, p ); ! questList.push_back(q); ! } ! ! lua_settop(Lquest, top); ! ! return q; } Quest* QuestSource::GetQuest ( const char * name, GobPlayer * player ) { ! ASSERT(name); ! Quest * q = new Quest( name, player ); ! return q; } int QuestSource::QuestSuccess( Quest* q ) { ! int top = lua_gettop(Lquest); ! lua_pushstring ( Lquest, "QuestSuccess" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! ! lua_pushstring( Lquest, q->GetName() ); ! ! lua_call(Lquest, 1, 0 ); ! ! lua_settop(Lquest, top); ! ! return 1; } int QuestSource::QuestFailed( Quest* q ) { ! int top = lua_gettop(Lquest); ! lua_pushstring ( Lquest, "QuestFailed" ); ! lua_gettable ( Lquest, LUA_GLOBALSINDEX ); ! ! if ( !lua_isfunction(Lquest, -1) ) ! { ! tw_error("QuestSuccess failed"); ! }; ! ! lua_pushstring( Lquest, q->GetName() ); ! ! lua_call(Lquest, 1, 0 ); ! ! lua_settop(Lquest, top); ! ! return 1; } ! void QuestSource::RemoveTrash(GobPlayer* pl) { ! for (std::list<Quest*>::iterator i = questList.begin(); ! i != questList.end(); ++i) { ! GobPlayer * p = (*i)->GetPlayer(); ! if ( !((*i)->exist()) || p == pl ) ! { ! delete *i; ! questList.erase(i); ! i = questList.begin(); ! } } } void QuestSource::ProcessEvent ( IEvent* event ) { ! GobPlayer *p; ! int type = event->GetEventType(); ! switch ( type ) ! { ! case GAME_EVENT_ALL: ! {tw_error ("Process Event failed");} ! break; ! case GAME_EVENT_SHIP_DIE: ! p = gobgame->get_player(((EventShipDie*)event)->victim); ! if ( p ) //Player died ! RemoveTrash( p ); ! break; ! case GAME_EVENT_CLEANQUESTTRASH: ! RemoveTrash(); ! break; ! case GAME_EVENT_QUESTSUCCESS: ! QuestSuccess( ((EventQuestSuccess*)event)->quest ); ! break; ! case GAME_EVENT_QUESTFAILED: ! QuestFailed( ((EventQuestFailed*)event)->quest ); ! break; ! case GAME_EVENT_ASKFORQUEST: ! GetNextQuest( ((EventAskForQuest*)event)->player ); ! break; ! default: ! break; ! } ! } ! void QuestSource::ProcessQuests() ! { ! RemoveTrash(); ! for ( std::list<Quest*>::iterator iQ = questList.begin(); ! iQ != questList.end(); ! iQ++ ) ! { ! (*iQ)->Process(); ! } } Index: gquest.h =================================================================== RCS file: /cvsroot/timewarp/source/other/gquest.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** gquest.h 3 Feb 2004 13:21:30 -0000 1.7 --- gquest.h 5 Feb 2004 01:36:18 -0000 1.8 *************** *** 33,36 **** --- 33,37 ---- bool exist(); const char * GetName() const; + GobPlayer * GetPlayer(); /*! \brief Process Event */ *************** *** 61,64 **** --- 62,66 ---- QuestSource(); virtual ~QuestSource(); + virtual int LoadQuestList( const char* qlist ); virtual Quest* GetNextQuest( GobPlayer* p ); *************** *** 67,72 **** virtual int QuestFailed( Quest* q ); ! virtual void RemoveTrash(); virtual void ProcessEvent(IEvent* event); }; --- 69,76 ---- virtual int QuestFailed( Quest* q ); ! virtual void RemoveTrash(GobPlayer* pl = NULL); virtual void ProcessEvent(IEvent* event); + + virtual void ProcessQuests(); }; |
From: <yu...@us...> - 2004-02-05 01:38:47
|
Update of /cvsroot/timewarp/gamedata In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24726/gamedata Modified Files: TestQuest.lua Added Files: TestQuestSource.lua Log Message: Every GOB game quest process through QuestSource. --- NEW FILE: TestQuestSource.lua --- -- TODO: everythink need to be converted to human comfortable reading form UNTOUCHED = 0; REJECTED = 1; ASSIGNED = 2; COMPLITED = 3; FAILED = 4; quests = { {name = "ShofixtyQuest", file="gamedata/TestQuest.lua", status = UNTOUCHED }, {name = "ShofixtyQuest", file="gamedata/TestQuest.lua", status = UNTOUCHED } } -- when quest succesfuly complited, -- index - index of complited quest function QuestSuccess( index ) quests[index].status = COMPLITED; end -- when quest failed, -- index - index of complited quest function QuestFailed( index ) (quests[index]).status = FAILED; end -- when player ask for quest function GetNextQuest() if quests[1].status == UNTOUCHED then quests[1].status = ASSIGNED return "gamedata/TestQuest.lua"; end return "NO_DATA" end function GetQuest() end Index: TestQuest.lua =================================================================== RCS file: /cvsroot/timewarp/gamedata/TestQuest.lua,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TestQuest.lua 3 Feb 2004 13:26:07 -0000 1.5 --- TestQuest.lua 5 Feb 2004 01:36:19 -0000 1.6 *************** *** 1,5 **** Complited = 0; -- Quest complitted shoscKilled = 1; -- Shofixti Scout you need to kill ! allready_get_reward = 0; function Process(time, enemy, kills, x, y, res_num1, res_num2, res_str) --- 1,5 ---- Complited = 0; -- Quest complitted shoscKilled = 1; -- Shofixti Scout you need to kill ! Exist = 1; function Process(time, enemy, kills, x, y, res_num1, res_num2, res_str) *************** *** 12,16 **** function GAME_EVENT_ENTER_STATION( locationID ) - if allready_get_reward == 1 then return end -- if locationID == QuestSourceLocationID then if Complited == 1 then return Reward() end --- 12,15 ---- *************** *** 24,28 **** answer = DialogAnswer ( "Thanks!" ) AddBuckazoids(20); ! allready_get_reward = 1; DialogEnd() end --- 23,27 ---- answer = DialogAnswer ( "Thanks!" ) AddBuckazoids(20); ! Exist = 1; DialogEnd() end *************** *** 38,42 **** DialogStart "gamedata/pkunk-standing.bmp" function question1() ! DialogWrite "Hello, my spiritual child. I kill Shofixti Scout for me." answer = DialogAnswer("Why?", "I agree") --- 37,41 ---- DialogStart "gamedata/pkunk-standing.bmp" function question1() ! DialogWrite "Hello, my spiritual child. Kill Shofixti Scout for me." answer = DialogAnswer("Why?", "I agree") |
From: <yu...@us...> - 2004-02-05 01:38:47
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24726/source/games Modified Files: ggob.cpp ggob.h Log Message: Every GOB game quest process through QuestSource. Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ggob.cpp 4 Feb 2004 10:36:27 -0000 1.22 --- ggob.cpp 5 Feb 2004 01:36:19 -0000 1.23 *************** *** 7,11 **** #ifdef ALLEGRO_MSVC ! #pragma warning (disable:4786) #endif --- 7,11 ---- #ifdef ALLEGRO_MSVC ! #pragma warning (disable:4786) #endif [...1371 lines suppressed...] ! game->log_int(p->channel, i); ! if (i == -1) i = random(reference_fleet->getSize()); ! game->redraw(); ! if (reference_fleet->getShipType(i) == p->ship->type) { ! p->starbucks += random() % 80; ! p->buckazoids += random() % 80; ! game->add(new RainbowRift()); ! } ! else { ! p->starbucks += random() % (1+p->value_starbucks); ! p->buckazoids += random() % (1+p->value_buckazoids); ! p->new_ship(reference_fleet->getShipType(i)); ! } ! die(); } } } ! return; } Index: ggob.h =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ggob.h 29 Jan 2004 21:20:28 -0000 1.11 --- ggob.h 5 Feb 2004 01:36:19 -0000 1.12 *************** *** 20,142 **** class GobPlayer { ! public: ! std::list<Quest*> quest; ! ! int channel; ! ~GobPlayer(); ! Ship *ship; ! Control *control; ! ShipPanel *panel; ! struct pair { ! char *id; ! int value; ! }; ! pair *pair_list; ! int num_pairs; ! void _add_pair(const char *id, int value); ! pair *_get_pair(const char *id); ! void write_pair(const char *id, int value); ! int read_pair(const char *id); ! int total; //total upgrades purchased, used in calculating price of future upgrades ! int starbucks; ! int buckazoids; ! int kills; ! int value_starbucks; ! int value_buckazoids; ! TeamCode team; ! void init(Control *c, TeamCode team, GobGame * g); ! void died(SpaceLocation *killer); ! void new_ship(ShipType *type); ! int charge (char *name, int price_starbucks, int price_buckazoids) ; ! Upgrade **upgrade_list; } ; class GobEnemy { ! public: ! Ship *ship; ! int starbucks; ! int buckazoids; ! void init(Ship *ship, int kill_starbucks, int kill_buckazoids); ! void died (SpaceLocation *what); } ; class GobAsteroid : public Asteroid { ! public: ! virtual int handle_damage (SpaceLocation *source, double normal, double direct); ! virtual void death(); }; class GobGame : public Game, public EventHandler { ! ! public: ! virtual ~GobGame(); ! ! TeamCode enemy_team; ! ! virtual void calculate(); ! virtual void ship_died(Ship *who, SpaceLocation *source); ! virtual void preinit(); ! virtual void init (Log *log); ! ! virtual void play_sound (SAMPLE *sample, SpaceLocation *source, int vol = 256, int freq = 1000); ! ! int gobplayers; ! GobPlayer **gobplayer; ! virtual void add_gobplayer(Control *control); ! virtual GobPlayer *get_player(SpaceLocation *what); ! int gobenemies, max_enemies; ! GobEnemy **gobenemy; ! virtual int get_enemy_index(SpaceLocation *what); ! ! // protected: ! virtual void fps (); ! ! ! void add_new_enemy(); ! ! int next_add_new_enemy_time; ! ! SpaceSprite *stationSprite[3]; ! char *station_pic_name[3]; ! char *station_build_name[3]; ! SpaceSprite *defenderSprite; ! ! public: ! int num_planets; ! Planet *planet[16]; ! GobStation *station[16]; ! void add_planet_and_station ( SpaceSprite *planet_sprite, int planet_index, SpaceSprite *station_sprite, const char *builds, const char *background); }; class GobStation : public Orbiter { ! public: ! const char *build_type; ! const char *background_pic; ! GobStation ( SpaceSprite *pic, SpaceLocation *orbit_me, ! const char *ship, const char *background, ! const char *qlist ); ! virtual ~GobStation(); ! virtual void buy_new_ship_menu(GobPlayer *s) ; ! virtual void inflict_damage(SpaceObject *other); ! virtual void station_screen (GobPlayer *s); ! virtual void upgrade_menu(GobStation *station, GobPlayer *gs) ; ! ! QuestSource* quest_source; }; class Upgrade { ! public: ! enum { ! active, inactive ! }; ! char *name; ! int starbucks; ! int buckazoids; ! int status; ! int num; ! int index; virtual bool update(Ship *ship, GobStation *station, GobPlayer *gp) = 0; ! //true if listed virtual void execute(Ship *ship, GobStation *station, GobPlayer *gp) = 0; virtual void charge(GobPlayer *gp); --- 20,140 ---- class GobPlayer { ! public: ! ! int channel; ! ~GobPlayer(); ! Ship *ship; ! Control *control; ! ShipPanel *panel; ! struct pair { ! char *id; ! int value; ! }; ! pair *pair_list; ! int num_pairs; ! void _add_pair(const char *id, int value); ! pair *_get_pair(const char *id); ! void write_pair(const char *id, int value); ! int read_pair(const char *id); ! int total; //total upgrades purchased, used in calculating price of future upgrades ! int starbucks; ! int buckazoids; ! int kills; ! int value_starbucks; ! int value_buckazoids; ! TeamCode team; ! void init(Control *c, TeamCode team, GobGame * g); ! void died(SpaceLocation *killer); ! void new_ship(ShipType *type); ! int charge (char *name, int price_starbucks, int price_buckazoids) ; ! Upgrade **upgrade_list; } ; class GobEnemy { ! public: ! Ship *ship; ! int starbucks; ! int buckazoids; ! void init(Ship *ship, int kill_starbucks, int kill_buckazoids); ! void died (SpaceLocation *what); } ; class GobAsteroid : public Asteroid { ! public: ! virtual int handle_damage (SpaceLocation *source, double normal, double direct); ! virtual void death(); }; class GobGame : public Game, public EventHandler { ! ! public: ! QuestSource* quest_source; ! virtual ~GobGame(); ! ! TeamCode enemy_team; ! ! virtual void calculate(); ! virtual void ship_died(Ship *who, SpaceLocation *source); ! virtual void preinit(); ! virtual void init (Log *log); ! ! virtual void play_sound (SAMPLE *sample, SpaceLocation *source, int vol = 256, int freq = 1000); ! ! int gobplayers; ! GobPlayer **gobplayer; ! virtual void add_gobplayer(Control *control); ! virtual GobPlayer *get_player(SpaceLocation *what); ! int gobenemies, max_enemies; ! GobEnemy **gobenemy; ! virtual int get_enemy_index(SpaceLocation *what); ! ! // protected: ! virtual void fps (); ! ! ! void add_new_enemy(); ! ! int next_add_new_enemy_time; ! ! SpaceSprite *stationSprite[3]; ! char *station_pic_name[3]; ! char *station_build_name[3]; ! SpaceSprite *defenderSprite; ! ! public: ! int num_planets; ! Planet *planet[16]; ! GobStation *station[16]; ! void add_planet_and_station ( SpaceSprite *planet_sprite, int planet_index, SpaceSprite *station_sprite, const char *builds, const char *background); }; class GobStation : public Orbiter { ! public: ! const char *build_type; ! const char *background_pic; ! GobStation ( SpaceSprite *pic, SpaceLocation *orbit_me, ! const char *ship, const char *background, ! const char *qlist ); ! virtual ~GobStation(); ! virtual void buy_new_ship_menu(GobPlayer *s) ; ! virtual void inflict_damage(SpaceObject *other); ! virtual void station_screen (GobPlayer *s); ! virtual void upgrade_menu(GobStation *station, GobPlayer *gs) ; }; class Upgrade { ! public: ! enum { ! active, inactive ! }; ! char *name; ! int starbucks; ! int buckazoids; ! int status; ! int num; ! int index; virtual bool update(Ship *ship, GobStation *station, GobPlayer *gp) = 0; ! //true if listed virtual void execute(Ship *ship, GobStation *station, GobPlayer *gp) = 0; virtual void charge(GobPlayer *gp); *************** *** 146,158 **** class RainbowRift : public SpaceLocation { ! public: ! enum { n = 2 }; ! float p[n * 6 + 2]; ! RGB c[n]; ! int next_time, next_time2; ! RainbowRift (); ! virtual void animate ( Frame *frame ); ! virtual void calculate () ; ! void squiggle(); }; --- 144,156 ---- class RainbowRift : public SpaceLocation { ! public: ! enum { n = 2 }; ! float p[n * 6 + 2]; ! RGB c[n]; ! int next_time, next_time2; ! RainbowRift (); ! virtual void animate ( Frame *frame ); ! virtual void calculate () ; ! void squiggle(); }; |