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
|
From: <yu...@us...> - 2004-02-29 23:33:21
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19676/source/other Modified Files: configrw.cpp gdialog.cpp ttf.cpp Log Message: Fixing Linux compile problems Removing nasty warnings (almoust all now) Index: configrw.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/configrw.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** configrw.cpp 28 Feb 2004 15:18:24 -0000 1.4 --- configrw.cpp 29 Feb 2004 23:22:16 -0000 1.5 *************** *** 160,166 **** void validate_directory(char *fname) { ! char *s = fname; ! while (s = strchr(s, '/')) // yes, this must be =, not == { *s = 0; --- 160,166 ---- void validate_directory(char *fname) { ! char *s = strchr(fname, '/'); ! while (s != NULL ) { *s = 0; *************** *** 174,177 **** --- 174,178 ---- *s = '/'; s += 1; // skip the '/' that you've already found. + s = strchr(s, '/'); } Index: gdialog.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gdialog.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** gdialog.cpp 28 Feb 2004 01:05:49 -0000 1.6 --- gdialog.cpp 29 Feb 2004 23:22:16 -0000 1.7 *************** *** 39,43 **** \return result string */ ! std::string SplitString(std::string source, int chars) { std::string strResult; --- 39,43 ---- \return result string */ ! std::string SplitString(std::string source, unsigned int chars) { std::string strResult; Index: ttf.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/ttf.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ttf.cpp 15 Feb 2004 13:08:10 -0000 1.1 --- ttf.cpp 29 Feb 2004 23:22:16 -0000 1.2 *************** *** 2,9 **** --- 2,12 ---- #include <allegro.h> #include "allegro/internal/aintern.h" + #include "freetype/freetype.h" #include "ttf.h" + #include "util/round.h" + // copy ttf bitmap onto an allegro bitmap static void my_draw_bitmap( FT_Bitmap *src, BITMAP *dest, int dx, int dy ) *************** *** 157,161 **** ymin = face->bbox.yMin; // the bounding box for all chars in this font. ymax = face->bbox.yMax; // this actually defines the origin position... ! yorigin = points_h * double(ymax) / double(ymax - ymin); //char c; --- 160,164 ---- ymin = face->bbox.yMin; // the bounding box for all chars in this font. ymax = face->bbox.yMax; // this actually defines the origin position... ! yorigin = iround(points_h * double(ymax) / double(ymax - ymin)); //char c; |
Update of /cvsroot/timewarp/source/twgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19676/source/twgui Modified Files: twbutton.cpp twbuttontypes.cpp twguilist.cpp twhelpers.cpp twpopup.cpp twwindow.cpp utils.h Log Message: Fixing Linux compile problems Removing nasty warnings (almoust all now) Index: twbutton.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twbutton.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** twbutton.cpp 28 Feb 2004 15:16:32 -0000 1.7 --- twbutton.cpp 29 Feb 2004 23:22:21 -0000 1.8 *************** *** 12,16 **** #include "twwindow.h" ! --- 12,16 ---- #include "twwindow.h" ! #include "util/round.h" *************** *** 393,397 **** { // then, check the bmp if there's a pixel touched... ! return check_visibility(bmpref, mainwindow->mpos.x - pos.x, mainwindow->mpos.y - pos.y); } else return false; --- 393,397 ---- { // then, check the bmp if there's a pixel touched... ! return check_visibility(bmpref, iround(mainwindow->mpos.x - pos.x), iround(mainwindow->mpos.y - pos.y)); } else return false; *************** *** 407,419 **** int x1, y1, x2, y2; ! x1 = pos.x; ! y1 = pos.y; ! x2 = (pos+size).x - 1; ! y2 = (pos+size).y - 1; // draw something simple: int D = 4; // width of the rectangle ! D *= round(mainwindow->scale - 1); if (D < 0) D = 0; --- 407,419 ---- int x1, y1, x2, y2; ! x1 = iround(pos.x); ! y1 = iround(pos.y); ! x2 = iround((pos+size).x - 1); ! y2 = iround((pos+size).y - 1); // draw something simple: int D = 4; // width of the rectangle ! D *= iround(mainwindow->scale - 1); if (D < 0) D = 0; *************** *** 445,456 **** int x1, y1, x2, y2; ! x1 = pos.x; ! y1 = pos.y; ! x2 = (pos+size).x - 1; ! y2 = (pos+size).y - 1; int D = 2; // width of the rectangle ! D = round(D * mainwindow->scale) - 1; // cause 0 also counts as 1... if (D < 0) D = 0; --- 445,456 ---- int x1, y1, x2, y2; ! x1 = iround(pos.x); ! y1 = iround(pos.y); ! x2 = iround((pos+size).x - 1); ! y2 = iround((pos+size).y - 1); int D = 2; // width of the rectangle ! D = iround(D * mainwindow->scale) - 1; // cause 0 also counts as 1... if (D < 0) D = 0; *************** *** 516,523 **** int i, j; int W = 2; ! W = round(W * mainwindow->scale) - 1; int L = 0; ! int Ltotal = 5 * sqrt( (double)bmpref->w * bmpref->h ); double phase = mainwindow->menu_time * 1E-3 * AL_PI; //offset angle --- 516,523 ---- int i, j; int W = 2; ! W = iround(W * mainwindow->scale) - 1; int L = 0; ! int Ltotal = iround(5 * sqrt( (double)bmpref->w * bmpref->h )); double phase = mainwindow->menu_time * 1E-3 * AL_PI; //offset angle *************** *** 537,541 **** if (check_visibility(bmpref, i+wx, j+wy)) { ! putpixel(b, i+pos.x, j+pos.y, //makecol(255,255,255)); rect_fancy_getcolor2(phase, L, Ltotal)); } --- 537,541 ---- if (check_visibility(bmpref, i+wx, j+wy)) { ! putpixel(b, iround(i+pos.x), iround(j+pos.y), //makecol(255,255,255)); rect_fancy_getcolor2(phase, L, Ltotal)); } *************** *** 595,600 **** if (pos != oldpos) { ! set_config_int(0, strx, pos.x); ! set_config_int(0, stry, pos.y); } --- 595,600 ---- if (pos != oldpos) { ! set_config_int(0, strx, iround(pos.x)); ! set_config_int(0, stry, iround(pos.y)); } *************** *** 659,663 **** if (b) { ! masked_blit(b, mainwindow->drawarea, 0, 0, pos.x, pos.y, b->w, b->h); return true; --- 659,663 ---- if (b) { ! masked_blit(b, mainwindow->drawarea, 0, 0, iround(pos.x), iround(pos.y), b->w, b->h); return true; Index: twbuttontypes.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twbuttontypes.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** twbuttontypes.cpp 28 Feb 2004 15:16:32 -0000 1.8 --- twbuttontypes.cpp 29 Feb 2004 23:22:21 -0000 1.9 *************** *** 11,14 **** --- 11,15 ---- #include "twbuttontypes.h" + #include "util/round.h" // to implement a Button, you add bitmaps-feedback to the box-area control *************** *** 124,128 **** clear_to_color(backgr, col); stretch_blit(newb, backgr, 0, 0, newb->w, newb->h, ! 0, 0, newb->w * scale, newb->h * scale); } } --- 125,129 ---- clear_to_color(backgr, col); stretch_blit(newb, backgr, 0, 0, newb->w, newb->h, ! 0, 0, iround(newb->w * scale), iround(newb->h * scale)); } } *************** *** 165,169 **** if (size.x != 0) ! drawarea = create_bitmap_ex(bitmap_color_depth(mainwindow->drawarea), size.x, size.y); else drawarea = 0; --- 166,170 ---- if (size.x != 0) ! drawarea = create_bitmap_ex(bitmap_color_depth(mainwindow->drawarea), iround(size.x), iround(size.y)); else drawarea = 0; *************** *** 182,186 **** void AreaTablet::animate() { ! blit(backgr, drawarea, 0, 0, 0, 0, size.x, size.y); subanimate(); --- 183,187 ---- void AreaTablet::animate() { ! blit(backgr, drawarea, 0, 0, 0, 0, iround(size.x), iround(size.y)); subanimate(); *************** *** 322,329 **** { pmin = bhhalf; ! pmax = size.y - bhhalf; } else { pmin = bwhalf; ! pmax = size.x - bwhalf; } --- 323,330 ---- { pmin = bhhalf; ! pmax = iround(size.y - bhhalf); } else { pmin = bwhalf; ! pmax = iround(size.x - bwhalf); } *************** *** 341,347 **** { if (direction == ver) ! pbutton = mainwindow->mpos.y - pos.y; // mouse pos relative in the little bar area else ! pbutton = mainwindow->mpos.x - pos.x; if (pbutton < pmin) --- 342,348 ---- { if (direction == ver) ! pbutton = iround(mainwindow->mpos.y - pos.y); // mouse pos relative in the little bar area else ! pbutton = iround(mainwindow->mpos.x - pos.x); if (pbutton < pmin) *************** *** 360,366 **** if (direction == ver) ! masked_blit(button, drawarea, 0, 0, size.x/2 - bwhalf, pbutton-bhhalf, button->w, button->h); else ! masked_blit(button, drawarea, 0, 0, pbutton-bwhalf, size.y/2 - bhhalf, button->w, button->h); } --- 361,367 ---- if (direction == ver) ! masked_blit(button, drawarea, 0, 0, iround(size.x/2 - bwhalf), pbutton-bhhalf, button->w, button->h); else ! masked_blit(button, drawarea, 0, 0, pbutton-bwhalf, iround(size.y/2 - bhhalf), button->w, button->h); } *************** *** 374,378 **** // also update the button position to reflect this change ! pbutton = pmin + round(relpos * (pmax - pmin)); } --- 375,379 ---- // also update the button position to reflect this change ! pbutton = pmin + iround(relpos * (pmax - pmin)); } Index: twguilist.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twguilist.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** twguilist.cpp 28 Feb 2004 15:16:32 -0000 1.1 --- twguilist.cpp 29 Feb 2004 23:22:21 -0000 1.2 *************** *** 10,17 **** #include <string.h> ! #include "twgui.h" #include "twwindow.h" ! // ------------ AND NOW THE GRAPHICAL PART --------------- --- 10,17 ---- #include <string.h> ! #include "twgui/twgui.h" #include "twwindow.h" ! #include "util/round.h" // ------------ AND NOW THE GRAPHICAL PART --------------- *************** *** 86,91 **** int xcentre, ycentre; ! xcentre = size.x / 2; ! ycentre = size.y / 2 - text_height(usefont)/2; text_mode(-1); --- 86,91 ---- int xcentre, ycentre; ! xcentre = iround(size.x / 2); ! ycentre = iround(size.y / 2 - text_height(usefont)/2); text_mode(-1); *************** *** 264,268 **** int iy; ! iy = mainwindow->mpos.y - pos.y; iy /= Htxt; // # of item relative to the top --- 264,268 ---- int iy; ! iy = iround(mainwindow->mpos.y - pos.y); iy /= Htxt; // # of item relative to the top *************** *** 297,301 **** int iy; ! iy = mainwindow->mpos.y - pos.y; iy /= Htxt; // # of item relative to the top --- 297,301 ---- int iy; ! iy = iround(mainwindow->mpos.y - pos.y); iy /= Htxt; // # of item relative to the top *************** *** 485,489 **** for ( k = 0; k < L; ++k ) { ! if (txt[k] < 20 || txt[k] > 128 ) txt[k] = ' '; } --- 485,489 ---- for ( k = 0; k < L; ++k ) { ! if (txt[k] < 20 || txt[k] > 127 ) txt[k] = ' '; } *************** *** 573,578 **** int ix, iy; ! iy = mainwindow->mpos.y - pos.y; ! ix = mainwindow->mpos.x - pos.x; iy += scroll.y * textinfo->Htxt; // scroll->y = 1st item at the top --- 573,578 ---- int ix, iy; ! iy = iround(mainwindow->mpos.y - pos.y); ! ix = iround(mainwindow->mpos.x - pos.x); iy += scroll.y * textinfo->Htxt; // scroll->y = 1st item at the top *************** *** 836,840 **** for ( k = 0; k < L; ++k ) { ! if (txt[k] < 20 || txt[k] > 128 ) txt[k] = ' '; } --- 836,840 ---- for ( k = 0; k < L; ++k ) { ! if (txt[k] < 20 || txt[k] > 127 ) txt[k] = ' '; } *************** *** 910,915 **** Hicon = overlay->h; ! Nxshow = round( size.x / double(Wicon) ); ! Nyshow = round( size.y / double(Hicon) ); itemproperty = 0; --- 910,915 ---- Hicon = overlay->h; ! Nxshow = iround( size.x / double(Wicon) ); ! Nyshow = iround( size.y / double(Hicon) ); itemproperty = 0; *************** *** 941,945 **** // create the most "optimal" square map (minimum x,y positions means least search trouble (I think)). ! Nx = round( sqrt((double)maxitems) ); Ny = maxitems/Nx + 1; --- 941,945 ---- // create the most "optimal" square map (minimum x,y positions means least search trouble (I think)). ! Nx = iround( sqrt((double)maxitems) ); Ny = maxitems/Nx + 1; *************** *** 981,986 **** { // control is handled by the mouse ! scroll.xselect = scroll.x + (mainwindow->mpos.x - pos.x) / Wicon; // mouse coordinate within the matrix area ! scroll.yselect = scroll.y + (mainwindow->mpos.y - pos.y) / Hicon; } --- 981,986 ---- { // control is handled by the mouse ! scroll.xselect = iround(scroll.x + (mainwindow->mpos.x - pos.x) / Wicon); // mouse coordinate within the matrix area ! scroll.yselect = iround(scroll.y + (mainwindow->mpos.y - pos.y) / Hicon); } *************** *** 1011,1016 **** int w0, h0; ! w0 = round(listIcon[k]->w * mainwindow->scale * extrascale); ! h0 = round(listIcon[k]->h * mainwindow->scale * extrascale); // create a intermediate icon --- 1011,1016 ---- int w0, h0; ! w0 = iround(listIcon[k]->w * mainwindow->scale * extrascale); ! h0 = iround(listIcon[k]->h * mainwindow->scale * extrascale); // create a intermediate icon *************** *** 1042,1046 **** //a = 0.5 + 0.5 * sin(areareserve->menu_time * 1E-3 * 2*PI / 10); a = 0.5; ! rect(drawarea, i*Wicon, j*Hicon, (i+1)*Wicon-1, (j+1)*Hicon-1, makecol(20*a,100*a,200*a)); } --- 1042,1046 ---- //a = 0.5 + 0.5 * sin(areareserve->menu_time * 1E-3 * 2*PI / 10); a = 0.5; ! rect(drawarea, i*Wicon, j*Hicon, (i+1)*Wicon-1, (j+1)*Hicon-1, makecol(iround(20*a),iround(100*a),iround(200*a))); } *************** *** 1052,1060 **** // mouse position relative to the center of the item window: ! mx = mainwindow->mpos.x - pos.x - size.x / 2; ! my = mainwindow->mpos.y - pos.y - size.y / 2; // velocity depends on how far you're away from the center. ! scroll.add(mx / (size.x/8), my / (size.y/8)); } --- 1052,1060 ---- // mouse position relative to the center of the item window: ! mx = iround(mainwindow->mpos.x - pos.x - size.x / 2); ! my = iround(mainwindow->mpos.y - pos.y - size.y / 2); // velocity depends on how far you're away from the center. ! scroll.add(iround(mx / (size.x/8)), iround(my / (size.y/8))); } Index: twhelpers.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twhelpers.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** twhelpers.cpp 28 Feb 2004 15:16:32 -0000 1.5 --- twhelpers.cpp 29 Feb 2004 23:22:21 -0000 1.6 *************** *** 14,18 **** #include "twhelpers.h" ! ScrollControl::ScrollControl() --- 14,18 ---- #include "twhelpers.h" ! #include "util/round.h" ScrollControl::ScrollControl() *************** *** 131,135 **** void ScrollControl::set_percent_pos_x(double alpha) { ! x = round( (Nx-1) * alpha ); check_pos(); } --- 131,135 ---- void ScrollControl::set_percent_pos_x(double alpha) { ! x = iround( (Nx-1) * alpha ); check_pos(); } *************** *** 137,141 **** void ScrollControl::set_percent_pos_y(double alpha) { ! y = round( (Ny-1) * alpha ); check_pos(); } --- 137,141 ---- void ScrollControl::set_percent_pos_y(double alpha) { ! y = iround( (Ny-1) * alpha ); check_pos(); } Index: twpopup.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twpopup.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** twpopup.cpp 28 Feb 2004 15:16:32 -0000 1.5 --- twpopup.cpp 29 Feb 2004 23:22:21 -0000 1.6 *************** *** 13,17 **** #include "twpopup.h" ! --- 13,17 ---- #include "twpopup.h" ! #include "util/round.h" *************** *** 182,187 **** init_components(identbranch); ! xshift = round(axshift * scale); ! yshift = round(ayshift * scale); } --- 182,187 ---- init_components(identbranch); ! xshift = iround(axshift * scale); ! yshift = iround(ayshift * scale); } *************** *** 196,201 **** init_components(identbranch); ! xshift = round(axshift * scale); ! yshift = round(ayshift * scale); } --- 196,201 ---- init_components(identbranch); ! xshift = iround(axshift * scale); ! yshift = iround(ayshift * scale); } *************** *** 262,267 **** if (option.place_relative2mouse) { ! x = trigger->mainwindow->x + trigger->mainwindow->mpos.x + xshift; ! y = trigger->mainwindow->y + trigger->mainwindow->mpos.y + yshift; } else if (option.place_relative2window) { x = trigger->mainwindow->x + xshift; --- 262,267 ---- if (option.place_relative2mouse) { ! x = iround(trigger->mainwindow->x + trigger->mainwindow->mpos.x + xshift); ! y = iround(trigger->mainwindow->y + trigger->mainwindow->mpos.y + yshift); } else if (option.place_relative2window) { x = trigger->mainwindow->x + xshift; Index: twwindow.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twwindow.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** twwindow.cpp 28 Feb 2004 15:16:32 -0000 1.10 --- twwindow.cpp 29 Feb 2004 23:22:21 -0000 1.11 *************** *** 11,14 **** --- 11,15 ---- #include "twwindow.h" + #include "util/round.h" // this destroys the bitmap (if it exists i.e. isn't set to 0), *************** *** 108,113 **** if (backgr) { ! x = round(dx * scale); ! y = round(dy * scale); W = backgr->w; // background is already scaled !! H = backgr->h; --- 109,114 ---- if (backgr) { ! x = iround(dx * scale); ! y = iround(dy * scale); W = backgr->w; // background is already scaled !! H = backgr->h; *************** *** 417,422 **** // move ! x = round(xcenter*scale) - W / 2; ! y = round(ycenter*scale) - H / 2; // read the new background --- 418,423 ---- // move ! x = iround(xcenter*scale) - W / 2; ! y = iround(ycenter*scale) - H / 2; // read the new background *************** *** 533,538 **** // this test is performed in relative coordinates (with respect to the (0,0) corner // of the reserved area). ! xrel = mpos.x; ! yrel = mpos.y; if ( xrel >= 0 && xrel < W && --- 534,539 ---- // this test is performed in relative coordinates (with respect to the (0,0) corner // of the reserved area). ! xrel = iround(mpos.x); ! yrel = iround(mpos.y); if ( xrel >= 0 && xrel < W && *************** *** 766,777 **** void TWindow::scalepos(int *ax, int *ay) { ! (*ax) = round( (*ax) * scale ); ! (*ay) = round( (*ay) * scale ); } void TWindow::scalepos(twguiVector *apos) { ! (apos->x) = round( (apos->x) * scale ); ! (apos->y) = round( (apos->y) * scale ); } --- 767,778 ---- void TWindow::scalepos(int *ax, int *ay) { ! (*ax) = iround( (*ax) * scale ); ! (*ay) = iround( (*ay) * scale ); } void TWindow::scalepos(twguiVector *apos) { ! (apos->x) = iround( (apos->x) * scale ); ! (apos->y) = iround( (apos->y) * scale ); } *************** *** 828,832 **** // first, test the "apos" position for a match. ! if (matchimage(backgr_forsearch, bmp_default, apos->x, apos->y)) return true; // return without changing the position... --- 829,833 ---- // first, test the "apos" position for a match. ! if (matchimage(backgr_forsearch, bmp_default, iround(apos->x), iround(apos->y))) return true; // return without changing the position... Index: utils.h =================================================================== RCS file: /cvsroot/timewarp/source/twgui/utils.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** utils.h 28 Feb 2004 15:16:32 -0000 1.9 --- utils.h 29 Feb 2004 23:22:21 -0000 1.10 *************** *** 20,27 **** void twgui_init(twgui_time_handler_type t, twgui_err_handler_type f); - int round(double x); - - - int mapkey(int scancode_key, int scancode_ctrl = 0); int unmapkey1(int k); --- 20,23 ---- |
From: <yu...@us...> - 2004-02-29 23:32:55
|
Update of /cvsroot/timewarp/source/sc1ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19676/source/sc1ships Modified Files: shparisk.cpp shpchebr.cpp shpsyrpe.cpp Log Message: Fixing Linux compile problems Removing nasty warnings (almoust all now) Index: shparisk.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shparisk.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** shparisk.cpp 29 Jan 2004 21:20:31 -0000 1.5 --- shparisk.cpp 29 Feb 2004 23:22:20 -0000 1.6 *************** *** 50,54 **** game->add(new Animation(this, pos, ! specialSprite, 0, 40, specialFrames/40, DEPTH_HOTSPOTS-0.1)); Vector2 d = Vector2 ( --- 50,54 ---- game->add(new Animation(this, pos, ! specialSprite, 0, 40, iround(specialFrames/40), DEPTH_HOTSPOTS-0.1)); Vector2 d = Vector2 ( *************** *** 60,64 **** game->add(new Animation(this, pos, ! specialSprite, 0, 40, specialFrames/40, DEPTH_HOTSPOTS-0.1)); return(TRUE); } --- 60,64 ---- game->add(new Animation(this, pos, ! specialSprite, 0, 40, iround(specialFrames/40), DEPTH_HOTSPOTS-0.1)); return(TRUE); } Index: shpchebr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpchebr.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** shpchebr.cpp 29 Jan 2004 21:20:31 -0000 1.7 --- shpchebr.cpp 29 Feb 2004 23:22:20 -0000 1.8 *************** *** 64,68 **** return(FALSE); weaponObject = new ChenjesuShot(Vector2(0.0, (size.y / 2.0)), angle, ! weaponVelocity, weaponDamage, weaponArmour, this, data->spriteWeapon); game->add(weaponObject); weaponFired = TRUE; --- 64,68 ---- return(FALSE); weaponObject = new ChenjesuShot(Vector2(0.0, (size.y / 2.0)), angle, ! weaponVelocity, iround(weaponDamage), iround(weaponArmour), this, data->spriteWeapon); game->add(weaponObject); weaponFired = TRUE; *************** *** 76,80 **** ChenjesuDOGI* DOGI; //added by Varith DOGI = (new ChenjesuDOGI( Vector2(0.0, -size.y / 1.5), ! angle + PI, specialVelocity, specialFuelSap, specialArmour, specialAccelRate, specialMass, this, data->spriteSpecial, &specialNumDOGIs)); --- 76,80 ---- ChenjesuDOGI* DOGI; //added by Varith DOGI = (new ChenjesuDOGI( Vector2(0.0, -size.y / 1.5), ! angle + PI, specialVelocity, iround(specialFuelSap), iround(specialArmour), specialAccelRate, specialMass, this, data->spriteSpecial, &specialNumDOGIs)); Index: shpsyrpe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc1ships/shpsyrpe.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpsyrpe.cpp 29 Jan 2004 21:20:31 -0000 1.9 --- shpsyrpe.cpp 29 Feb 2004 23:22:20 -0000 1.10 *************** *** 71,78 **** if (callDamage > specialDamage) callDamage = specialDamage; callDamage += (random() % specialDamage); ! if ((target->getCrew() - callDamage) < 1) callDamage = target->getCrew() - 1; ! int old = target->getCrew(); damage(target, 0, callDamage); ! callDamage = old - target->getCrew(); for(int i = 0; i < callDamage; i++) { add(new CrewPod( --- 71,78 ---- if (callDamage > specialDamage) callDamage = specialDamage; callDamage += (random() % specialDamage); ! if ((target->getCrew() - callDamage) < 1) callDamage = iround(target->getCrew() - 1); ! int old = iround(target->getCrew()); damage(target, 0, callDamage); ! callDamage = iround(old - target->getCrew()); for(int i = 0; i < callDamage; i++) { add(new CrewPod( |
From: <yu...@us...> - 2004-02-29 23:32:55
|
Update of /cvsroot/timewarp/source/gamex/stuff In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19676/source/gamex/stuff Modified Files: space_body.cpp Log Message: Fixing Linux compile problems Removing nasty warnings (almoust all now) Index: space_body.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/stuff/space_body.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** space_body.cpp 15 Feb 2004 13:08:57 -0000 1.9 --- space_body.cpp 29 Feb 2004 23:22:20 -0000 1.10 *************** *** 39,51 **** int ymin_visual, ymax_visual, ymin, ymax; ! ymin_visual = iround(-R/b_sqrt) + center.y; ! ymax_visual = iround( (R+1)/b_sqrt) + center.y; if (ymin_visual < 0) ymin_visual = 0; if (ymax_visual > space_view_size.y) ! ymax_visual = space_view_size.y; ! ymin = ymin_visual - center.y; ! ymax = ymax_visual - center.y; if (ymin > ymax) --- 39,51 ---- int ymin_visual, ymax_visual, ymin, ymax; ! ymin_visual = iround(-R/b_sqrt + center.y); ! ymax_visual = iround( (R+1)/b_sqrt + center.y); if (ymin_visual < 0) ymin_visual = 0; if (ymax_visual > space_view_size.y) ! ymax_visual = iround(space_view_size.y); ! ymin = ymin_visual - iround(center.y); ! ymax = ymax_visual - iround(center.y); if (ymin > ymax) *************** *** 62,66 **** } ! putpixel(f->surface, xref + center.x, yref + center.y, col); // half a circle (downwards) of possible new locations to put a new pixel; radius = 2 --- 62,66 ---- } ! putpixel(f->surface, xref + iround(center.x), yref + iround(center.y), col); // half a circle (downwards) of possible new locations to put a new pixel; radius = 2 *************** *** 113,118 **** yref += dy[jbest]; ! putpixel(f->surface, xref + center.x, yref + center.y, col); ! putpixel(f->surface, -xref + center.x, yref + center.y, col); } --- 113,118 ---- yref += dy[jbest]; ! putpixel(f->surface, xref + iround(center.x), yref + iround(center.y), col); ! putpixel(f->surface, -xref + iround(center.x), yref + iround(center.y), col); } *************** *** 211,222 **** if (!(r == 255 && g == 0 && b == 255)) { ! r *= I; ! g *= I; ! b *= I; // don't add too much ... ! r += J * 128; ! g += J * 128; ! b += J * 128; if (r > 255) r = 255; --- 211,222 ---- if (!(r == 255 && g == 0 && b == 255)) { ! r *= iround(I); ! g *= iround(I); ! b *= iround(I); // don't add too much ... ! r += iround(J * 128); ! g += iround(J * 128); ! b += iround(J * 128); if (r > 255) r = 255; |
From: <yu...@us...> - 2004-02-29 23:32:55
|
Update of /cvsroot/timewarp/source/gamex/general In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19676/source/gamex/general Modified Files: sprites.cpp Log Message: Fixing Linux compile problems Removing nasty warnings (almoust all now) Index: sprites.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/general/sprites.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** sprites.cpp 15 Feb 2004 13:08:57 -0000 1.7 --- sprites.cpp 29 Feb 2004 23:22:20 -0000 1.8 *************** *** 134,140 **** if (!(r == 255 && g == 0 && b == 255)) { ! r *= mr; ! g *= mg; ! b *= mb; if (r > 255) r = 255; --- 134,140 ---- if (!(r == 255 && g == 0 && b == 255)) { ! r *= iround(mr); ! g *= iround(mg); ! b *= iround(mb); if (r > 255) r = 255; |
Update of /cvsroot/timewarp/source/sc2ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19676/source/sc2ships Modified Files: shpchmav.cpp shpmeltr.cpp shporzne.cpp shppkufu.cpp shpslypr.cpp shpthrto.cpp Log Message: Fixing Linux compile problems Removing nasty warnings (almoust all now) Index: shpchmav.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpchmav.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpchmav.cpp 29 Jan 2004 21:20:31 -0000 1.11 --- shpchmav.cpp 29 Feb 2004 23:22:20 -0000 1.12 *************** *** 288,292 **** int ChmmrZapSat::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = normal + direct; if (total) { armour -= total; --- 288,292 ---- int ChmmrZapSat::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = iround(normal + direct); if (total) { armour -= total; Index: shpmeltr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpmeltr.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpmeltr.cpp 29 Jan 2004 21:20:31 -0000 1.8 --- shpmeltr.cpp 29 Feb 2004 23:22:20 -0000 1.9 *************** *** 179,186 **** int MelnormeShot::handle_damage(SpaceLocation *source, double normal, double direct) { ! int old = armour; ! int r = Shot::handle_damage(source, normal, direct); if (!released && (armour > 0)) armour = old; ! return old - armour; } --- 179,186 ---- int MelnormeShot::handle_damage(SpaceLocation *source, double normal, double direct) { ! int old = iround(armour); ! Shot::handle_damage(source, normal, direct); if (!released && (armour > 0)) armour = old; ! return iround(old - armour); } Index: shporzne.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shporzne.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shporzne.cpp 22 Feb 2004 10:49:39 -0000 1.12 --- shporzne.cpp 29 Feb 2004 23:22:20 -0000 1.13 *************** *** 364,368 **** int OrzMarine::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = normal + direct; armour -= total; if(armour <= 0) --- 364,368 ---- int OrzMarine::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = iround(normal + direct); armour -= total; if(armour <= 0) Index: shppkufu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shppkufu.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shppkufu.cpp 29 Jan 2004 21:20:31 -0000 1.10 --- shppkufu.cpp 29 Feb 2004 23:22:20 -0000 1.11 *************** *** 26,30 **** int PkunkFury::handle_damage(SpaceLocation *source, double normal, double direct) { ! double r = normal + direct; crew -= r; if (crew > 0) return r; --- 26,30 ---- int PkunkFury::handle_damage(SpaceLocation *source, double normal, double direct) { ! int r = iround(normal + direct); crew -= r; if (crew > 0) return r; Index: shpslypr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpslypr.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpslypr.cpp 29 Jan 2004 21:20:31 -0000 1.12 --- shpslypr.cpp 29 Feb 2004 23:22:20 -0000 1.13 *************** *** 344,348 **** { lastnseg[iline] = nseg[iline]; ! nseg[iline] = 1 + MAXsegs * (-0.00001 + sin(relativelifetime * PI)); if ( nseg[iline] > MAXsegs ) --- 344,348 ---- { lastnseg[iline] = nseg[iline]; ! nseg[iline] = iround(1 + MAXsegs * (-0.00001 + sin(relativelifetime * PI))); if ( nseg[iline] > MAXsegs ) *************** *** 427,442 **** int x1, y1, x2, y2, dx, dy, sx, sy; ! x1 = mother->pos.x + (int)lights[i].pos1.x; ! y1 = mother->pos.y + (int)lights[i].pos1.y; ! x2 = mother->pos.x + (int)lights[i].pos2.x; ! y2 = mother->pos.y + (int)lights[i].pos2.y; // position of the target sprite: ! sx = q.currento->pos.x; ! sy = q.currento->pos.y; // you may have to re-locate this position, to correct for normalization ?! ! dx = min_delta(sx, x1, map_size.x); ! dy = min_delta(sy, y1, map_size.y); sx = x1 + dx; --- 427,442 ---- int x1, y1, x2, y2, dx, dy, sx, sy; ! x1 = iround(mother->pos.x + lights[i].pos1.x); ! y1 = iround(mother->pos.y + lights[i].pos1.y); ! x2 = iround(mother->pos.x + lights[i].pos2.x); ! y2 = iround(mother->pos.y + lights[i].pos2.y); // position of the target sprite: ! sx = iround(q.currento->pos.x); ! sy = iround(q.currento->pos.y); // you may have to re-locate this position, to correct for normalization ?! ! dx = iround(min_delta(sx, x1, map_size.x)); ! dy = iround(min_delta(sy, y1, map_size.y)); sx = x1 + dx; Index: shpthrto.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc2ships/shpthrto.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpthrto.cpp 29 Jan 2004 21:20:31 -0000 1.10 --- shpthrto.cpp 29 Feb 2004 23:22:20 -0000 1.11 *************** *** 78,82 **** int ThraddashFlame::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = normal + direct; armour -= total; --- 78,82 ---- int ThraddashFlame::handle_damage(SpaceLocation *source, double normal, double direct) { ! int total = iround(normal + direct); armour -= total; |
From: <yu...@us...> - 2004-02-29 23:32:55
|
Update of /cvsroot/timewarp/source/sc3ships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19676/source/sc3ships Modified Files: shpowavo.cpp Log Message: Fixing Linux compile problems Removing nasty warnings (almoust all now) Index: shpowavo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/sc3ships/shpowavo.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** shpowavo.cpp 29 Jan 2004 21:20:31 -0000 1.8 --- shpowavo.cpp 29 Feb 2004 23:22:20 -0000 1.9 *************** *** 186,190 **** shrap = (new OwaShrapnel(0,angle+deg ,shrapnelVelocity, shrapnelDamage, shrapnelRange, shrapnelArmour, shrapnelHoming, ! shrapnelArming, this, shrapnelSprite, shrapnelHotspot)); deg -= 10 * ANGLE_RATIO; add(shrap); --- 186,190 ---- shrap = (new OwaShrapnel(0,angle+deg ,shrapnelVelocity, shrapnelDamage, shrapnelRange, shrapnelArmour, shrapnelHoming, ! iround(shrapnelArming), this, shrapnelSprite, shrapnelHotspot)); deg -= 10 * ANGLE_RATIO; add(shrap); |
From: <geo...@us...> - 2004-02-29 18:57:06
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28575/melee Modified Files: mlog.cpp mlog.h mmain.cpp Log Message: no message Index: mlog.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mlog.cpp 29 Feb 2004 15:09:04 -0000 1.9 --- mlog.cpp 29 Feb 2004 18:46:40 -0000 1.10 *************** *** 317,334 **** static int Nshare = 0; ! static int share_channel[512]; ! static int share_size[512]; ! static void *share_address[512]; ! void share_buffer(int channel, void *value, int size) { share_channel[Nshare] = channel; share_address[Nshare] = value; share_size[Nshare] = size; ! game->log->buffer(share_channel[Nshare], share_address[Nshare], share_size[Nshare]); ! game->log->flush(); ++Nshare; --- 317,376 ---- + static enum share_types {TYPE_CHAR, TYPE_SHORT, TYPE_INT}; + static const int max_share = 512; static int Nshare = 0; ! static int share_channel[max_share]; ! static int share_size[max_share]; ! static void *share_address[max_share]; ! static int share_type[max_share]; ! static int share_num[max_share]; ! ! void share_intel_order(int n, int i) ! { ! switch(share_type[n]) ! { ! case TYPE_SHORT: ! { ! short int &x = *((short int*) (share_address[n]) + i); ! x = intel_ordering_short(x); ! } ! break; ! ! case TYPE_INT: ! { ! int &x = *((int*) (share_address[n]) + i); ! x = intel_ordering(x); ! } ! break; ! } ! } ! ! void share_buffer(int channel, void *value, int num, int size, share_types st) { share_channel[Nshare] = channel; share_address[Nshare] = value; + + share_num[Nshare] = num; share_size[Nshare] = size; ! share_type[Nshare] = st; ! ! // change bit-order of each element in an array ! int i; ! for ( i = 0; i < share_num[Nshare]; ++i ) ! share_intel_order(Nshare, i); ! ! // buffer an array ! game->log->buffer(share_channel[Nshare], ! share_address[Nshare], ! share_num[Nshare] * share_size[Nshare]); ! ! // restore bit-order of each element in an array ! for ( i = 0; i < share_num[Nshare]; ++i ) ! share_intel_order(Nshare, i); ! ! //game->log->flush(); ++Nshare; *************** *** 341,349 **** */ ! void share(int channel, int *value) { ! share_buffer(channel, value, sizeof(int)); } /** \brief Retrieves the values that were sent for sharing, and writes the values to the proper memory locations. --- 383,406 ---- */ ! void share(int channel, int *value, int num) { ! share_buffer(channel, value, num, sizeof(int), TYPE_INT); ! } ! ! ! void share(int channel, short *value, int num) ! { ! share_buffer(channel, value, num, sizeof(short), TYPE_SHORT); ! } ! ! ! void share(int channel, char *value, int num) ! { ! share_buffer(channel, value, num, sizeof(char), TYPE_CHAR); } + + + /** \brief Retrieves the values that were sent for sharing, and writes the values to the proper memory locations. *************** *** 351,363 **** void share_update() { ! game->log->listen(); ! int i; ! for ( i = 0; i < Nshare; ++i ) { ! game->log->unbuffer(share_channel[i], share_address[i], share_size[i]); } Nshare = 0; - } --- 408,431 ---- void share_update() { ! // do it here, cause why would you want to wait for each little packet till it ! // can be sent onto the net ? ! game->log->flush(); ! // superfluous, cause this is already used inside the unbuffer routine. ! //game->log->listen(); ! ! ! int n; ! for ( n = 0; n < Nshare; ++n ) { ! // unbuffer an array ! game->log->unbuffer(share_channel[n], share_address[n], share_size[n] * share_num[n]); ! ! // sort out bit-ordering for all values in the array ! int i; ! for ( i = 0; i < share_num[n]; ++i ) ! share_intel_order(n, i); } Nshare = 0; } Index: mlog.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** mlog.h 29 Feb 2004 15:09:04 -0000 1.5 --- mlog.h 29 Feb 2004 18:46:40 -0000 1.6 *************** *** 64,68 **** }; ! void share(int channel, int *value); void share_update(); --- 64,70 ---- }; ! void share(int channel, int *value, int num = 1); ! void share(int channel, short *value, int num = 1); ! void share(int channel, char *value, int num = 1); void share_update(); Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** mmain.cpp 29 Feb 2004 15:09:04 -0000 1.25 --- mmain.cpp 29 Feb 2004 18:46:40 -0000 1.26 *************** *** 495,498 **** --- 495,502 ---- int *slot = new int[num_players]; //choose ships and send them across network + + if (log_totalsize() > 0) + tw_error("Log isn't empty (a)"); + for (i = 0; i < num_players; i += 1) { slot[i] = -2; *************** *** 513,516 **** --- 517,521 ---- slot[i] = player_control[i]->choose_ship(window, buffy, fleet); + /* if (player_control[i]->channel != channel_none) { slot[i] = intel_ordering(slot[i]); *************** *** 519,525 **** --- 524,534 ---- //slot[i] = intel_ordering(slot[i]); } + */ + share(player_control[i]->channel, &slot[i]); } } + //recieve the ships that were chosen + /* log->listen(); for (i = 0; i < num_players; i += 1) { *************** *** 530,533 **** --- 539,549 ---- } } + */ + + share_update(); + + if (log_totalsize() > 0) + tw_error("Log isn't empty (b)"); + //create the ships that were chosen for (i = 0; i < num_players; i += 1) { *************** *** 726,729 **** --- 742,746 ---- } + // networking share_update(); |
From: <geo...@us...> - 2004-02-29 15:19:23
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18292/melee Modified Files: mlog.cpp mlog.h mmain.cpp mmain.h Log Message: changed the victory handling a little to support networking better, but it crashes... Index: mlog.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mlog.cpp 17 Feb 2004 15:22:26 -0000 1.8 --- mlog.cpp 29 Feb 2004 15:09:04 -0000 1.9 *************** *** 313,314 **** --- 313,363 ---- return; } + + + + + static int Nshare = 0; + static int share_channel[512]; + static int share_size[512]; + static void *share_address[512]; + + + void share_buffer(int channel, void *value, int size) + { + share_channel[Nshare] = channel; + share_address[Nshare] = value; + share_size[Nshare] = size; + + game->log->buffer(share_channel[Nshare], share_address[Nshare], share_size[Nshare]); + game->log->flush(); + + ++Nshare; + } + + /** \brief Share an integer value at a memory location across the network. This is pushed + on a stack, and has to be read afterwards. Note that no other networking operation should + occur between the share and share_update(). It uses the global game->log. NOTE, that there + is no "intel_buffering" done, so it's probably a problem between different machine types. + */ + + void share(int channel, int *value) + { + share_buffer(channel, value, sizeof(int)); + } + + /** \brief Retrieves the values that were sent for sharing, and writes the values + to the proper memory locations. + */ + void share_update() + { + game->log->listen(); + + int i; + for ( i = 0; i < Nshare; ++i ) + { + game->log->unbuffer(share_channel[i], share_address[i], share_size[i]); + } + + Nshare = 0; + + } Index: mlog.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mlog.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mlog.h 10 Jan 2004 22:27:59 -0000 1.4 --- mlog.h 29 Feb 2004 15:09:04 -0000 1.5 *************** *** 64,66 **** --- 64,70 ---- }; + void share(int channel, int *value); + void share_update(); + + #endif // __MLOG_H__ Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** mmain.cpp 29 Feb 2004 10:37:03 -0000 1.24 --- mmain.cpp 29 Feb 2004 15:09:04 -0000 1.25 *************** *** 324,336 **** static int kill_all_delay_counter = 0; ! void NormalGame::calculate() {STACKTRACE Game::calculate(); if (next_choose_new_ships_time <= game_time) { - choose_new_ships(); - next_choose_new_ships_time = game_time + 24*60*60*1000; - if (check_end()) handle_end(); } --- 324,345 ---- static int kill_all_delay_counter = 0; ! void NormalGame::calculate() ! { ! STACKTRACE; ! Game::calculate(); + if (next_choose_new_ships_time <= game_time) { if (check_end()) + { handle_end(); + //return; + } + else + { + choose_new_ships(); + next_choose_new_ships_time = game_time + 24*60*60*1000; + } } *************** *** 625,628 **** --- 634,640 ---- + + + bool NormalGame::player_isalive(int i) { *************** *** 648,683 **** ! void NormalGame::handle_end() { ! // dunno if this is ok in a networked game. ! // find the local player int i; for ( i = 0; i < num_players; ++i ) { ! if (player_control[i]->channel == channel_server && ! strcmp(player_control[i]->getTypeName(), "Keyboard/Joystick") == 0) ! break; } ! if (i == num_players) // error? ! i = 0; - char *endmessage = 0; - if (player_isalive(i)) - endmessage = "Victory"; - else - endmessage = "Game Over"; ! // in a networked game, I suppose just the host should have this option. How to do that ?? ! int ichoice = tw_alert(endmessage, "&QUIT", "&RESTART"); ! if (ichoice == 1) { ! quit(endmessage); } else { - int i; char buffy[512]; for ( i = 0; i < num_players; ++i ) --- 660,759 ---- ! int NormalGame::local_player() { ! int i; ! for ( i = 0; i < num_players; ++i ) ! if (is_local(player_control[i]->channel)) ! return i; ! return -1; ! } ! int NormalGame::log_totalsize() ! { ! int test = 0; int i; for ( i = 0; i < num_players; ++i ) { ! int k = player_control[i]->channel; ! test += game->log->log_len[k] - game->log->log_pos[k]; } ! return test; ! } ! void NormalGame::handle_end() ! { ! // pause all players, so that networking sends are only within this routine !! ! pause(); ! int i; ! // I guess, you've to make sure, the log-buffer is empty, before writing/reading ! // values to/from it .. ! ! ! if (log_totalsize() > 0) ! tw_error("Log isn't empty (a)"); ! ! // I suppose, each player is making/ has made such a choice ... ! int choices[16]; ! int k; ! for ( k = 0; k < num_players; ++k ) { ! int ichoice = 9; ! ! // channel_server is always the local channel ? ! if (is_local(player_control[k]->channel)) ! { ! char *endmessage; ! if (player_isalive(k)) ! endmessage = "Victory"; ! else ! endmessage = "Game Over"; ! ! char tmp[512]; ! sprintf(tmp, "%s num = %i channel = %i", endmessage, k, player_control[k]->channel); ! ! ichoice = tw_alert(tmp, "&QUIT", "&RESTART"); ! } ! ! //log_int(player_control[k]->channel, ichoice); ! ! choices[k] = ichoice; ! ! // networking ! share(player_control[k]->channel, &choices[k]); } + + // networking + share_update(); + + + if (log_totalsize() > 0) + tw_error("Log isn't empty (b)"); + + + // check if all the players want to restart, or quit, if not, give a warning and quit + k = 0; + for ( i = 0; i < num_players; ++i ) + if (k += choices[i]) + + // disagreement + if ( k != 1*num_players && k != 2*num_players ) + { + // give a warning to the local player + if (choices[ local_player() ] == 2) + tw_alert("Someone aborted", "&Continue"); + + quit("none"); + } + // agreement on quitting + else if ( k == 1*num_players ) + { + quit("none"); + } + // agreement on restarting else { char buffy[512]; for ( i = 0; i < num_players; ++i ) *************** *** 696,701 **** --- 772,780 ---- } + unpause(); } + + REGISTER_GAME(NormalGame, "Melee") Index: mmain.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mmain.h 29 Feb 2004 10:37:03 -0000 1.9 --- mmain.h 29 Feb 2004 15:09:04 -0000 1.10 *************** *** 58,61 **** --- 58,63 ---- void handle_end(); bool player_isalive(int i); + int local_player(); + int log_totalsize(); }; |
From: <geo...@us...> - 2004-02-29 10:47:13
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31103/melee Modified Files: mmain.cpp mmain.h Log Message: added a simple victory condition to standard melee Index: mmain.cpp =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** mmain.cpp 20 Feb 2004 08:42:44 -0000 1.23 --- mmain.cpp 29 Feb 2004 10:37:03 -0000 1.24 *************** *** 326,332 **** void NormalGame::calculate() {STACKTRACE Game::calculate(); ! if (next_choose_new_ships_time <= game_time) { choose_new_ships(); next_choose_new_ships_time = game_time + 24*60*60*1000; } --- 326,337 ---- void NormalGame::calculate() {STACKTRACE Game::calculate(); ! if (next_choose_new_ships_time <= game_time) ! { choose_new_ships(); next_choose_new_ships_time = game_time + 24*60*60*1000; + + if (check_end()) + handle_end(); + } *************** *** 356,360 **** } - return; } --- 361,364 ---- *************** *** 620,622 **** --- 624,701 ---- + + bool NormalGame::player_isalive(int i) + { + return (player_control[i]->ship || player_fleet[i]->getSize() > 0); + } + + bool NormalGame::check_end() + { + int i; + int numalive = 0; + + for ( i = 0; i < num_players; ++i ) + { + if (player_isalive(i)) + ++ numalive; + } + + if (numalive <= 1) + return true; // game should end, if at most 1 player is left (be it human or AI). + else + return false; + } + + + void NormalGame::handle_end() + { + // dunno if this is ok in a networked game. + + // find the local player + int i; + for ( i = 0; i < num_players; ++i ) + { + if (player_control[i]->channel == channel_server && + strcmp(player_control[i]->getTypeName(), "Keyboard/Joystick") == 0) + break; + } + + if (i == num_players) // error? + i = 0; + + char *endmessage = 0; + if (player_isalive(i)) + endmessage = "Victory"; + else + endmessage = "Game Over"; + + // in a networked game, I suppose just the host should have this option. How to do that ?? + int ichoice = tw_alert(endmessage, "&QUIT", "&RESTART"); + + if (ichoice == 1) + { + quit(endmessage); + } + else + { + int i; + char buffy[512]; + for ( i = 0; i < num_players; ++i ) + { + // first, kill remaining ship(s) + if (player_control[i]->ship) + player_control[i]->ship->die(); + + // then, load the fleet + log_file("tmp.ini"); + sprintf(buffy, "Player%d", i + 1); + player_fleet[i]->reset(); + player_fleet[i]->load(NULL, buffy); + player_fleet[i]->save("fleets.tmp", buffy); + } + } + + } + + REGISTER_GAME(NormalGame, "Melee") Index: mmain.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mmain.h 29 Jan 2004 21:20:29 -0000 1.8 --- mmain.h 29 Feb 2004 10:37:03 -0000 1.9 *************** *** 55,58 **** --- 55,62 ---- int indhealthtoggle, indteamtoggle; + bool check_end(); + void handle_end(); + bool player_isalive(int i); + }; |
From: <geo...@us...> - 2004-02-29 00:47:29
|
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9321/gamex Modified Files: gameproject.cpp Log Message: bug-fix Index: gameproject.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameproject.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gameproject.cpp 29 Jan 2004 21:20:28 -0000 1.11 --- gameproject.cpp 29 Feb 2004 00:37:38 -0000 1.12 *************** *** 439,442 **** --- 439,448 ---- game_screen1 = create_video_bitmap(screen->w, screen->h); game_screen2 = create_video_bitmap(screen->w, screen->h); + + // hack to avoid possible crash? + if (!game_screen2) + game_screen2 = game_screen1; + + // game_screen2 can also be used to store stuff, which is then blitted at once // onto the game screen. |
From: <yu...@us...> - 2004-02-28 21:19:43
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv411/source/other Modified Files: gquest.cpp Log Message: Fixed MakeAlly MakeEnemy bug Index: gquest.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/gquest.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gquest.cpp 28 Feb 2004 01:05:49 -0000 1.14 --- gquest.cpp 28 Feb 2004 21:09:56 -0000 1.15 *************** *** 237,242 **** } Vector2 pos; ! pos.x = lua_tonumber(ls, 2); ! pos.y = lua_tonumber(ls, 3); Query q; --- 237,242 ---- } Vector2 pos; ! pos.x = lua_tonumber(ls, 1); ! pos.y = lua_tonumber(ls, 2); Query q; *************** *** 259,269 **** } Vector2 pos; ! pos.x = lua_tonumber(ls, 2); ! pos.y = lua_tonumber(ls, 3); Query q; for (q.begin(g_player->ship, bit(LAYER_CBODIES), 24000); q.current; q.next()) { ! if( (q.current)->pos == pos) { ((GobStation*)(q.current))->set_team(g_player->ship->get_team()); --- 259,269 ---- } Vector2 pos; ! pos.x = lua_tonumber(ls, 1); ! pos.y = lua_tonumber(ls, 2); Query q; for (q.begin(g_player->ship, bit(LAYER_CBODIES), 24000); q.current; q.next()) { ! if( (q.current)->pos.round() == pos.round()) { ((GobStation*)(q.current))->set_team(g_player->ship->get_team()); |
From: <geo...@us...> - 2004-02-28 15:41:36
|
Update of /cvsroot/timewarp/source/twgui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28959/source/twgui Modified Files: utils.cpp Log Message: no message Index: utils.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/utils.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** utils.cpp 28 Feb 2004 15:16:32 -0000 1.11 --- utils.cpp 28 Feb 2004 15:32:03 -0000 1.12 *************** *** 20,23 **** --- 20,26 ---- static void error_handler_dummy(const char *txt, ...) { + textout(screen, font, txt, 0, 0, makecol(250,250,250)); + while (key[KEY_ENTER] != 0) + rest(5); } |
From: <geo...@us...> - 2004-02-28 15:36:01
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27814 Modified Files: twwin.dsp Log Message: update to accomodate for the change in twgui |
From: <geo...@us...> - 2004-02-28 15:29:57
|
Update of /cvsroot/timewarp/gamex/player In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26567/player Modified Files: playerinfo.ini Log Message: no message Index: playerinfo.ini =================================================================== RCS file: /cvsroot/timewarp/gamex/player/playerinfo.ini,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** playerinfo.ini 22 Feb 2004 11:39:23 -0000 1.7 --- playerinfo.ini 28 Feb 2004 15:20:23 -0000 1.8 *************** *** 1,7 **** RU = 1200.000000 PlanetCode = -1 ! Moon = -1.000000 ! Planet = -1.000000 ! Star = -1.000000 PosY = 547.207397 PosX = 706.461060 --- 1,8 ---- + Angle = 0.000000 RU = 1200.000000 PlanetCode = -1 ! Moon = -1 ! Planet = -1 ! Star = -1 PosY = 547.207397 PosX = 706.461060 *************** *** 15,19 **** [Fleet] ! N = 1.000000 ! crew0 = 1.000000 id0 = spael --- 16,34 ---- [Fleet] ! N = 8 ! crew0 = 1 id0 = spael + crew1 = 1 + id1 = spael + crew2 = 1 + id2 = spael + crew3 = 1 + id3 = spael + crew4 = 1 + id4 = spael + crew5 = 1 + id5 = spael + crew6 = 1 + id6 = spael + crew7 = 1 + id7 = spael |
From: <geo...@us...> - 2004-02-28 15:29:30
|
Update of /cvsroot/timewarp/gamex/gamedata/races/earthling In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26451/races/earthling Modified Files: colony.dialog Log Message: test Index: colony.dialog =================================================================== RCS file: /cvsroot/timewarp/gamex/gamedata/races/earthling/colony.dialog,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsS2oMsE and /tmp/cvs1NMSH3 differ |
From: <geo...@us...> - 2004-02-28 15:29:15
|
Update of /cvsroot/timewarp/gamex/gamedata/player In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26395 Added Files: playerinfo.ini Log Message: this is a better place for this file --- NEW FILE: playerinfo.ini --- Angle = 0.000000 RU = 1200.000000 PlanetCode = -1 Moon = -1 Planet = -1 Star = -1 PosY = 547.207397 PosX = 706.461060 [Names] player = Zel ship = Titanic Star = -1 [Fleet] N = 8 crew0 = 1 id0 = spael crew1 = 1 id1 = spael crew2 = 1 id2 = spael crew3 = 1 id3 = spael crew4 = 1 id4 = spael crew5 = 1 id5 = spael crew6 = 1 id6 = spael crew7 = 1 id7 = spael |
From: <geo...@us...> - 2004-02-28 15:28:40
|
Update of /cvsroot/timewarp/gamex/gamedata/player In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26213/player Log Message: Directory /cvsroot/timewarp/gamex/gamedata/player added to the repository |
From: <geo...@us...> - 2004-02-28 15:28:03
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25947/games Modified Files: gflmelee.cpp ggob.cpp gmissions.cpp gmissions_objects.cpp gsolar.cpp vgGenSys.cpp Log Message: no message Index: gflmelee.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gflmelee.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** gflmelee.cpp 29 Jan 2004 21:20:27 -0000 1.19 --- gflmelee.cpp 28 Feb 2004 15:18:24 -0000 1.20 *************** *** 47,50 **** --- 47,53 ---- #include "../melee/mlog.h" + #include "twgui.h" + + #define Num_Planet_Pics 7 *************** *** 1970,1975 **** - #include "../twgui/twgui.h" - void FlMelee::start_menu(int *select) { --- 1973,1976 ---- Index: ggob.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/ggob.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ggob.cpp 28 Feb 2004 01:05:49 -0000 1.27 --- ggob.cpp 28 Feb 2004 15:18:24 -0000 1.28 *************** *** 356,360 **** { // check a menu to see what the player wants ... how ?? ! ichoice = tw_alert("Continue game?", "&YES", "&NO"); } --- 356,360 ---- { // check a menu to see what the player wants ... how ?? ! ichoice = tw_alert("Continue saved game?", "&YES", "&NO"); } Index: gmissions.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gmissions.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** gmissions.cpp 28 Feb 2004 01:05:49 -0000 1.23 --- gmissions.cpp 28 Feb 2004 15:18:24 -0000 1.24 *************** *** 21,26 **** #include "gamehierarchy.h" ! #include "../twgui/twgui.h" ! #include "../twgui/twmenuexamples.h" #include "gflmelee.h" --- 21,25 ---- #include "gamehierarchy.h" ! #include "twgui.h" #include "gflmelee.h" Index: gmissions_objects.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gmissions_objects.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gmissions_objects.cpp 29 Jan 2004 21:20:28 -0000 1.8 --- gmissions_objects.cpp 28 Feb 2004 15:18:24 -0000 1.9 *************** *** 19,23 **** ! #include "../twgui/twgui.h" #include "gmissions_objects.h" --- 19,23 ---- ! #include "twgui.h" #include "gmissions_objects.h" Index: gsolar.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gsolar.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** gsolar.cpp 29 Jan 2004 21:20:28 -0000 1.8 --- gsolar.cpp 28 Feb 2004 15:18:24 -0000 1.9 *************** *** 92,96 **** void distribute_time_ran(double *x, int N, double xmax) { ! STACKTRACE int i; --- 92,96 ---- void distribute_time_ran(double *x, int N, double xmax) { ! STACKTRACE; int i; *************** *** 143,147 **** void CometPlasma::calculate() { ! STACKTRACE --- 143,147 ---- void CometPlasma::calculate() { ! STACKTRACE; *************** *** 184,188 **** void CometPlasma::inflict_damage(SpaceObject *other) { ! STACKTRACE --- 184,188 ---- void CometPlasma::inflict_damage(SpaceObject *other) { ! STACKTRACE; *************** *** 195,199 **** int CometPlasma::handle_damage(SpaceLocation *source, int normal, int direct) { ! STACKTRACE --- 195,199 ---- int CometPlasma::handle_damage(SpaceLocation *source, int normal, int direct) { ! STACKTRACE; *************** *** 234,238 **** void Comet::inflict_damage(SpaceObject *other) { ! STACKTRACE int i = 1; --- 234,238 ---- void Comet::inflict_damage(SpaceObject *other) { ! STACKTRACE; int i = 1; *************** *** 252,256 **** void Comet::calculate() { ! STACKTRACE SpaceObject::calculate(); --- 252,256 ---- void Comet::calculate() { ! STACKTRACE; SpaceObject::calculate(); *************** *** 315,319 **** void Solar::init_comets () { ! STACKTRACE --- 315,319 ---- void Solar::init_comets () { ! STACKTRACE; *************** *** 377,381 **** SpaceSprite *Solar::GetSprite(char *fileName, char *spriteName) { ! STACKTRACE char msgStr[100]; --- 377,381 ---- SpaceSprite *Solar::GetSprite(char *fileName, char *spriteName) { ! STACKTRACE; char msgStr[100]; *************** *** 406,410 **** bool Solar::GetSprites(SpaceSprite *Pics[], char *fileName, char *cmdStr, int numSprites) { ! STACKTRACE SpaceSprite *spr; --- 406,410 ---- bool Solar::GetSprites(SpaceSprite *Pics[], char *fileName, char *cmdStr, int numSprites) { ! STACKTRACE; SpaceSprite *spr; *************** *** 429,433 **** void Solar::init_objects() { ! STACKTRACE add(new Stars()); --- 429,433 ---- void Solar::init_objects() { ! STACKTRACE; add(new Stars()); Index: vgGenSys.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/vgGenSys.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** vgGenSys.cpp 29 Jan 2004 21:20:28 -0000 1.9 --- vgGenSys.cpp 28 Feb 2004 15:18:24 -0000 1.10 *************** *** 10,15 **** #include "../melee/mview.h" ! #include "../twgui/twgui.h" ! #include "../twgui/twmenuexamples.h" #include "../melee/mlog.h" --- 10,14 ---- #include "../melee/mview.h" ! #include "twgui.h" #include "../melee/mlog.h" |
From: <geo...@us...> - 2004-02-28 15:27:59
|
Update of /cvsroot/timewarp/source/gamex/edit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25947/gamex/edit Modified Files: disk_stuff.h edit_dialogue.h Log Message: no message Index: disk_stuff.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/edit/disk_stuff.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** disk_stuff.h 7 Feb 2004 07:43:37 -0000 1.5 --- disk_stuff.h 28 Feb 2004 15:18:24 -0000 1.6 *************** *** 3,7 **** #define __GAMEX_DISK_STUFF__ ! #include "../../twgui/twgui.h" // part of this, should go into the gamedata section ?! --- 3,7 ---- #define __GAMEX_DISK_STUFF__ ! #include "twgui.h" // part of this, should go into the gamedata section ?! Index: edit_dialogue.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/edit/edit_dialogue.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** edit_dialogue.h 24 Feb 2004 23:25:07 -0000 1.10 --- edit_dialogue.h 28 Feb 2004 15:18:24 -0000 1.11 *************** *** 8,13 **** #include "disk_stuff.h" ! #include "../../twgui/twgui.h" ! #include "../../twgui/twmenuexamples.h" const int Ntext = 2048; --- 8,12 ---- #include "disk_stuff.h" ! #include "twgui.h" const int Ntext = 2048; |
From: <geo...@us...> - 2004-02-28 15:27:59
|
Update of /cvsroot/timewarp/source/other In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25947/other Modified Files: configrw.cpp configrw.h Log Message: no message Index: configrw.cpp =================================================================== RCS file: /cvsroot/timewarp/source/other/configrw.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** configrw.cpp 24 Feb 2004 23:22:30 -0000 1.3 --- configrw.cpp 28 Feb 2004 15:18:24 -0000 1.4 *************** *** 7,10 **** --- 7,11 ---- + bool config_read = true; *************** *** 67,90 **** char *source_dir = "save/save01"; char *target_dir = "save/save01"; ! void set_conf(char *f) { ! char s[512]; ! if (config_read) ! strcpy(s, source_dir); else ! strcpy(s, target_dir); ! // to-do: ! // check if the target-directory exists, if not, create it. ! // if (!file_exists(s, FA_DIREC, 0)) // this is too limited, "f" can also contain directory info... ! // mkdir(s); - strcat(s, "/"); - strcat(s, f); ! set_config_file(s); } --- 68,214 ---- char *source_dir = "save/save01"; char *target_dir = "save/save01"; + char *temp_dir = "save/temp"; ! void set_conf(char *f, bool option) { ! config_read = option; ! ! char *s; ! if (config_read) ! s = construct_loadname(f); else ! s = construct_savename(f); ! set_config_file(s); ! } ! ! ! void makedir(char *name) ! { ! #ifdef LINUX ! mkdir(name, 0755); ! #else ! mkdir(name); ! #endif ! } ! ! ! ! ! ! ! char constr_name_return[512]; ! char *construct_name(char *refdir, char *savename, bool strip) ! { ! char *fname = constr_name_return; ! ! strcpy(fname, refdir); ! strcat(fname, "/"); ! int k = strlen(fname); ! strcat(fname, savename); ! ! // let the savename become a "single" file, no subdirs --> replace / by _ ! if (strip) ! { ! char *s = &fname[k]; ! while (*s) ! { ! if (*s == '/') ! *s = '_'; ! ++s; ! } ! } ! ! return fname; ! } ! ! ! char *construct_savename(char *savename) ! { ! char *s; ! ! // uses an collapsed file-path (/ --> _) ! s = construct_name(temp_dir, savename, true); ! ! return s; ! } ! ! ! char *construct_loadname(char *loadname) ! { ! char *s = "hi"; ! ! // uses an collapsed file-path (/ --> _) ! // s = construct_name(temp_dir, loadname, true); ! // FOR NOW, DISABLE, TO TEST INIT BEHAVIOUR ! ! // uses an collapsed file-path (/ --> _) ! if (!exists(s)) ! s = construct_name(source_dir, loadname, true); ! ! // uses the normal file-path ! if (!exists(s)) ! s = construct_name(init_dir, loadname, false); ! ! return s; ! } ! ! ! void validate_directory(char *fname) ! { ! char *s = fname; ! ! while (s = strchr(s, '/')) // yes, this must be =, not == ! { ! *s = 0; ! ! if (!file_exists(fname, FA_DIREC, 0)) ! { ! // create the directory ?! ! makedir(fname); ! } ! ! *s = '/'; ! s += 1; // skip the '/' that you've already found. ! } ! } + FILE *getsavefile(char *savename) + { + // only write to the temp-directory ! + char *s = construct_savename(savename); + + validate_directory(s); + + return fopen(s, "wb"); + } + + + FILE *getloadfile(char *loadname) + { + char *s = 0; + + s = construct_loadname(loadname); + + return fopen(s, "rb"); + } + + + + static char replext_string[512]; + + char *replext(char *oldname, char *newext) + { + strcpy(replext_string, oldname); + char *s; + s = strrchr(replext_string, '.'); + if (s) + strcpy(s+1, newext); + + return replext_string; // it's now the new name. + } Index: configrw.h =================================================================== RCS file: /cvsroot/timewarp/source/other/configrw.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** configrw.h 24 Feb 2004 23:22:30 -0000 1.2 --- configrw.h 28 Feb 2004 15:18:24 -0000 1.3 *************** *** 63,76 **** extern char *source_dir; ! /** \brief the directory where game-data are save to */ extern char *target_dir; /** \brief this defines a set_config_file based on the source or target-dir, and append the f filename to that directory. */ ! void set_conf(char *f); #endif --- 63,111 ---- extern char *source_dir; ! /** \brief the directory where game-data are saved to */ extern char *target_dir; + /** \brief the temporary directory where game-data are temporarily stored. The "save" option + then just means that you copy temp-stored stuff to the target directory. The "load" or "new" + options should empty this temp directory. + */ + extern char *temp_dir; + /** \brief this defines a set_config_file based on the source or target-dir, and append the f filename to that directory. */ ! void set_conf(char *f, bool option); + /** \brief create a new directory + */ + void makedir(char *name); + + /** \brief makes sure that the path of the filename exists; if directories are missing, + they are created + */ + void validate_directory(char *fname); + + /** \brief inserts the temp-path in front of the desired filename (the desired filename + is allowed to have a sub-directory path). + */ + char *construct_savename(char *savename); + + char *construct_loadname(char *loadname); + + char *construct_name(char *refdir, char *savename, bool strip); + + /** \brief uses construct_savename and validate_directory, to open a (new) file. + */ + FILE *getsavefile(char *savename); + + FILE *getloadfile(char *loadname); + + + /** \brief replaces the filename's extension, and stores the result in some global + variable which is overwritten by the next call to this function. Leave the . (dot) away. + */ + char *replext(char *oldname, char *newext); #endif |
From: <geo...@us...> - 2004-02-28 15:27:57
|
Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25947/newships Modified Files: shpxxxma.cpp Log Message: no message Index: shpxxxma.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpxxxma.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpxxxma.cpp 21 Feb 2004 00:29:19 -0000 1.14 --- shpxxxma.cpp 28 Feb 2004 15:18:24 -0000 1.15 *************** *** 230,290 **** void XXXMangler::calculate() { ! STACKTRACE ! ! if(tentacleFrames > 0) { ! ! tentacleFrames -= frame_time; ! if ((tentacleFrames <= 0) && (!latched)) { ! play_sound2(data->sampleWeapon[0]); ! } } ! else latched = FALSE; ! ! ! if (grabbed != NULL ) { ! ! // additional criteria here: as suggested by Tau ! ! if (!grabbed ->exists() || !grabbed->canCollide(this)) { ! latched = FALSE; ! grabbed = NULL; ! } ! ! } ! ! ! if (latched) { ! recharge_step=0; ! recharge_rate=999; ! recharge_amount=0; ! ! damageFrameLeft-=frame_time; ! if (damageFrameLeft <=0) { ! damageFrameLeft += damageFrameAmount; ! if (tentacleDamageLeft < tentacleDamagePerDamageFrame) ! damage (grabbed, tentacleDamageLeft); ! else { ! damage (grabbed, tentacleDamagePerDamageFrame); ! tentacleDamageLeft -= tentacleDamagePerDamageFrame; } ! } ! grabangle = grabbed->get_angle() - grabshipangle + grabangle; ! grabangle = normalize(grabangle,PI2); ! angle=grabangle; ! grabshipangle = normalize(grabbed->get_angle(),PI2); ! ! nextkeys &= ~(keyflag::left | keyflag::right | keyflag::thrust | keyflag::special | keyflag::fire); ! ! // x = grabbed->normal_x()- (cos(grabangle ) * grabdistance); ! // y = grabbed->normal_y()- (sin(grabangle ) * grabdistance); ! ! pos = grabbed->normal_pos() - grabdistance * unit_vector(grabangle); ! ! } else { ! recharge_rate=normal_rate; ! recharge_amount=normal_recharge; ! ! SeparateSpit=TRUE; ! ! } // int j = 0; --- 230,292 ---- void XXXMangler::calculate() { ! STACKTRACE; ! ! if(tentacleFrames > 0) { ! ! tentacleFrames -= frame_time; ! if ((tentacleFrames <= 0) && (!latched)) { ! play_sound2(data->sampleWeapon[0]); ! } } ! else latched = FALSE; ! ! ! if (grabbed != NULL ) ! { ! ! // additional criteria here: as suggested by Tau ! ! if (!grabbed ->exists() || !grabbed->canCollide(this)) ! { ! latched = FALSE; ! grabbed = NULL; ! } ! ! } ! ! ! if (latched) { ! recharge_step=0; ! recharge_rate=999; ! recharge_amount=0; ! ! damageFrameLeft-=frame_time; ! if (damageFrameLeft <=0) { ! damageFrameLeft += damageFrameAmount; ! if (tentacleDamageLeft < tentacleDamagePerDamageFrame) ! damage (grabbed, tentacleDamageLeft); ! else { ! damage (grabbed, tentacleDamagePerDamageFrame); ! tentacleDamageLeft -= tentacleDamagePerDamageFrame; } ! } ! grabangle = grabbed->get_angle() - grabshipangle + grabangle; ! grabangle = normalize(grabangle,PI2); ! angle=grabangle; ! grabshipangle = normalize(grabbed->get_angle(),PI2); ! ! nextkeys &= ~(keyflag::left | keyflag::right | keyflag::thrust | keyflag::special | keyflag::fire); ! ! // x = grabbed->normal_x()- (cos(grabangle ) * grabdistance); ! // y = grabbed->normal_y()- (sin(grabangle ) * grabdistance); ! ! pos = grabbed->normal_pos() - grabdistance * unit_vector(grabangle); ! ! } else { ! recharge_rate=normal_rate; ! recharge_amount=normal_recharge; ! ! SeparateSpit=TRUE; ! ! } // int j = 0; *************** *** 299,307 **** Ship::calculate(); } int XXXMangler::canCollide(SpaceObject *other) { ! STACKTRACE if ((latched) && (grabbed!=NULL) && (grabbed->exists())) { if (grabbed == other) --- 301,310 ---- Ship::calculate(); + angle = normalize(angle); } int XXXMangler::canCollide(SpaceObject *other) { ! STACKTRACE; if ((latched) && (grabbed!=NULL) && (grabbed->exists())) { if (grabbed == other) *************** *** 313,322 **** void XXXMangler::animate(Frame *space) { ! STACKTRACE BodyFrames -= frame_time * 5; if ((tentacleFrames > 0) && (latched)) { int RandFrame = rand() % 4; - angle = normalize(ship->get_angle(),PI2); // double TentacleX = ship->normal_x() + (cos(angle ) * height() * .75); // double TentacleY = ship->normal_y() + (sin(angle ) * width() * .75); --- 316,324 ---- void XXXMangler::animate(Frame *space) { ! STACKTRACE; BodyFrames -= frame_time * 5; if ((tentacleFrames > 0) && (latched)) { int RandFrame = rand() % 4; // double TentacleX = ship->normal_x() + (cos(angle ) * height() * .75); // double TentacleY = ship->normal_y() + (sin(angle ) * width() * .75); *************** *** 349,384 **** void XXXMangler::inflict_damage(SpaceObject *other) { ! STACKTRACE ! if (tentacleFrames > 0) ! if (!latched) ! if ((!(sameTeam(other))) && ! (other->isShip())) { ! latched=TRUE; ! ! grabbed= (Ship *) other; ! grabangle= (trajectory_angle(other) ); ! grabdistance = (distance(other) * 1.075); ! grabshipangle = (other->get_angle()); ! tentacleDamageLeft = weaponDamage; ! play_sound2(data->sampleExtra[1]); ! if ((tentacleFrames / frame_time)< weaponDamage) { ! tentacleDamagePerDamageFrame = (weaponDamage/tentacleFrames) ! + ((weaponDamage % tentacleFrames) > 0.00001); ! damageFrameLeft = 1; ! damageFrameAmount = 1; ! } else { ! damageFrameAmount = (tentacleFrames/weaponDamage); ! damageFrameLeft = damageFrameAmount; ! tentacleDamagePerDamageFrame = 1; ! } ! } ! if (SeparateSpit) { ! if (other != NULL) ! if (!sameTeam(other) && other->isShip()) ! other->accelerate (other, angle, weaponDartThrust / (other->mass / 20), MAX_SPEED); ! accelerate(this,angle+PI,weaponDartThrust / mass,MAX_SPEED); ! SeparateSpit = false; } ! Ship::inflict_damage(other); } --- 351,393 ---- void XXXMangler::inflict_damage(SpaceObject *other) { ! STACKTRACE; ! if (tentacleFrames > 0) ! { ! if (!latched) ! { ! if ((!(sameTeam(other))) && ! (other->isShip())) { ! latched=TRUE; ! ! grabbed= (Ship *) other; ! grabangle= (trajectory_angle(other) ); ! grabdistance = (distance(other) * 1.075); ! grabshipangle = (other->get_angle()); ! tentacleDamageLeft = weaponDamage; ! play_sound2(data->sampleExtra[1]); ! if ((tentacleFrames / frame_time)< weaponDamage) { ! tentacleDamagePerDamageFrame = (weaponDamage/tentacleFrames) ! + ((weaponDamage % tentacleFrames) > 0.00001); ! damageFrameLeft = 1; ! damageFrameAmount = 1; ! } else { ! damageFrameAmount = (tentacleFrames/weaponDamage); ! damageFrameLeft = damageFrameAmount; ! tentacleDamagePerDamageFrame = 1; ! } } ! } ! } ! ! if (SeparateSpit) ! { ! if (other != NULL) ! if (!sameTeam(other) && other->isShip()) ! other->accelerate (other, angle, weaponDartThrust / (other->mass / 20), MAX_SPEED); ! accelerate(this,angle+PI,weaponDartThrust / mass,MAX_SPEED); ! SeparateSpit = false; ! } ! ! Ship::inflict_damage(other); } |
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25947/gamex Modified Files: gamedata.cpp gamedata.h gamedialogue.cpp gamedialogue.h gameplanetscan.cpp gameplanetview.cpp gamesolarview.cpp projectx.cpp Log Message: no message Index: gamedata.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gamedata.cpp 24 Feb 2004 23:25:08 -0000 1.15 --- gamedata.cpp 28 Feb 2004 15:18:24 -0000 1.16 *************** *** 48,62 **** ! void PlayerFleet::config(bool option) { int i; - config_read = option; - section = "Fleet"; conf("N", N); ! if (option == CONFIG_READ) ! for (i = 0; i < N; ++i) fr[i] = new PlayerFleetRec("none"); --- 48,61 ---- ! void PlayerFleet::config() { int i; section = "Fleet"; + conf("N", N); ! if (config_read) ! for ( i = 0; i < N; ++i ) fr[i] = new PlayerFleetRec("none"); *************** *** 74,81 **** void PlayerInfo::config(char *filename, bool option) { - //configfilename = filename; - set_conf(filename); ! config_read = option; section = 0; --- 73,79 ---- void PlayerInfo::config(char *filename, bool option) { ! set_conf(filename, option); ! section = 0; *************** *** 95,99 **** conf("ship", shipname, "dustbin"); ! fleet.config(option); } --- 93,98 ---- conf("ship", shipname, "dustbin"); ! fleet.config(); ! } Index: gamedata.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedata.h,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** gamedata.h 22 Feb 2004 11:37:59 -0000 1.14 --- gamedata.h 28 Feb 2004 15:18:24 -0000 1.15 *************** *** 187,191 **** void add(const char *id); ! void config(bool option); // use these options: CONF_READ or CONF_WRITE }; --- 187,191 ---- void add(const char *id); ! void config(); }; Index: gamedialogue.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gamedialogue.cpp 24 Feb 2004 23:25:20 -0000 1.12 --- gamedialogue.cpp 28 Feb 2004 15:18:24 -0000 1.13 *************** *** 84,87 **** --- 84,88 ---- dialo = 0; racefile[0] = 0; + dialofilename[0] = 0; } *************** *** 230,234 **** if (!dialo) { ! set_dialog("gamex/gamedata/races/earthling/colony.dialog"); race_id = "earthling"; } --- 231,235 ---- if (!dialo) { ! set_dialog("races/earthling/colony.dialog"); race_id = "earthling"; } *************** *** 273,289 **** - char constr_savename_return[512]; - char *construct_savename(char *savename, char *ext) - { - char *fname = constr_savename_return; - strcpy(fname, target_dir); - strcat(fname, "/"); - strcat(fname, savename); - strcat(fname, "."); - strcat(fname, ext); ! return fname; ! } void GameAliendialog::quit() --- 274,280 ---- ! void GameAliendialog::quit() *************** *** 302,311 **** lua_close(L); ! // FILE *outfile = savefile("...../... .dialogstate"); ! // firstdialo->save_state(outfile); // stop the ttf ! // antialias_exit(); //destroy_font(ttf); } --- 293,309 ---- lua_close(L); ! // save the dialog node states ! FILE *outfile = getsavefile( replext(dialofilename, "bin") ); ! if (outfile) ! { ! firstdialo->save_state(outfile); ! fclose(outfile); ! } // stop the ttf ! // or, should this be part of the twgui code ?? //destroy_font(ttf); + + delete fs; } *************** *** 540,544 **** char fname [512]; ! strcpy(fname, "gamex/gamedata/races/"); strcat(fname, rc->race->id); strcat(fname, "/"); --- 538,542 ---- char fname [512]; ! strcpy(fname, "races/"); strcat(fname, rc->race->id); strcat(fname, "/"); *************** *** 555,559 **** { // read the root branch !! ! fs = new FileStore(fname); firstdialo = new Dialo(); --- 553,558 ---- { // read the root branch !! ! strcpy(dialofilename, fname); ! fs = new FileStore(construct_loadname(fname)); firstdialo = new Dialo(); *************** *** 561,564 **** --- 560,573 ---- dialo = firstdialo; + + + // load/overwrite the dialog node states + FILE *inpfile = getloadfile( replext(fname, "bin") ); + if (inpfile) + { + firstdialo->read_state(inpfile); + fclose(inpfile); + } + } Index: gamedialogue.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.h,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** gamedialogue.h 24 Feb 2004 23:25:20 -0000 1.11 --- gamedialogue.h 28 Feb 2004 15:18:24 -0000 1.12 *************** *** 9,13 **** #include "edit/disk_stuff.h" ! #include "../twgui/twgui.h" #include "../other/luaport.h" --- 9,13 ---- #include "edit/disk_stuff.h" ! #include "twgui.h" #include "../other/luaport.h" *************** *** 66,69 **** --- 66,71 ---- Dialo *firstdialo; + + char dialofilename[512]; }; Index: gameplanetscan.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetscan.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** gameplanetscan.cpp 15 Feb 2004 13:18:27 -0000 1.10 --- gameplanetscan.cpp 28 Feb 2004 15:18:24 -0000 1.11 *************** *** 838,842 **** //size = Vector2(H, H*tempframe->ratio); ! size = surf_area->size; // the planet surface has that many pixels. size *= scalesurface; // the planet surface is "extra big" for melee-type purpose prepare(); --- 838,843 ---- //size = Vector2(H, H*tempframe->ratio); ! size.x = surf_area->size.x; // the planet surface has that many pixels. ! size.y = surf_area->size.y; size *= scalesurface; // the planet surface is "extra big" for melee-type purpose prepare(); Index: gameplanetview.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetview.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gameplanetview.cpp 19 Feb 2004 01:12:18 -0000 1.15 --- gameplanetview.cpp 28 Feb 2004 15:18:24 -0000 1.16 *************** *** 27,32 **** #include "stuff/backgr_stars.h" ! #include "../twgui/twgui.h" ! #include "../twgui/twpopup.h" #include "general/sprites.h" --- 27,31 ---- #include "stuff/backgr_stars.h" ! #include "twgui.h" #include "general/sprites.h" Index: gamesolarview.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamesolarview.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** gamesolarview.cpp 21 Feb 2004 00:29:16 -0000 1.13 --- gamesolarview.cpp 28 Feb 2004 15:18:24 -0000 1.14 *************** *** 19,24 **** #include "stuff/backgr_stars.h" ! #include "../twgui/twgui.h" ! #include "../twgui/twmenuexamples.h" #include "general/sprites.h" --- 19,23 ---- #include "stuff/backgr_stars.h" ! #include "twgui.h" #include "general/sprites.h" Index: projectx.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/projectx.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** projectx.cpp 24 Feb 2004 23:25:20 -0000 1.19 --- projectx.cpp 28 Feb 2004 15:18:24 -0000 1.20 *************** *** 53,56 **** --- 53,57 ---- char new_source_dir[512]; char new_target_dir[512]; + char new_temp_dir[512]; void ProjectX::init() *************** *** 59,71 **** // setup directories for default/ loading/ saving. ! strcpy(new_init_dir, "gamex"); init_dir = new_init_dir; ! strcpy(new_source_dir, "gamex"); source_dir = new_source_dir; ! strcpy(new_target_dir, "gamex"); // /save/save01"); target_dir = new_target_dir; --- 60,75 ---- // setup directories for default/ loading/ saving. ! strcpy(new_init_dir, "gamex/gamedata"); init_dir = new_init_dir; ! strcpy(new_source_dir, "gamex/save/save01"); source_dir = new_source_dir; ! strcpy(new_target_dir, "gamex/save/save01"); target_dir = new_target_dir; + strcpy(new_temp_dir, "gamex/save/temp"); + temp_dir = new_temp_dir; + |
From: <geo...@us...> - 2004-02-28 15:26:54
|
Update of /cvsroot/timewarp/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25663 Modified Files: scp.cpp Log Message: made twgui independent of other timewarp code Index: scp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/scp.cpp,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** scp.cpp 24 Feb 2004 23:26:15 -0000 1.53 --- scp.cpp 28 Feb 2004 15:17:20 -0000 1.54 *************** *** 875,878 **** --- 875,880 ---- + twgui_init(get_time, tw_error); + init_ships(); |
From: <geo...@us...> - 2004-02-28 15:26:24
|
Update of /cvsroot/timewarp/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25551 Added Files: twgui.h Log Message: made twgui independent of other timewarp code --- NEW FILE: twgui.h --- /* Placed in public domain by Rob Devilee, 2004. Share and enjoy! */ #ifndef __TWGUI_H__ #define __TWGUI_H__ #include "twgui/twwindow.h" #include "twgui/twbutton.h" #include "twgui/twbuttontypes.h" #include "twgui/twguilist.h" #include "twgui/twmenuexamples.h" #include "twgui/twpopup.h" #include "twgui/gamebuttonevent.h" #endif |