You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(4) |
Oct
(10) |
Nov
(5) |
Dec
(10) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(2) |
Feb
(3) |
Mar
(9) |
Apr
(20) |
May
(15) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ol...> - 2004-05-18 06:42:47
|
Author: martin Date: 2004-05-18 08:42:37 +0200 (Tue, 18 May 2004) New Revision: 274 Modified: trunk/mass/TODO trunk/mass/mass.c Log: fixed warning, todo update Modified: trunk/mass/TODO =================================================================== --- trunk/mass/TODO 2004-05-17 12:59:28 UTC (rev 273) +++ trunk/mass/TODO 2004-05-18 06:42:37 UTC (rev 274) @@ -19,7 +19,6 @@ - Pseudo ingame-join would be really cool. Mixed bigger things: -- Write the effects infrastructure, perhaps with multiple bitmap layers. - More ways to interact with the world. - Networking: Meta server. User should not have to use command line. - having the player always in the center of the screen looks Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-17 12:59:28 UTC (rev 273) +++ trunk/mass/mass.c 2004-05-18 06:42:37 UTC (rev 274) @@ -1481,6 +1481,7 @@ for (i=0; i<4; i++) { for (steps=-r; steps <= r; steps++) { int x, y; + x=y=0; // avoid compiler warning Mass * m2; switch (i) { case 0: |
From: <sv...@ol...> - 2004-05-17 12:59:46
|
Author: martin Date: 2004-05-17 14:59:28 +0200 (Mon, 17 May 2004) New Revision: 273 Modified: trunk/mass/config.c trunk/mass/data/trapper.txt trunk/mass/main.c trunk/mass/mass.c Log: Solaris fixes, and smaller things. Modified: trunk/mass/config.c =================================================================== --- trunk/mass/config.c 2004-05-14 21:00:07 UTC (rev 272) +++ trunk/mass/config.c 2004-05-17 12:59:28 UTC (rev 273) @@ -210,7 +210,7 @@ c++; } } - if (*c && !isspace(*c)) { + if (*c && !isspace((int)*c)) { *error = "invalid float number syntax"; return -1; } Modified: trunk/mass/data/trapper.txt =================================================================== --- trunk/mass/data/trapper.txt 2004-05-14 21:00:07 UTC (rev 272) +++ trunk/mass/data/trapper.txt 2004-05-17 12:59:28 UTC (rev 273) @@ -12,7 +12,7 @@ bufferMass 0 GrowingWall: Mass - vivid 40 + vivid 4 growRounds 1000 baseColor 200 170 200 speed 80 Modified: trunk/mass/main.c =================================================================== --- trunk/mass/main.c 2004-05-14 21:00:07 UTC (rev 272) +++ trunk/mass/main.c 2004-05-17 12:59:28 UTC (rev 273) @@ -143,9 +143,7 @@ debugMode = 0; frontend = config.display; - if (frontend == F_NONE) { - printf("No video requested! With some configurations the game will lock, waiting for SDL events or the like.\n"); - } + if (frontend == F_NONE) printf("No video requested!\n"); if (config.maxCPS <= 0) { minFrameDuration = 1; Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-14 21:00:07 UTC (rev 272) +++ trunk/mass/mass.c 2004-05-17 12:59:28 UTC (rev 273) @@ -1630,8 +1630,8 @@ if (m->vivid > 0 && m->age > 5) { int r, i; Point p; - r = sqrt((float)(m->numPixels) / M_PI) * 2; - if (r < 2) r = 2; + r = 16; // FIXME: not useful, but sqrt() bad + if (r < 2*2) r = 2*2; m->heading += randarea(-2, 5); p = GetBorderPointFromCenterInDirection(m, m->heading+128); for (i=0; i<m->vivid; i++) { |
From: <sv...@ol...> - 2004-05-14 21:00:15
|
Author: martin Date: 2004-05-14 23:00:07 +0200 (Fri, 14 May 2004) New Revision: 272 Modified: trunk/mass/TODO trunk/mass/debug.c trunk/mass/field.c trunk/mass/game.c trunk/mass/level.c trunk/mass/mass.c trunk/mass/math2d.c trunk/mass/tests.c Log: Fixed potential mistakes with negative % operator. Modified: trunk/mass/TODO =================================================================== --- trunk/mass/TODO 2004-05-14 20:01:32 UTC (rev 271) +++ trunk/mass/TODO 2004-05-14 21:00:07 UTC (rev 272) @@ -2,8 +2,6 @@ Everything is sorted by priority. -- % operator is machine-dependant on negative values! check every place - Before release 0.4: - implement mass movement that moves further than 1 pixel per cycle - implement goals, at least detect player mass destruction (maybe resurrection) Modified: trunk/mass/debug.c =================================================================== --- trunk/mass/debug.c 2004-05-14 20:01:32 UTC (rev 271) +++ trunk/mass/debug.c 2004-05-14 21:00:07 UTC (rev 272) @@ -6,6 +6,7 @@ #include "SDL.h" #include <stdio.h> #include <string.h> +#include <stdlib.h> Mass * watchedMass = NULL; int aaaa = 0; @@ -33,13 +34,14 @@ c = -7; assert(c >> 1 == -4); } - { - void * a; - memset(&a, 0, sizeof(void*)); - assert(!a); - /* if this fails, all pointers (especially those in the mass - struct) need to be set to NULL after calloc(). */ - } + { + void * a; + memset(&a, 0, sizeof(void*)); + assert(!a); + /* if this fails, all pointers (especially those in the mass + struct) need to be set to NULL after calloc(). */ + } + if (-2 % 20 != -2) printf("WARNING! (-2 %% 20) == %d on this machine, networks game may get out of sync\n", -2 % 20); } #ifndef NDEBUG Modified: trunk/mass/field.c =================================================================== --- trunk/mass/field.c 2004-05-14 20:01:32 UTC (rev 271) +++ trunk/mass/field.c 2004-05-14 21:00:07 UTC (rev 272) @@ -668,9 +668,8 @@ synced_srandom(seed); } int randarea(int smallest, int size) { - /* TODO: make sure it's a function that returns the same results on - every system (in case the same start value was used). - Will be needed for networking. */ + // this function must return the same results on every system + // (given the same seed) to keep network games in sync return synced_random() % size + smallest; } Modified: trunk/mass/game.c =================================================================== --- trunk/mass/game.c 2004-05-14 20:01:32 UTC (rev 271) +++ trunk/mass/game.c 2004-05-14 21:00:07 UTC (rev 272) @@ -74,6 +74,7 @@ // update position according to velocity p->subpos.x += p->velocity.x; p->subpos.y += p->velocity.y; + // FIXME: think about % operator trickery ( % may give negative or positive results ) p->pos.x += p->subpos.x / 256; p->subpos.x %= 256; p->pos.y += p->subpos.y / 256; p->subpos.y %= 256; // apply friction force into the opposite movement direction Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-14 20:01:32 UTC (rev 271) +++ trunk/mass/level.c 2004-05-14 21:00:07 UTC (rev 272) @@ -448,8 +448,6 @@ // because -1 has special meaning and >255 is an error m->heading &= 255; - // FIXME m->heading % 256 machine dependant if m->heading < 0 !!! - // there must be several other places relaying on it becoming >= 0 assert(m->heading >= 0 && m->heading <= 255); /* start SCRIPT_DUMP_MASS */ Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-14 20:01:32 UTC (rev 271) +++ trunk/mass/mass.c 2004-05-14 21:00:07 UTC (rev 272) @@ -1270,10 +1270,10 @@ if (m->headingAdd != 0 && (!m->slowHeadingAdd || m->age % 32 == 0)) { if (m->headingAdd > 0) { - m->heading = (m->heading + m->headingAdd) % 256; + m->heading = (m->heading + m->headingAdd) & 255; } else { int half = -m->headingAdd/2; - m->heading = (m->heading + randarea(-half, 2*half+1)) % 256; + m->heading = (m->heading + randarea(-half, 2*half+1)) & 255; } } Modified: trunk/mass/math2d.c =================================================================== --- trunk/mass/math2d.c 2004-05-14 20:01:32 UTC (rev 271) +++ trunk/mass/math2d.c 2004-05-14 21:00:07 UTC (rev 272) @@ -95,8 +95,8 @@ int AngleFromTo(int a, int b) { - a %= 256; - b %= 256; + a &= 255; + b &= 255; if (abs(b-a) <= 128) return b-a; a += (a<b) ? +256 : -256; assert(abs(b-a) < 128); Modified: trunk/mass/tests.c =================================================================== --- trunk/mass/tests.c 2004-05-14 20:01:32 UTC (rev 271) +++ trunk/mass/tests.c 2004-05-14 21:00:07 UTC (rev 272) @@ -6,6 +6,7 @@ #include "field.h" #include "config.h" #include "debug.h" +#include "random.h" #ifndef DEBUG int tests() { @@ -134,9 +135,12 @@ void Test_Random() { + int i, small; randareaseed(300); test(randarea(1, 353) == 44, "Predictable randarea1"); test(randarea(-11, 17) == 1, "Predictable randarea2"); + for (i=0, small=0; i<200; i++) if (synced_random() < 0) small++; + test(small == 0, "Strict positive synced_random"); } void Test_Parser() |
From: <sv...@ol...> - 2004-05-14 20:01:59
|
Author: martin Date: 2004-05-14 22:01:32 +0200 (Fri, 14 May 2004) New Revision: 271 Modified: trunk/mass/LEVELS trunk/mass/data/testlevel.txt trunk/mass/effects.c trunk/mass/effects.h trunk/mass/level.c trunk/mass/mass.c trunk/mass/mass.h trunk/mass/video2d.c trunk/mass/video3d.c Log: generalized effects; added (simple proof-of-concept) spark effect Modified: trunk/mass/LEVELS =================================================================== --- trunk/mass/LEVELS 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/LEVELS 2004-05-14 20:01:32 UTC (rev 271) @@ -301,6 +301,10 @@ draw a gray elipse that indicates the heading (must have a certein height before it becomes visible); SLOW! +drawSparks (default: false) + draw a spark effect from time to time (a bright point gleaming for a short + time over the hightest mass pixel) + experimentalBorderPoints (default: false) experimental new faster border point algorithm Modified: trunk/mass/data/testlevel.txt =================================================================== --- trunk/mass/data/testlevel.txt 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/data/testlevel.txt 2004-05-14 20:01:32 UTC (rev 271) @@ -24,6 +24,8 @@ cell true cell_activation -1 speedPerturb 1 + playerFood 1 + drawSparks true :Swarm 12 -20 :Swarm 24 -20 Modified: trunk/mass/effects.c =================================================================== --- trunk/mass/effects.c 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/effects.c 2004-05-14 20:01:32 UTC (rev 271) @@ -6,89 +6,136 @@ int fogRadius; Color fogColor; -E_Mouse cursor; -E_Fog * fogs[MAX_EFFECTS]; -int numFogs; -E_Spark * sparks[MAX_EFFECTS]; -int numSparks; -E_Lightning * lightnings[MAX_EFFECTS]; -int numLightnings; +//FIXME: unused? E_Mouse cursor; +Effect ** effects; + void InitEffects() { RGBSET(fogColor, 127, 120, 130); - numLightnings = 0; - numSparks = 0; - numFogs = 0; fogRadius = 0; + effects = malloc(sizeof(Effect*)); + effects[0] = NULL; } +void CleanEffects() +{ + int i; + for (i=0; effects[i]; i++) effects[i]->freeFunc(effects[i]); + free(effects); + effects = malloc(sizeof(Effect*)); + effects[0] = NULL; +} + void FreeEffects() { + CleanEffects(); + free(effects); +} + +void AddEffect(Effect * e) +{ int i; - for (i=0; i<numLightnings; i++) free(lightnings[i]); - numLightnings = 0; - for (i=0; i<numSparks; i++) free(sparks[i]); - numSparks = 0; - for (i=0; i<numFogs; i++) free(fogs[i]); - numFogs = 0; + for (i=0; effects[i]; i++) ; + effects = realloc(effects, (i+2)*sizeof(Effect*)); + effects[i] = e; + effects[i+1] = NULL; } -void ContinueEffects() +void ContinueLightning(void * e); +void FreeLightning(void * e); +E_Lightning * AddLightning() { - int i, j, k; E_Lightning * l; - - for (i=0; i < numLightnings; i++) { - l = lightnings[i]; - for (j=0; j<l->numPoints - 1; j++) { - Point p1, p2; - if (j > 0) { - //l->points[j].x += randarea(-2, 5); - //l->points[j].y += randarea(-2, 5); - l->points[j].x += randarea(-2, 5); - l->points[j].y += randarea(-2, 5); + l = calloc(1, sizeof(E_Lightning)); + l->base.type = E_LIGHTNING; + l->base.freeFunc = FreeLightning; + l->base.continueFunc = ContinueLightning; + AddEffect((Effect*)l); + return l; +} +void FreeLightning(void * e) +{ + free(e); +} +void ContinueLightning(void * e) +{ + int j, k; + E_Lightning * l = (E_Lightning*)e; + for (j=0; j<l->numPoints - 1; j++) { + Point p1, p2; + if (j > 0) { + //l->points[j].x += randarea(-2, 5); + //l->points[j].y += randarea(-2, 5); + l->points[j].x += randarea(-2, 5); + l->points[j].y += randarea(-2, 5); + } + p1 = l->points[j]; + p2 = l->points[j+1]; + for (k=0; k<32; k++) { + Point p; + FieldPoint * fp; + p.x = (p1.x * (32-k) + p2.x * k) / 32; + p.y = (p1.y * (32-k) + p2.y * k) / 32; + //p.x += randarea(-l->r, 2*l->r + 1); + //p.y += randarea(-l->r, 2*l->r + 1); + p.x += randarea(-1, 3); + p.y += randarea(-1, 3); + /* destroy something */ + fp = FieldPoint(p); + if (fp->owner) { + fp->height = 0; + if (fp->owner->speed < 10) fp->owner->speed = 10; } - p1 = l->points[j]; - p2 = l->points[j+1]; - for (k=0; k<32; k++) { - Point p; - FieldPoint * fp; - p.x = (p1.x * (32-k) + p2.x * k) / 32; - p.y = (p1.y * (32-k) + p2.y * k) / 32; - //p.x += randarea(-l->r, 2*l->r + 1); - //p.y += randarea(-l->r, 2*l->r + 1); - p.x += randarea(-1, 3); - p.y += randarea(-1, 3); - /* destroy something */ - fp = FieldPoint(p); - if (fp->owner) { - fp->height = 0; - if (fp->owner->speed < 10) fp->owner->speed = 10; - } - } } - l->r = l->maxR * (l->duration - l->age) / l->duration; - if (l->age > l->duration) { - free(l); - lightnings[i] = lightnings[--numLightnings]; - i--; - } else { - l->age++; - } } + l->r = l->maxR * (l->duration - l->age) / l->duration; + if (l->age > l->duration) { + l->base.remove = 1; + } else { + l->age++; + } } -E_Spark * Spark(int x, int y, Color c) +void ContinueSpark(void * e); +void FreeSpark(void * e); +E_Spark * AddSpark() { E_Spark * s; - //TODO - return NULL; s = calloc(1, sizeof(E_Spark)); - s->x = x; - s->y = y; - s->ttl = 100; - + s->base.type = E_SPARK; + s->base.freeFunc = FreeSpark; + s->base.continueFunc = ContinueSpark; + AddEffect((Effect*)s); return s; } +void FreeSpark(void * e) +{ + free(e); +} +void ContinueSpark(void * e) +{ + //TODO: velocity, increment x/y + E_Spark * s = (E_Spark*)e; + s->duration--; + if (s->duration == 0) s->base.remove = 1; + s->radius = randarea(2, 8); + //if (s->radius > 1) s->radius--; +} +void ContinueEffects() +{ + int i, j; + for (i=0; effects[i]; i++) { + if (!effects[i]->remove) effects[i]->continueFunc((void*)effects[i]); + } + for (i=j=0; effects[i]; i++, j++) { + if (effects[i]->remove) { + effects[i]->freeFunc((void*)effects[i]); + j--; + } else { + effects[j] = effects[i]; + } + } + effects[j] = NULL; +} Modified: trunk/mass/effects.h =================================================================== --- trunk/mass/effects.h 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/effects.h 2004-05-14 20:01:32 UTC (rev 271) @@ -11,24 +11,35 @@ #include "math2d.h" #include "effects.h" +//// global "fog" effect // for display: fog radius pixels surrounding the current player // 0 = disabled extern int fogRadius; extern Color fogColor; #define MAX_FOG_RADIUS 800 -/* maximum number of effects per kind */ -#define MAX_EFFECTS 50 +typedef enum { + E_INVALID = 0, + E_LIGHTNING, + E_SPARK, +} Effect_Type; -#define MAX_LIGHTNING_POINTS 33 +typedef struct { + Effect_Type type; + void (*freeFunc)(void * self); + void (*continueFunc)(void * self); + int remove; +} Effect; + typedef struct Lightning { - struct Lightning * next; + Effect base; /* TODO (planned): A parameter to - decide the length of the lightning - say how often / strong the points are reordered during it - do some other funky things */ +#define MAX_LIGHTNING_POINTS 33 Point points[MAX_LIGHTNING_POINTS]; int numPoints; int age; @@ -36,44 +47,38 @@ int r; int maxR; int duration; - // for video*.c: + // only for video*.c: Color c; } E_Lightning; typedef struct { - int x, y, z; - Color c; - /* in pixels */ - int radius; - /* 0 = no fog, 256 = center not visible any more */ - int intensity; -} E_Fog; - -typedef struct { + Effect base; int x, y; - int vx, vy; + //int vx, vy; int radius; - int ttl; + int strength; + int duration; Color c; } E_Spark; +/* FIXME: planned? typedef struct { int x, y; // mouse position in mass coordinates int cx, cy; // the game's point of atention } E_Mouse; extern E_Mouse cursor; -extern E_Lightning * lightnings[MAX_EFFECTS]; -extern int numLightnings; -//extern E_Fog * fogs[MAX_EFFECTS]; -//extern E_Spark * sparks[MAX_EFFECTS]; +*/ -/* Used by the mass engine: */ -//Lightning(Point from, Point to, int thickness); -//extern E_Spark * Spark(int x, int y, Color c); +// NULL terminated list +extern Effect ** effects; +extern E_Lightning * AddLightning(void); +extern E_Spark * AddSpark(); + /* For main(): */ extern void InitEffects(void); +extern void CleanEffects(void); extern void ContinueEffects(void); extern void FreeEffects(void); Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/level.c 2004-05-14 20:01:32 UTC (rev 271) @@ -423,6 +423,8 @@ currentMass->wakeOnPlayer = str2boolean(value, &error); } else if (!strcmp(name, "drawelipsoid")) { currentMass->drawElipsoid = str2boolean(value, &error); + } else if (!strcmp(name, "drawsparks")) { + currentMass->drawSparks = str2boolean(value, &error); } else if (!strcmp(name, "experimentalborderpoints")) { currentMass->experimentalBorderPoints = str2boolean(value, &error); } else if (!strcmp(name, "debugtest")) { @@ -678,6 +680,9 @@ if (m->drawElipsoid != parent->drawElipsoid) { fprintf(f, " drawElipsoid %d\n", m->drawElipsoid); } + if (m->drawSparks != parent->drawSparks) { + fprintf(f, " drawSparks %d\n", m->drawSparks); + } if (m->experimentalBorderPoints != parent->experimentalBorderPoints) { fprintf(f, " experimentalBorderPoints %d\n", m->experimentalBorderPoints); } Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/mass.c 2004-05-14 20:01:32 UTC (rev 271) @@ -132,6 +132,7 @@ m->superGrow = 0; m->wakeOnPlayer = 0; m->drawElipsoid = 0; + m->drawSparks = 0; m->experimentalBorderPoints = 0; m->debugTest = 0; /* SCRIPT_SET_MASS_DEFAULTS */ @@ -215,6 +216,7 @@ m->superGrow = copy->superGrow; m->wakeOnPlayer = copy->wakeOnPlayer; m->drawElipsoid = copy->drawElipsoid; + m->drawSparks = copy->drawSparks; m->experimentalBorderPoints = copy->experimentalBorderPoints; m->debugTest = copy->debugTest; /* SCRIPT_COPY_MASS */ @@ -1320,17 +1322,6 @@ if (m->energy < 256 && m->age % 64 == 0) m->energy++; //printf("energy = %d\n", m->energy); #if 0 - if (p->button1) { - Color c; - while (m->energy > 10) { - m->energy -= 10; - //CreateMassattackMass(c); - RGBSET(c, 255, 255, 0); - Spark(massCenter.x, massCenter.y, c); - } - } -#endif -#if 0 if (p->button1 && m->energy >= 200) { float dir; Point p; @@ -1583,7 +1574,7 @@ } if (m->isLightningMass && m->energy < 256 && m->age % 16 == 0) m->energy++; - if (m->isLightningMass && m->pulse > 20 && m->energy > 80 && numLightnings < 16) { + if (m->isLightningMass && m->pulse > 20 && m->energy > 80) { int i, heading; Point p; E_Lightning * l; @@ -1591,7 +1582,7 @@ /* replace some of the mass that is going to be lost */ m->bufferMass += 100*HEIGHT_NORM; m->growRounds += 300; - lightnings[numLightnings++] = l = calloc(1, sizeof(E_Lightning)); + l = AddLightning(); l->duration = 30; l->age = 0; l->r = 4; @@ -1713,6 +1704,16 @@ DeleteRandomPixel(m); AddBorderPixel(m); } + + if (m->drawSparks && randarea(0, 20) == 0) { + E_Spark * s; + s = AddSpark(); + s->duration = 10; + s->radius = 5; + s->x = massCenter.x; + s->y = massCenter.y; + RGBSET(s->c, 241, 251, 89); + } #if 0 if (m->isNetworkMass) { Modified: trunk/mass/mass.h =================================================================== --- trunk/mass/mass.h 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/mass.h 2004-05-14 20:01:32 UTC (rev 271) @@ -220,6 +220,8 @@ unsigned wakeOnPlayer : 1; //% boolean % default=0 % draw a gray elipse that indicates the heading (must have a certein height before it becomes visible); SLOW! unsigned drawElipsoid : 1; + //% boolean % default=0 % draw a spark effect from time to time (a bright point gleaming for a short time over the hightest mass pixel) + unsigned drawSparks : 1; //% boolean % default=0 % experimental new faster border point algorithm unsigned experimentalBorderPoints : 1; //% boolean % default=0 % does whatever I want it to (don't use) Modified: trunk/mass/video2d.c =================================================================== --- trunk/mass/video2d.c 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/video2d.c 2004-05-14 20:01:32 UTC (rev 271) @@ -286,6 +286,7 @@ //alpha = 255 - MIN(-dist/32, 255); alpha = MAX(alpha, 1); alpha += rand() % alpha; + // FIXME: use DrawAlphaPixel instead alpha = MIN(alpha, 255); GetPixel(x, y, c); for (i=0; i<3; i++) { @@ -298,23 +299,22 @@ AddDirtyRect(screenRect); } -void DrawBroadLinePixel(int y, int x, float pos, E_Lightning * l) +// (x, y) are in mass coordinates; alpha<=0 transparent >=255 full occupacy +inline void DrawAlphaPixel(int x, int y, int alpha, Color c2) { Color c; - double b; - int i, alpha; + int i; + if (alpha <= 0) return; x = (x-screenRect.x)&FIELDWRAP; y = (y-screenRect.y)&FIELDWRAP; if (x<0 || y<0 || x>=DISPLAY_SCREENX || y>=DISPLAY_SCREENY) return; + if (alpha >= 255) { + SetPixel(x, y, c2); + return; + } GetPixel(x, y, c); - - b = pos * 2 + 0.3; - if (b > 1) b = 1; - alpha = (1-pos) * 256; - if (alpha < 0) alpha = 0; - if (alpha > 255) alpha = 255; for (i=0; i<3; i++) { - c[i] = ((255-alpha) * c[i] + alpha* l->c[i]) / 256; + c[i] = ((255-alpha) * c[i] + alpha* c2[i]) / 256; } SetPixel(x, y, c); } @@ -390,21 +390,44 @@ for (y = (int)(posy - orthogonalBroadness/2) + 1; y <= (int)(posy + orthogonalBroadness/2); y++) { //check the crop lines if (startVector.x * (y-start.y) - startVector.y * (x-start.x) <= 0 && endVector.x * (y-end.y) - endVector.y * (x-end.x) <= 0) { + int alpha; float pos; //ok, this point is not cropped //calculate distance to the center of the line (0=at the center, 1=at either border of the line) pos = abs((float)(y) - posy) / (float)(orthogonalBroadness/2); - if (inverted) - DrawBroadLinePixel(x, y, pos, l); - else - DrawBroadLinePixel(y, x, pos, l); + alpha = (1-pos) * 256; + if (inverted) { + DrawAlphaPixel(y, x, alpha, l->c); + } else { + DrawAlphaPixel(x, y, alpha, l->c); + } } } } } } +void DrawSpark(E_Spark * s) +{ + int x, y; + int mul; + // OPTIMIZE: probably very slow (and ugly anyway) + if (s->radius <= 0) return; + mul = 256 / sqr(s->radius); + for (x=0; x<s->radius; x++) { + for (y=0; y<s->radius; y++) { + int alpha = 256 - (sqr(x) + sqr(y)) * mul; + alpha += rand() % 128 - 64; + DrawAlphaPixel(s->x + x, s->y + y, alpha, s->c); + DrawAlphaPixel(s->x - x, s->y + y, alpha, s->c); + DrawAlphaPixel(s->x + x, s->y - y, alpha, s->c); + DrawAlphaPixel(s->x - x, s->y - y, alpha, s->c); + } + } + // OPTIMIZE: don't redraw the whole screen, the spark might not even have been on the screen + AddDirtyRect(screenRect); +} void DrawLightning(E_Lightning * l) { int i; @@ -466,7 +489,18 @@ { int i; if (fogRadius) DrawFog(); - for (i=0; i<numLightnings; i++) DrawLightning(lightnings[i]); + for (i=0; effects[i]; i++) { + switch (effects[i]->type) { + case E_LIGHTNING: + DrawLightning((E_Lightning*)effects[i]); + break; + case E_SPARK: + DrawSpark((E_Spark*)effects[i]); + break; + default: + DebugLevel(2, "Warning: Video2D cannot display effect %d\n", effects[i]->type); + } + } //DrawMouse(); } Modified: trunk/mass/video3d.c =================================================================== --- trunk/mass/video3d.c 2004-05-09 11:12:28 UTC (rev 270) +++ trunk/mass/video3d.c 2004-05-14 20:01:32 UTC (rev 271) @@ -180,7 +180,15 @@ glBegin(GL_POINTS); for (i=0; visibleMasses[i]; i++) OGL_Draw_2D_Mass(visibleMasses[i]); glEnd(); - for (i=0; i<numLightnings; i++) OGL_Draw_2D_Lightning(lightnings[i]); + for (i=0; effects[i]; i++) { + switch (effects[i]->type) { + case E_LIGHTNING: + OGL_Draw_2D_Lightning((E_Lightning*)effects[i]); + break; + default: + DebugLevel(2, "OGL_Draw_2D: cannot display effect %d\n", effects[i]->type); + } + } glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); @@ -495,8 +503,16 @@ OGL_Draw_3D_Mass(m); } -//Draw lighting - for (i=0; i<numLightnings; i++) OGL_Draw_3D_Lightning(lightnings[i]); +//Draw effects + for (i=0; effects[i]; i++) { + switch (effects[i]->type) { + case E_LIGHTNING: + OGL_Draw_3D_Lightning((E_Lightning*)effects[i]); + break; + default: + DebugLevel(2, "OGL_Draw_3D: cannot display effect %d\n", effects[i]->type); + } + } glDisable(GL_FOG); glDisable(GL_BLEND); |
From: <sv...@ol...> - 2004-05-09 11:12:34
|
Author: martin Date: 2004-05-09 13:12:28 +0200 (Sun, 09 May 2004) New Revision: 270 Modified: trunk/mass/networkplayer.c Log: fixed warning without sdl_net Modified: trunk/mass/networkplayer.c =================================================================== --- trunk/mass/networkplayer.c 2004-05-09 11:03:17 UTC (rev 269) +++ trunk/mass/networkplayer.c 2004-05-09 11:12:28 UTC (rev 270) @@ -373,9 +373,9 @@ void InitNetworkPlayer() { int i, j; +#ifndef DISABLE_SDLNET int expectedPlayers = 0; -#ifndef DISABLE_SDLNET if(SDLNet_Init()==-1) { printf("SDLNet_Init: %s\n", SDLNet_GetError()); exit(2); |
From: <sv...@ol...> - 2004-05-09 11:03:24
|
Author: martin Date: 2004-05-09 13:03:17 +0200 (Sun, 09 May 2004) New Revision: 269 Modified: trunk/mass/LEVELS trunk/mass/data/testlevel.txt trunk/mass/level.c trunk/mass/mass.c trunk/mass/mass.h Log: added speedperturb feature Modified: trunk/mass/LEVELS =================================================================== --- trunk/mass/LEVELS 2004-05-09 09:14:52 UTC (rev 268) +++ trunk/mass/LEVELS 2004-05-09 11:03:17 UTC (rev 269) @@ -287,6 +287,10 @@ isNetworkMass (default: false) FIXME: planned? +speedPerturb (default: false) + randomly change the speed a bit (use this to avoid identical masses to grow + up exactly simultanous; this property disables itself after some time) + superGrow (default: false) grow much much faster (not linear) Modified: trunk/mass/data/testlevel.txt =================================================================== --- trunk/mass/data/testlevel.txt 2004-05-09 09:14:52 UTC (rev 268) +++ trunk/mass/data/testlevel.txt 2004-05-09 11:03:17 UTC (rev 269) @@ -23,6 +23,7 @@ speed 64 cell true cell_activation -1 + speedPerturb 1 :Swarm 12 -20 :Swarm 24 -20 Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-09 09:14:52 UTC (rev 268) +++ trunk/mass/level.c 2004-05-09 11:03:17 UTC (rev 269) @@ -415,6 +415,8 @@ currentMass->isLightningMass = str2boolean(value, &error); } else if (!strcmp(name, "isnetworkmass")) { currentMass->isNetworkMass = str2boolean(value, &error); + } else if (!strcmp(name, "speedperturb")) { + currentMass->speedPerturb = str2boolean(value, &error); } else if (!strcmp(name, "supergrow")) { currentMass->superGrow = str2boolean(value, &error); } else if (!strcmp(name, "wakeonplayer")) { @@ -664,6 +666,9 @@ if (m->isNetworkMass != parent->isNetworkMass) { fprintf(f, " isNetworkMass %d\n", m->isNetworkMass); } + if (m->speedPerturb != parent->speedPerturb) { + fprintf(f, " speedPerturb %d\n", m->speedPerturb); + } if (m->superGrow != parent->superGrow) { fprintf(f, " superGrow %d\n", m->superGrow); } Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-09 09:14:52 UTC (rev 268) +++ trunk/mass/mass.c 2004-05-09 11:03:17 UTC (rev 269) @@ -128,6 +128,7 @@ m->isCoinMass = 0; m->isLightningMass = 0; m->isNetworkMass = 0; + m->speedPerturb = 0; m->superGrow = 0; m->wakeOnPlayer = 0; m->drawElipsoid = 0; @@ -210,6 +211,7 @@ m->isCoinMass = copy->isCoinMass; m->isLightningMass = copy->isLightningMass; m->isNetworkMass = copy->isNetworkMass; + m->speedPerturb = copy->speedPerturb; m->superGrow = copy->superGrow; m->wakeOnPlayer = copy->wakeOnPlayer; m->drawElipsoid = copy->drawElipsoid; @@ -1272,6 +1274,12 @@ m->heading = (m->heading + randarea(-half, 2*half+1)) % 256; } } + + if (m->speedPerturb) { + m->speed += randarea(-1, 3); + if (m->speed <= 0) m->speed = 1; + if (randarea(0, 100) == 0) m->speedPerturb = 0; + } if (m->player != -1) { Player * p = player + m->player; Modified: trunk/mass/mass.h =================================================================== --- trunk/mass/mass.h 2004-05-09 09:14:52 UTC (rev 268) +++ trunk/mass/mass.h 2004-05-09 11:03:17 UTC (rev 269) @@ -212,6 +212,8 @@ unsigned isLightningMass : 1; //% boolean % default=0 % FIXME: planned? unsigned isNetworkMass : 1; + //% boolean % default=0 % randomly change the speed a bit (use this to avoid identical masses to grow up exactly simultanous; this property disables itself after some time) + unsigned speedPerturb : 1; //% boolean % default=0 % grow much much faster (not linear) unsigned superGrow : 1; //% boolean % default=0 % the mass gets a very high speed the first time a player approximates |
From: <sv...@ol...> - 2004-05-09 09:15:01
|
Author: martin Date: 2004-05-09 11:14:52 +0200 (Sun, 09 May 2004) New Revision: 268 Modified: trunk/mass/LEVELS trunk/mass/config.c trunk/mass/config.h trunk/mass/data/testlevel.txt trunk/mass/debug.c trunk/mass/field.c trunk/mass/level.c trunk/mass/mass.c trunk/mass/mass.h Log: made cell and swarm code configurable Modified: trunk/mass/LEVELS =================================================================== --- trunk/mass/LEVELS 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/LEVELS 2004-05-09 09:14:52 UTC (rev 268) @@ -168,11 +168,27 @@ baseLineGrowth_randomStepStart (default: 0) if set, the first step is not always in the mass center, but still on the - line + line (probably useful with big step size) baseLineGrowth_setHeight (default: 0) if set, the height is not added but re-set (if baseLineGrowth > 0) +cell (default: false) + enable cell functions (rules similar to game of life, get input from nearest + neighbours) + +cell_activation (default: 1) + cell activation status (0 or 1, or -1 for random; resets baseColor to + hardcoded values for now) + +swarm (default: false) + enable simple swarm algorithm (resets baseColor to hardcoded values for now) + FIXME: needs tuning, not of much use yet + +swarm_pulse (default: 0) + used to call other swarm members (energy is spent to increase if something is + happening, then decrease quickly back to zero) + headingAdd (default: 0) add this value to the heading each round; -100 means a random value between -50 and +50 @@ -249,10 +265,12 @@ can a player simply eat this mass? playerSwarm (default: false) - for player masses, makes them circle around the player center point + for player masses, makes them circle around the player center point (has + nothing to do with the swarm property above) isWall (default: false) - FIXME: what does this? + enables wall code (decrease speed, join other walls, adapt to speed of other + walls) isProjectil (default: false) FIXME: what does this? Modified: trunk/mass/config.c =================================================================== --- trunk/mass/config.c 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/config.c 2004-05-09 09:14:52 UTC (rev 268) @@ -27,7 +27,7 @@ config.profile = 0; config.exitFrame = 0; config.heavyDebug = -1; - config.levelfile = malloc_strcpy("menu.txt"); + config.levelfile = malloc_strcpy("testlevel.txt"); config.maxCPS = 120; config.maxSkip = 20; /* } SCRIPT_RESET_CONFIG */ @@ -397,7 +397,7 @@ fprintf(f, "#heavyDebug -1\n"); fprintf(f, "\n"); fprintf(f, "## game description file (levelfile) to play\n"); - fprintf(f, "#levelfile menu.txt\n"); + fprintf(f, "#levelfile testlevel.txt\n"); fprintf(f, "\n"); fprintf(f, "## [framecontrol] maximum game cycles per second (0 unlimited)\n"); fprintf(f, "#maxCPS 120\n"); Modified: trunk/mass/config.h =================================================================== --- trunk/mass/config.h 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/config.h 2004-05-09 09:14:52 UTC (rev 268) @@ -32,7 +32,7 @@ int exitFrame; //% int % min=-1,default=-1 % [debug] enable HEAVY_DEBUG checks at this frame int heavyDebug; - //% string % default=menu.txt % game description file (levelfile) to play + //% string % default=testlevel.txt % game description file (levelfile) to play char * levelfile; //% int % min=0,default=120 % [framecontrol] maximum game cycles per second (0 unlimited) int maxCPS; Modified: trunk/mass/data/testlevel.txt =================================================================== --- trunk/mass/data/testlevel.txt 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/data/testlevel.txt 2004-05-09 09:14:52 UTC (rev 268) @@ -11,15 +11,64 @@ growRounds 500 :Player -20 -20 -#:Player 0 -20 -#:Player +20 -20 -#:Player -20 0 -#:Player 0 0 -#:Player +20 0 -#:Player -20 +20 -#:Player 0 +20 +Swarm: + flatteningMovement 1 + growRounds 200 + #swarm true + #energy 2000 + #heading 64 + headingAdd -2 + velocity 80 + speed 64 + cell true + cell_activation -1 +:Swarm 12 -20 +:Swarm 24 -20 +:Swarm 16 -20 +:Swarm 28 -20 +:Swarm -12 -20 +:Swarm -24 -20 +:Swarm -16 -20 +:Swarm -28 -20 + +:Swarm 12 -25 +:Swarm 24 -25 +:Swarm 16 -25 +:Swarm 28 -25 +:Swarm -12 -25 +:Swarm -24 -25 +:Swarm -16 -25 +:Swarm -28 -25 + +:Swarm 12 -28 +:Swarm 24 -28 +:Swarm 16 -28 +:Swarm 28 -28 +:Swarm -12 -28 +:Swarm -24 -28 +:Swarm -16 -28 +:Swarm -28 -28 + +:Swarm 12 -18 +:Swarm 24 -18 +:Swarm 16 -18 +:Swarm 28 -18 +:Swarm -12 -18 +:Swarm -24 -18 +:Swarm -16 -18 +:Swarm -28 -18 + +:Swarm 12 -11 +:Swarm 24 -11 +:Swarm 16 -11 +:Swarm 28 -11 +:Swarm -12 -11 +:Swarm -24 -11 +:Swarm -16 -11 +:Swarm -28 -11 + # baseColor 200 255 20 # playerSwarm 0 # attractPlayer 512 Modified: trunk/mass/debug.c =================================================================== --- trunk/mass/debug.c 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/debug.c 2004-05-09 09:14:52 UTC (rev 268) @@ -59,6 +59,6 @@ { printf("--- Mass %X ---\n", (int)m); printf("maxRect = %s, m->massCell = %d\n", RectString(m->maxRect), m->massCell); - printf(": %s\n", m->class ? m->class : ""); + printf(":%s\n", m->class ? m->class : ""); DumpMassProperties(stdout, m); } Modified: trunk/mass/field.c =================================================================== --- trunk/mass/field.c 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/field.c 2004-05-09 09:14:52 UTC (rev 268) @@ -287,6 +287,7 @@ } if (m->heading == -1) m->heading = randarea(0, 256); + if (m->cell_activation == -1) m->cell_activation = randarea(0, 2); DebugLevel(3, "Mass %X added to the game.\n", (int)m); } Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/level.c 2004-05-09 09:14:52 UTC (rev 268) @@ -330,6 +330,17 @@ currentMass->baseLineGrowth_randomStepStart = str2int(value, &error); } else if (!strcmp(name, "baselinegrowth_setheight")) { currentMass->baseLineGrowth_setHeight = str2int(value, &error); + } else if (!strcmp(name, "cell")) { + currentMass->cell = str2boolean(value, &error); + } else if (!strcmp(name, "cell_activation")) { + currentMass->cell_activation = str2int(value, &error); + if (!error && currentMass->cell_activation < -1) error = "out of range, minimum is -1"; + if (!error && currentMass->cell_activation > 1) error = "out of range, maximum is 1"; + } else if (!strcmp(name, "swarm")) { + currentMass->swarm = str2boolean(value, &error); + } else if (!strcmp(name, "swarm_pulse")) { + currentMass->swarm_pulse = str2int(value, &error); + if (!error && currentMass->swarm_pulse < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "headingadd")) { currentMass->headingAdd = str2int(value, &error); if (!error && currentMass->headingAdd < -256) error = "out of range, minimum is -256"; @@ -546,6 +557,18 @@ if (m->baseLineGrowth_setHeight != parent->baseLineGrowth_setHeight) { fprintf(f, " baseLineGrowth_setHeight %d\n", m->baseLineGrowth_setHeight); } + if (m->cell != parent->cell) { + fprintf(f, " cell %d\n", m->cell); + } + if (m->cell_activation != parent->cell_activation) { + fprintf(f, " cell_activation %d\n", m->cell_activation); + } + if (m->swarm != parent->swarm) { + fprintf(f, " swarm %d\n", m->swarm); + } + if (m->swarm_pulse != parent->swarm_pulse) { + fprintf(f, " swarm_pulse %d\n", m->swarm_pulse); + } if (m->headingAdd != parent->headingAdd) { fprintf(f, " headingAdd %d\n", m->headingAdd); } Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/mass.c 2004-05-09 09:14:52 UTC (rev 268) @@ -36,7 +36,6 @@ assert(m->interfaces == NULL); if (m->displayData) (*m->displayData->freeFunc)(m->displayData); m->displayData = NULL; - free(m->cell); free(m->class); /* SCRIPT_FREE_MASS */ free(m->childClass); m->childClass = NULL; @@ -98,6 +97,10 @@ m->baseLineGrowth_step = 256; m->baseLineGrowth_randomStepStart = 0; m->baseLineGrowth_setHeight = 0; + m->cell = 0; + m->cell_activation = 1; + m->swarm = 0; + m->swarm_pulse = 0; m->headingAdd = 0; m->slowHeadingAdd = 1; m->childClass = malloc_strcpy("ChildClassNotSet"); @@ -174,6 +177,10 @@ m->baseLineGrowth_step = copy->baseLineGrowth_step; m->baseLineGrowth_randomStepStart = copy->baseLineGrowth_randomStepStart; m->baseLineGrowth_setHeight = copy->baseLineGrowth_setHeight; + m->cell = copy->cell; + m->cell_activation = copy->cell_activation; + m->swarm = copy->swarm; + m->swarm_pulse = copy->swarm_pulse; m->headingAdd = copy->headingAdd; m->slowHeadingAdd = copy->slowHeadingAdd; free(m->childClass); m->childClass = NULL; @@ -1380,9 +1387,9 @@ } } - if (m->cell && m->age > 10) { + if (m->swarm && m->age > 10) { if (m->energy < 40) m->energy++; - if (m->cell->pulse > 1) m->cell->pulse--; + if (m->swarm_pulse > 1) m->swarm_pulse--; if (m->velocity < 156) m->velocity += 10; if (m->age % 4 == 0) { /* time to reconsider the situation */ @@ -1410,10 +1417,10 @@ desiredVector.y = 0; nearest = NULL; for (i=0; (m2=ml[i]); i++) { - if (m2->cell) { + if (m2->swarm) { int d; - desiredVector = AddVectors(desiredVector, AngleToVector(m2->heading, m2->cell->pulse * 256)); - totPulse += m2->cell->pulse * 256; + desiredVector = AddVectors(desiredVector, AngleToVector(m2->heading, m2->swarm_pulse * 256)); + totPulse += m2->swarm_pulse * 256; d = Wrap_GetSquareDistance(massCenter, GetMassCenter(m2)); if (d < nearestDist || !nearest) { nearest = m2; @@ -1435,10 +1442,10 @@ /* oh, oh, the others are going to get out of sight! */ //if (m->speed < 2*256) m->speed += 25; /* cry out in pain! */ - m->cell->pulse += 20; + m->swarm_pulse += 20; m->energy -= 20; if (m->energy < 0) { - m->cell->pulse += m->energy; + m->swarm_pulse += m->energy; m->energy = 0; } //desiredAngle = VectorToAngle(VectorFromTo(massCenter, GetMassCenter(nearest))); @@ -1455,10 +1462,9 @@ //m->heading += randarea(-10, 21); } /* show the pulse */ - RGBSET(m->baseColor, MIN(255, 100+m->cell->pulse), MIN(255, 100+m->cell->pulse), MIN(255, m->cell->pulse*10)); + RGBSET(m->baseColor, MIN(255, 100+m->swarm_pulse), MIN(255, 100+m->swarm_pulse), MIN(255, m->swarm_pulse*10)); } -#ifdef OLD_GAME_OF_LIVE_CODE if (m->cell) { if (m->age > 8) { int r; /* radius */ @@ -1469,7 +1475,7 @@ m->age = 0; /* get the eight nearest cell masses */ /* FIXME: it is not circular but a rectangle */ - while (found < 8 && r < 10) { + while (found < 8 && r < 20) { int steps; int i; r++; @@ -1516,16 +1522,16 @@ int i; int c = 0; for (i=0; i<8; i++) { - c += neigh[i]->cell->golState; + c += neigh[i]->cell_activation; } /* game of live rules */ - if ((m->cell->golState == 1 && (c == 2 || c == 3)) - || (m->cell->golState == 0 && (c == 3))) { - m->cell->golState = 1; + if ((m->cell_activation == 1 && (c == 2 || c == 3)) + || (m->cell_activation == 0 && (c == 3))) { + m->cell_activation = 1; } else { - m->cell->golState = 0; + m->cell_activation = 0; } - if (m->cell->golState == 1) { + if (m->cell_activation == 1) { RGBSET(m->baseColor, 220, 220, 255); } else { RGBSET(m->baseColor, 80, 80, 80); @@ -1536,7 +1542,6 @@ } } } -#endif /* OLD_GAME_OF_LIVE_CODE */ if (m->shrink) m->bufferMass -= m->shrink; /* small masses are hard and buggy to control, so just kill them ;) */ Modified: trunk/mass/mass.h =================================================================== --- trunk/mass/mass.h 2004-05-09 07:58:01 UTC (rev 267) +++ trunk/mass/mass.h 2004-05-09 09:14:52 UTC (rev 268) @@ -48,17 +48,6 @@ unsigned eatme : 1; }; -typedef struct { - /* FIXME: much too much states. */ - /* a trial to implement game of life with masses ;-) */ - /* game of life state - 0 or 1 */ - int golState; - /* direction where this being will be going, perhaps. */ - int wishDir; - /* kind of activation */ - int pulse; -} CellInfo; - typedef struct _DummyDisplayData_ DummyDisplayData; struct _DummyDisplayData_ { void (*freeFunc)(DummyDisplayData *); @@ -76,7 +65,7 @@ int numPixels; // sum of all height values; not accurate, auto-updated int volume; - /* not accurate, auto-updated */ + // not accurate, auto-updated int maxHeight; //% int % min=0,default=4 % (flattening algo) parameter for move backward int weakSHR; @@ -93,11 +82,11 @@ //% int % min=0,default=256 % how often the mass is processed per frame int speed; int pos; - /* field.c: the sector (cell) the mass belongs to */ + // field.c: the sector (cell) the mass belongs to int massCell; - /* number of references (pointers) to this mass, 0 means mass destroyed */ + // number of references (pointers) to this mass, 0 means mass destroyed int refcount; - /* how the mass interacts with the neighbour masses (never NULL in game) */ + // how the mass interacts with the neighbour masses (never NULL in game) MassInterface * interfaces; //% int % min=0,default=1 % number of pixels to look for neighbour mass (for interfaces) ; 0 means don't (faster but neighbours are all threated as empty space) int lookDistance; @@ -111,10 +100,8 @@ enum { DT_NORMAL = 0, DT_FLAT } displayType; /* points frontend-specific data (OGL: OGLdisplayData) */ DummyDisplayData * displayData; - /* these points form the shape of the mass (if used) */ + // these points form the shape of the mass (if used) ShapePoint shapePoints[MAX_SHAPEPOINTS]; - /* generally the center of the rectangle (or hotspot? FIXME: not yet used.) */ - /*Point centerpoint;*/ //% int % min=0,default=80 % how many rounds the mass will grow int growRounds; //% int % min=0,default=0 % whenever the mass has fewer pixel than this count, grow @@ -159,8 +146,14 @@ unsigned baseLineGrowth_randomStepStart : 1; //% int % default=0 % if set, the height is not added but re-set (if baseLineGrowth > 0) unsigned baseLineGrowth_setHeight : 1; - // this algo behaves like a cell, getting input from the neighbours; FIXME: make it configurable - CellInfo * cell; + //% boolean % default=0 % enable cell functions (rules similar to game of life, get input from nearest neighbours) + unsigned cell : 1; + //% int % default=1, min=-1, max=1 % cell activation status (0 or 1, or -1 for random; resets baseColor to hardcoded values for now) + signed cell_activation : 2; + //% boolean % default=0 % enable simple swarm algorithm (resets baseColor to hardcoded values for now) FIXME: needs tuning, not of much use yet + unsigned swarm : 1; + //% int % default=0,min=0 % used to call other swarm members (energy is spent to increase if something is happening, then decrease quickly back to zero) + int swarm_pulse; //% int % min=-256,max=255,default=0 % add this value to the heading each round; -100 means a random value between -50 and +50 int headingAdd; //% boolean % default=1 % consicer headingAdd only every 32 rounds instead every round @@ -205,9 +198,9 @@ unsigned oldFlattening : 1; //% boolean % default=0 % can a player simply eat this mass? unsigned playerFood : 1; - //% boolean % default=0 % for player masses, makes them circle around the player center point + //% boolean % default=0 % for player masses, makes them circle around the player center point (has nothing to do with the swarm property above) unsigned playerSwarm : 1; - //% boolean % default=0 % FIXME: what does this? + //% boolean % default=0 % enables wall code (decrease speed, join other walls, adapt to speed of other walls) unsigned isWall : 1; //% boolean % default=0 % FIXME: what does this? unsigned isProjectil : 1; |
From: <sv...@ol...> - 2004-05-09 07:58:11
|
Author: martin Date: 2004-05-09 09:58:01 +0200 (Sun, 09 May 2004) New Revision: 267 Modified: trunk/mass/LEVELS trunk/mass/data/trapper.txt trunk/mass/field.c trunk/mass/field.h trunk/mass/level.c trunk/mass/mass.c trunk/mass/mass.h Log: blindly adapted baseLineGrowth Modified: trunk/mass/LEVELS =================================================================== --- trunk/mass/LEVELS 2004-05-08 19:48:24 UTC (rev 266) +++ trunk/mass/LEVELS 2004-05-09 07:58:01 UTC (rev 267) @@ -153,6 +153,26 @@ borderColorHeight (default: 0.0) draw points lower than this with secondColor +baseLineGrowth (default: 0.0) + grow mass around a line (through mass center, direction of heading) that much + for each pixel + +baseLineGrowth_start (default: 0.0) + extra-height to add to startpoint + +baseLineGrowth_end (default: 0.0) + extra-height to add to endpoint + +baseLineGrowth_step (default: 256) + distance between the pixels of the line (256 = 1 pixel) + +baseLineGrowth_randomStepStart (default: 0) + if set, the first step is not always in the mass center, but still on the + line + +baseLineGrowth_setHeight (default: 0) + if set, the height is not added but re-set (if baseLineGrowth > 0) + headingAdd (default: 0) add this value to the heading each round; -100 means a random value between -50 and +50 Modified: trunk/mass/data/trapper.txt =================================================================== --- trunk/mass/data/trapper.txt 2004-05-08 19:48:24 UTC (rev 266) +++ trunk/mass/data/trapper.txt 2004-05-09 07:58:01 UTC (rev 267) @@ -17,6 +17,7 @@ baseColor 200 170 200 speed 80 isWall 1 + baselineGrowth 2.0 PlayerMass: Mass growRounds 1200 Modified: trunk/mass/field.c =================================================================== --- trunk/mass/field.c 2004-05-08 19:48:24 UTC (rev 266) +++ trunk/mass/field.c 2004-05-09 07:58:01 UTC (rev 267) @@ -57,14 +57,6 @@ m->massCell = cell; } -Point FieldToPoint(FieldPoint * p) -{ - Point res; - res.y = (p - field) / FIELDSIZE; - res.x = (p - field) % FIELDSIZE; - return res; -} - void InitFieldMemory() { field = calloc(1, FIELDSIZE*FIELDSIZE*sizeof(FieldPoint)); Modified: trunk/mass/field.h =================================================================== --- trunk/mass/field.h 2004-05-08 19:48:24 UTC (rev 266) +++ trunk/mass/field.h 2004-05-09 07:58:01 UTC (rev 267) @@ -68,7 +68,6 @@ /* within a block */ + BLOCKSIZE*((y)&BLOCKWRAP) + ((x)&BLOCKWRAP)) /* FIXME: name conflict! FieldPoint is already used. Strange this works. */ #define FieldPoint(p) FieldXY((p).x, (p).y) -extern Point FieldToPoint(FieldPoint * p); /* for main() */ extern void InitFieldMemory(void); Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-08 19:48:24 UTC (rev 266) +++ trunk/mass/level.c 2004-05-09 07:58:01 UTC (rev 267) @@ -317,6 +317,19 @@ currentMass->plantGrowFruit = str2int(value, &error); } else if (!strcmp(name, "bordercolorheight")) { currentMass->borderColorHeight = str2h_int(value, &error); + } else if (!strcmp(name, "baselinegrowth")) { + currentMass->baseLineGrowth = str2h_int(value, &error); + } else if (!strcmp(name, "baselinegrowth_start")) { + currentMass->baseLineGrowth_start = str2h_int(value, &error); + } else if (!strcmp(name, "baselinegrowth_end")) { + currentMass->baseLineGrowth_end = str2h_int(value, &error); + } else if (!strcmp(name, "baselinegrowth_step")) { + currentMass->baseLineGrowth_step = str2int(value, &error); + if (!error && currentMass->baseLineGrowth_step < 1) error = "out of range, minimum is 1"; + } else if (!strcmp(name, "baselinegrowth_randomstepstart")) { + currentMass->baseLineGrowth_randomStepStart = str2int(value, &error); + } else if (!strcmp(name, "baselinegrowth_setheight")) { + currentMass->baseLineGrowth_setHeight = str2int(value, &error); } else if (!strcmp(name, "headingadd")) { currentMass->headingAdd = str2int(value, &error); if (!error && currentMass->headingAdd < -256) error = "out of range, minimum is -256"; @@ -515,6 +528,24 @@ if (m->borderColorHeight != parent->borderColorHeight) { fprintf(f, " borderColorHeight %.6f\n", ((float)m->borderColorHeight)/HEIGHT_NORM); } + if (m->baseLineGrowth != parent->baseLineGrowth) { + fprintf(f, " baseLineGrowth %.6f\n", ((float)m->baseLineGrowth)/HEIGHT_NORM); + } + if (m->baseLineGrowth_start != parent->baseLineGrowth_start) { + fprintf(f, " baseLineGrowth_start %.6f\n", ((float)m->baseLineGrowth_start)/HEIGHT_NORM); + } + if (m->baseLineGrowth_end != parent->baseLineGrowth_end) { + fprintf(f, " baseLineGrowth_end %.6f\n", ((float)m->baseLineGrowth_end)/HEIGHT_NORM); + } + if (m->baseLineGrowth_step != parent->baseLineGrowth_step) { + fprintf(f, " baseLineGrowth_step %d\n", m->baseLineGrowth_step); + } + if (m->baseLineGrowth_randomStepStart != parent->baseLineGrowth_randomStepStart) { + fprintf(f, " baseLineGrowth_randomStepStart %d\n", m->baseLineGrowth_randomStepStart); + } + if (m->baseLineGrowth_setHeight != parent->baseLineGrowth_setHeight) { + fprintf(f, " baseLineGrowth_setHeight %d\n", m->baseLineGrowth_setHeight); + } if (m->headingAdd != parent->headingAdd) { fprintf(f, " headingAdd %d\n", m->headingAdd); } Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-08 19:48:24 UTC (rev 266) +++ trunk/mass/mass.c 2004-05-09 07:58:01 UTC (rev 267) @@ -36,7 +36,6 @@ assert(m->interfaces == NULL); if (m->displayData) (*m->displayData->freeFunc)(m->displayData); m->displayData = NULL; - free(m->baseLineGrowth); free(m->cell); free(m->class); /* SCRIPT_FREE_MASS */ @@ -93,6 +92,12 @@ m->destructive = 0; m->plantGrowFruit = 0; m->borderColorHeight = 0.0*HEIGHT_NORM; + m->baseLineGrowth = 0.0*HEIGHT_NORM; + m->baseLineGrowth_start = 0.0*HEIGHT_NORM; + m->baseLineGrowth_end = 0.0*HEIGHT_NORM; + m->baseLineGrowth_step = 256; + m->baseLineGrowth_randomStepStart = 0; + m->baseLineGrowth_setHeight = 0; m->headingAdd = 0; m->slowHeadingAdd = 1; m->childClass = malloc_strcpy("ChildClassNotSet"); @@ -163,6 +168,12 @@ m->destructive = copy->destructive; m->plantGrowFruit = copy->plantGrowFruit; m->borderColorHeight = copy->borderColorHeight; + m->baseLineGrowth = copy->baseLineGrowth; + m->baseLineGrowth_start = copy->baseLineGrowth_start; + m->baseLineGrowth_end = copy->baseLineGrowth_end; + m->baseLineGrowth_step = copy->baseLineGrowth_step; + m->baseLineGrowth_randomStepStart = copy->baseLineGrowth_randomStepStart; + m->baseLineGrowth_setHeight = copy->baseLineGrowth_setHeight; m->headingAdd = copy->headingAdd; m->slowHeadingAdd = copy->slowHeadingAdd; free(m->childClass); m->childClass = NULL; @@ -1028,15 +1039,13 @@ Point center; Point pos; Point delta; - FieldPoint * p; - FieldPoint * lastPoint; + FieldPoint * fp; + Point p, lastPoint; Rect rect256; int backward; center = GetMassCenter(m); - p = FieldPoint(center); - /* not yet found */ - m->baseLineGrowth->head.x = -1; - m->baseLineGrowth->tail.x = -1; + p = center; + fp = FieldPoint(p); /* everything is *256, to be more accurate but still fast. */ /* + 128 for rounding */ center.x = center.x * 256 + 128; @@ -1045,10 +1054,10 @@ rect256.y = m->maxRect.y * 256; rect256.w = m->maxRect.w * 256; rect256.h = m->maxRect.h * 256; - delta = AngleToVector(m->heading, m->baseLineGrowth->step); - if (m->baseLineGrowth->randomStepStart) { + delta = AngleToVector(m->heading, m->baseLineGrowth_step); + if (m->baseLineGrowth_randomStepStart) { int movement; - movement = randarea(-m->baseLineGrowth->step/2, m->baseLineGrowth->step); + movement = randarea(-m->baseLineGrowth_step/2, m->baseLineGrowth_step); center.x += movement; center.y += movement; } @@ -1062,19 +1071,20 @@ delta.y = -delta.y; pos.x = center.x + delta.x; pos.y = center.y + delta.y; - p = FieldXY(pos.x>>8, pos.y>>8); + p.x = pos.x>>8; p.y = pos.y>>8; + fp = FieldPoint(p); lastPoint = p; } while (IsPointInRect(pos, rect256)) { /* 1. operate on this point (if valid) */ - if (p->owner == m) { - if (m->baseLineGrowth->height) { - if (m->baseLineGrowth->setHeight) { - m->bufferMass += p->height - m->baseLineGrowth->height; - p->height = m->baseLineGrowth->height; + if (fp->owner == m) { + if (m->baseLineGrowth) { + if (m->baseLineGrowth_setHeight) { + m->bufferMass += fp->height - m->baseLineGrowth; + fp->height = m->baseLineGrowth; } else { - p->height += m->baseLineGrowth->height; - m->bufferMass -= m->baseLineGrowth->height; + fp->height += m->baseLineGrowth; + m->bufferMass -= m->baseLineGrowth; } } lastPoint = p; @@ -1082,25 +1092,25 @@ /* 2. go to next point */ pos.x += delta.x; pos.y += delta.y; - p = FieldXY(pos.x>>8, pos.y>>8); + p.x = pos.x>>8; p.y = pos.y>>8; + fp = FieldPoint(p); } /* special threatement of the start/end */ { int height; if (backward) { - height = m->baseLineGrowth->start; - m->baseLineGrowth->head = FieldToPoint(lastPoint); + height = m->baseLineGrowth_start; } else { - height = m->baseLineGrowth->end; - m->baseLineGrowth->tail = FieldToPoint(lastPoint); + height = m->baseLineGrowth_end; } if (height > 0) { p = lastPoint; - if (m->baseLineGrowth->setHeight) { - m->bufferMass += p->height - height; - p->height = height; + fp = FieldPoint(p); + if (m->baseLineGrowth_setHeight) { + m->bufferMass += fp->height - height; + fp->height = height; } else { - p->height += height; + fp->height += height; m->bufferMass -= height; } } Modified: trunk/mass/mass.h =================================================================== --- trunk/mass/mass.h 2004-05-08 19:48:24 UTC (rev 266) +++ trunk/mass/mass.h 2004-05-09 07:58:01 UTC (rev 267) @@ -49,26 +49,6 @@ }; typedef struct { - /* The BaseLineGrowth algo draws a single line through the mass. - The line goes through the mass center. Start and end point are - threated specially. */ - /* How much height to add to each pixel on the line */ - int height; - /* Extra-height to add to start / endpoint. */ - int start, end; - /* distance between the pixel of the line (256 = 1 pixel) */ - int step; - /* start/end of the mass; calculated by the algo */ - Point head, tail; - /* if set, the first step is not always in the mass center, but - still on the line. */ - unsigned randomStepStart : 1; - /* if set, the height is not added but re-set (if > 0). Note that - the varibles start / end are used for the endpoints. */ - unsigned setHeight : 1; -} BaseLineGrowth; - -typedef struct { /* FIXME: much too much states. */ /* a trial to implement game of life with masses ;-) */ /* game of life state - 0 or 1 */ @@ -167,8 +147,18 @@ int plantGrowFruit; //% h_int % default=0.0 % draw points lower than this with secondColor int borderColorHeight; - // this algo grows mass around a line; FIXME: make it configurable - BaseLineGrowth * baseLineGrowth; + //% h_int % default=0.0 % grow mass around a line (through mass center, direction of heading) that much for each pixel + int baseLineGrowth; + //% h_int % default=0.0 % extra-height to add to startpoint + int baseLineGrowth_start; + //% h_int % default=0.0 % extra-height to add to endpoint + int baseLineGrowth_end; + //% int % default=256,min=1 % distance between the pixels of the line (256 = 1 pixel) + int baseLineGrowth_step; + //% int % default=0 % if set, the first step is not always in the mass center, but still on the line (probably useful with big step size) + unsigned baseLineGrowth_randomStepStart : 1; + //% int % default=0 % if set, the height is not added but re-set (if baseLineGrowth > 0) + unsigned baseLineGrowth_setHeight : 1; // this algo behaves like a cell, getting input from the neighbours; FIXME: make it configurable CellInfo * cell; //% int % min=-256,max=255,default=0 % add this value to the heading each round; -100 means a random value between -50 and +50 |
From: <sv...@ol...> - 2004-05-08 19:48:39
|
Author: martin Date: 2004-05-08 21:48:24 +0200 (Sat, 08 May 2004) New Revision: 266 Modified: trunk/mass/TODO trunk/mass/config.c trunk/mass/config.h trunk/mass/debug.c trunk/mass/level.c trunk/mass/mass.c trunk/mass/mass.h trunk/mass/update-code.py Log: save/load proof-of-concept working (needs integration) Added bad % operator discovery to TODO list. Modified: trunk/mass/TODO =================================================================== --- trunk/mass/TODO 2004-05-08 15:26:45 UTC (rev 265) +++ trunk/mass/TODO 2004-05-08 19:48:24 UTC (rev 266) @@ -2,6 +2,8 @@ Everything is sorted by priority. +- % operator is machine-dependant on negative values! check every place + Before release 0.4: - implement mass movement that moves further than 1 pixel per cycle - implement goals, at least detect player mass destruction (maybe resurrection) Modified: trunk/mass/config.c =================================================================== --- trunk/mass/config.c 2004-05-08 15:26:45 UTC (rev 265) +++ trunk/mass/config.c 2004-05-08 19:48:24 UTC (rev 266) @@ -54,12 +54,43 @@ return value; } +// read one single line from f, without '\n' or '\r' +char * malloc_freadline(FILE * f) +{ + char * s; + int size = 64; + int pos = -1; + s = calloc(1, size); + while (pos == -1 || s[pos] != '\n') { + int c; + pos++; + if (pos == size) { + size *= 2; + s = realloc(s, size); + } + do { + c = getc(f); + if (c == EOF) { + if (pos == 0) { + free(s); + return NULL; + } + s[pos] = '\0'; + return s; + } + } while (c == '\r'); // proabably impossible anyway without binary mode + s[pos] = c; + } + s[pos] = '\0'; + return s; +} + // returns 1 on success; the callback returns the error message string, or NULL int ParseFile(char * filename_needscopy, char * (*callback)(int indent, char * name, char * value) ) { int linenr=0; - char line[250]; - char originalline[250]; + char * line; + char * originalline; char * filename; char * p; char * name; @@ -72,12 +103,10 @@ // necessary for useful error messages with 'include' filename = malloc_strcpy(filename_needscopy); - while (fgets(line, 250, f)) { + while ((line = malloc_freadline(f))) { linenr++; - // strip \n and windows newlines if fgets didn't already - if ((p = strchr(line, '\n'))) *p = '\0'; - if ((p = strchr(line, '\r'))) *p = '\0'; - strcpy(originalline, line); + // keep original for error messages + originalline = malloc_strcpy(line); // strip comments if ((p = strchr(line, '#'))) *p = '\0'; // change tabs (or whatever) to spaces @@ -102,13 +131,14 @@ exit(1); } } + free(line); + free(originalline); } fclose(f); // signal EOF to the callback errorstr = (*callback)(0, NULL, NULL); if (errorstr) { - DebugLevel(0, "%s\n", originalline); DebugLevel(0, "%s:%d %s\n", filename, linenr, errorstr); exit(1); } @@ -174,13 +204,13 @@ if (*c == '.') { int add = HEIGHT_NORM; c++; - while (*c && strchr("1234567890", *c)) { + while (*c && strchr("0123456789", *c)) { result += add * (*c - '0') / 10; add /= 10; c++; } } - if (*c) { + if (*c && !isspace(*c)) { *error = "invalid float number syntax"; return -1; } @@ -196,13 +226,25 @@ return atoi(value); } +int hexchr2int(char c) { + if (c >= '0' && c <= '9') { + return c - '0'; + } else if (c >= 'A' && c <= 'F') { + return c - 'A' + 10; + } else if (c >= 'a' && c <= 'f') { + return c - 'f' + 10; + } else { + return -1; + } +} + char * strvalueindex(char * value, int index) { char * c = value; int i; while (isspace((int)*c)) c++; for (i=0; i<index; i++) { - while (!isspace((int)*c)) c++; + while (!isspace((int)*c) && *c) c++; while (isspace((int)*c)) c++; } return c; Modified: trunk/mass/config.h =================================================================== --- trunk/mass/config.h 2004-05-08 15:26:45 UTC (rev 265) +++ trunk/mass/config.h 2004-05-08 19:48:24 UTC (rev 266) @@ -65,6 +65,8 @@ extern int str2h_int(char * value, char ** error); // returns the ..th value in string (seperated by whitespace) extern char * strvalueindex(char * value, int index); +// returns integer from hexadecimal character, or -1 +int hexchr2int(char c); // parse a single line of the config files extern char * ConfigLine(int indent, char * name_mixedcase, char * value); Modified: trunk/mass/debug.c =================================================================== --- trunk/mass/debug.c 2004-05-08 15:26:45 UTC (rev 265) +++ trunk/mass/debug.c 2004-05-08 19:48:24 UTC (rev 266) @@ -58,7 +58,7 @@ void PrintMassInformation(Mass * m) { printf("--- Mass %X ---\n", (int)m); - //DebugLevel(1, "m->class = %s\n", m->class); - DebugLevel(1, "m->maxRect = %s (m->massCell = %d)\n", RectString(m->maxRect), m->massCell); + printf("maxRect = %s, m->massCell = %d\n", RectString(m->maxRect), m->massCell); + printf(": %s\n", m->class ? m->class : ""); DumpMassProperties(stdout, m); } Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-08 15:26:45 UTC (rev 265) +++ trunk/mass/level.c 2004-05-08 19:48:24 UTC (rev 266) @@ -16,11 +16,9 @@ int numMassClasses; Mass ** massClasses; -// parser status +// globals used only while parsing Mass * currentMass; -struct { - int posx, posy; -} details; +int mustAddToField; char * LevelLine(int indent, char * name_mixedcase, char * value); void ResetMassClasses(); @@ -53,6 +51,7 @@ void LoadLevel(char * filename) { + currentMass = NULL; if (!ParseFile(FindData(filename), &LevelLine)) { if (level.name) { printf("(Previous levelfile was: %s)\n", filename); @@ -107,25 +106,13 @@ char * error = NULL; char name[200]; - //printf("LevelLine '%s' '%s'\n", name_mixedcase, value); - if (indent == 0) { - // finish current work - if (currentMass) { - if (MassClassByName(currentMass->class)) { - // it was a new physical mass, add it to the game - DebugLevel(3, "Created mass from class '%s'\n", currentMass->class); - PlaceMassNearby(currentMass, details.posx, details.posy, 2); - AddMassToField(currentMass); - } else { - // it was a new mass class, add it to the known classes - DebugLevel(3, "Added MassClass '%s'\n", currentMass->class); - numMassClasses++; - massClasses = realloc(massClasses, numMassClasses * sizeof(Mass*)); - massClasses[numMassClasses-1] = currentMass; - } + if (currentMass && mustAddToField) { + // NOT possible before all values are fixed + AddMassToField(currentMass); } currentMass = NULL; + mustAddToField = 0; } // ready for EOF now @@ -143,14 +130,56 @@ parent = MassClassByName(name + 1); if (!parent) return "cannot inherit, parent not found"; } + currentMass = CreateMass(parent); + currentMass->class = malloc(strlen(name+1)+1); + strcpy(currentMass->class, name+1); if (!strlen(value)) return "space seperated coordinates missing"; - details.posx = str2int(strvalueindex(value, 0), &error); + currentMass->maxRect.x = str2int(strvalueindex(value, 0), &error); if (error) return "bad space seperated coordinates"; - details.posy = str2int(strvalueindex(value, 1), &error); + currentMass->maxRect.y = str2int(strvalueindex(value, 1), &error); if (error) return "bad space seperated coordinates"; - currentMass = CreateMass(parent); - currentMass->class = malloc(strlen(name+1)+1); - strcpy(currentMass->class, name+1); + + currentMass->maxRect.w = str2int(strvalueindex(value, 2), &error); + if (error) { + // assume short format without pixeldata + error = NULL; + PlaceMassNearby(currentMass, currentMass->maxRect.x, currentMass->maxRect.y, 2); + } else { + // long format + int x, y, multiply; + char * data; + Mass * m = currentMass; + m->maxRect.h = str2int(strvalueindex(value, 3), &error); + if (error) return "bad maxrect height"; + multiply = str2h_int(strvalueindex(value, 4), &error) / 256; + if (error) return error; + if (m->maxRect.h <= 0 || m->maxRect.w <= 0) return "maxrect must not be empty"; + data = strvalueindex(value, 5); + if (strlen(data) != 2*m->maxRect.w*m->maxRect.h) return "wrong data length"; + // manually place the mass, as far as possible + assert(m->numPixels == 0); + for (y=m->maxRect.y; y<m->maxRect.y+m->maxRect.h; y++) { + for (x=m->maxRect.x; x<m->maxRect.x+m->maxRect.w; x++) { + // hex byte ==> mass height + int a, b; + FieldPoint * p; + p = FieldXY(x, y); + a = hexchr2int(*(data++)); + b = hexchr2int(*(data++)); + if (a == -1 || b == -1) return "invalid hex character in pixelstring"; + if (!p->owner && (a || b)) { + p->owner = m; + p->height = multiply * (a*16 + b); + m->numPixels++; + } + } + } + assert(*data == 0); + } + // add it to the game (properties are set later on while parsing) + DebugLevel(3, "Creating mass from class '%s'\n", currentMass->class); + // need to postpone AddMassToField() until currentMass->heading is stable + mustAddToField = 1; return NULL; } else if (name[strlen(name)-1] == ':') { // declaration of a mass class @@ -168,8 +197,16 @@ currentMass->isDead = 1; // keep FreeMass() happy currentMass->class = malloc(strlen(name)+1); strcpy(currentMass->class, name); + + // add it to the known classes (properties are set later on) + DebugLevel(3, "Adding MassClass '%s'\n", currentMass->class); + numMassClasses++; + massClasses = realloc(massClasses, numMassClasses * sizeof(Mass*)); + massClasses[numMassClasses-1] = currentMass; + return NULL; } else if (!strcmp(name, "include")) { + currentMass = NULL; if (!ParseFile(FindData(value), &LevelLine)) return "include error"; return NULL; } else { @@ -371,12 +408,6 @@ return error; } -void DumpMassBody(FILE * f, Mass * m) -{ - // TODO: clever Algorithm - fprintf(f, "TODO-mass-body-goes-here-TODO"); -} - void DumpMassProperties(FILE * f, Mass * m) { Mass * parent; @@ -385,11 +416,15 @@ parent = MassClassByName(m->class); if (!parent) { tmp = parent = CreateMass(NULL); - fprintf(f, ":\n"); - } else { - fprintf(f, ":%s\n", m->class); } - /* SCRIPT_DUMP_MASS */ + + // because -1 has special meaning and >255 is an error + m->heading &= 255; + // FIXME m->heading % 256 machine dependant if m->heading < 0 !!! + // there must be several other places relaying on it becoming >= 0 + assert(m->heading >= 0 && m->heading <= 255); + + /* start SCRIPT_DUMP_MASS */ if (m->bufferMass != parent->bufferMass) { fprintf(f, " bufferMass %.6f\n", ((float)m->bufferMass)/HEIGHT_NORM); } @@ -415,13 +450,13 @@ fprintf(f, " lookDistance %d\n", m->lookDistance); } if (m->baseColor[0] != parent->baseColor[0] || m->baseColor[1] != parent->baseColor[1] || m->baseColor[2] != parent->baseColor[2]) { - fprintf(f, " baseColor %d\n", m->baseColor[3]); + fprintf(f, " baseColor %d %d %d\n", m->baseColor[0], m->baseColor[1], m->baseColor[2]); } if (m->secondColor[0] != parent->secondColor[0] || m->secondColor[1] != parent->secondColor[1] || m->secondColor[2] != parent->secondColor[2]) { - fprintf(f, " secondColor %d\n", m->secondColor[3]); + fprintf(f, " secondColor %d %d %d\n", m->secondColor[0], m->secondColor[1], m->secondColor[2]); } if (m->debugColor[0] != parent->debugColor[0] || m->debugColor[1] != parent->debugColor[1] || m->debugColor[2] != parent->debugColor[2]) { - fprintf(f, " debugColor %d\n", m->debugColor[3]); + fprintf(f, " debugColor %d %d %d\n", m->debugColor[0], m->debugColor[1], m->debugColor[2]); } if (m->displayType != parent->displayType) { if (m->displayType == DT_NORMAL) { @@ -590,7 +625,7 @@ if (m->debugTest != parent->debugTest) { fprintf(f, " debugTest %d\n", m->debugTest); } - /* SCRIPT_DUMP_MASS */ + /* end SCRIPT_DUMP_MASS */ if (tmp) FreeMass(tmp); } @@ -606,7 +641,31 @@ massList = malloc_GetAllMasses(); for (i=0; (m=massList[i]); i++) { - DumpMassBody(f, m); + int x, y, max; + FieldPoint * p; + max = 1; + for (y=m->maxRect.y; y<m->maxRect.y+m->maxRect.h; y++) { + for (x=m->maxRect.x; x<m->maxRect.x+m->maxRect.w; x++) { + p = FieldXY(x, y); + if (p->owner == m && p->height > max) max = p->height; + } + } + fprintf(f, ":%s %d %d %d %d %.6f ", m->class ? m->class : "", m->maxRect.x, m->maxRect.y, m->maxRect.w, m->maxRect.h, (float)max/HEIGHT_NORM); + // dump mass body + for (y=m->maxRect.y; y<m->maxRect.y+m->maxRect.h; y++) { + for (x=m->maxRect.x; x<m->maxRect.x+m->maxRect.w; x++) { + int h = 0; + p = FieldXY(x, y); + if (p->owner == m) { + h = p->height * 256 / max; + if (h == 0 && p->height != 0) h = 1; + if (h > 255) h = 255; + if (h < 0) h = 0; + } + fprintf(f, "%02X", h); + } + } + fprintf(f, "\n"); DumpMassProperties(f, m); } free(massList); Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-08 15:26:45 UTC (rev 265) +++ trunk/mass/mass.c 2004-05-08 19:48:24 UTC (rev 266) @@ -817,6 +817,7 @@ } } } + assert(sum > 0); // overflow return sum; } Modified: trunk/mass/mass.h =================================================================== --- trunk/mass/mass.h 2004-05-08 15:26:45 UTC (rev 265) +++ trunk/mass/mass.h 2004-05-08 19:48:24 UTC (rev 266) @@ -274,6 +274,8 @@ /* looks for a (p->owner == NULL) pixel at the border of the mass and adds it */ extern Point AddBorderPixel(Mass * m); +/* sum up the height of all owned pixels */ +extern int CountMassVolume(Mass * m); extern void DebugCheckMass(Mass * m); extern void DebugPrintMass(Mass * m); Modified: trunk/mass/update-code.py =================================================================== --- trunk/mass/update-code.py 2004-05-08 15:26:45 UTC (rev 265) +++ trunk/mass/update-code.py 2004-05-08 19:48:24 UTC (rev 266) @@ -115,14 +115,14 @@ i += 1 return '(' + ' || '.join(l) + ')' def make_print(self, indent, prefix): - l1 = [] - l2 = [] + format = '' + args = '' i = 0 for value in self.default.split(): - l1.append('%d') - l2.append('%s%s[%d]' % (prefix, self.name, i)) + format += ' %d' + args += ', %s%s[%d]' % (prefix, self.name, i) i += 1 - return indent + 'fprintf(f, " ' + self.name + ' %d\\n", ' + prefix + self.name + '[%d]);\n' % i + return indent + 'fprintf(f, " ' + self.name + format + '\\n"' + args + ');\n' class T_enum(T): def __init__(self, name, args, desc): |
From: <sv...@ol...> - 2004-05-08 15:26:50
|
Author: martin Date: 2004-05-08 17:26:45 +0200 (Sat, 08 May 2004) New Revision: 265 Modified: trunk/htdocs/generate.py trunk/htdocs/update.sh Log: gathering sourcecode comments from sourcecode files Modified: trunk/htdocs/generate.py =================================================================== --- trunk/htdocs/generate.py 2004-05-08 15:24:26 UTC (rev 264) +++ trunk/htdocs/generate.py 2004-05-08 15:26:45 UTC (rev 265) @@ -63,7 +63,7 @@ <p> Please subscribe to the <a href="http://sourceforge.net/mail/?group_id=5325">mailing list</a>. Use the <a href="download.html">latest svn version</a> if possible. - IRC: I'm sometimes on irc.freenode.net and autojoin the #mass channel there. + IRC: I am sometimes on irc.freenode.net and autojoin the #mass channel there. ''' text['download.html'] = ''' @@ -145,21 +145,20 @@ <table border> <tr><td><b>file</b><td><b>comment</b></tr> ''' -comments = [ - ('main.c', 'main loop and framerate control'), - ('mass.h', 'the central, big mass struct (struct _Mass_)'), - ('mass.c', 'most of the mass engine; quite a mess, everything is experimental'), - ('field.h', 'struct _FieldPoint_, wrapping helpers'), - ('config.h', 'config file and command line parsing'), - ('input.h', 'keyboard handling'), - ('video2d.c', 'SDL 2D stuff, drawing the masses and the debug HUD'), - ('video3d.c', 'the same thing for OpenGL'), - ('networkplayer.c', 'gathering/sending player inputs, reply playback'), - ('mass-server.py', 'game server written in python'), - ('tests.c', '"make check", especially tests for the wrapping helpers'), - ] -for comment in comments: - text['code-overview.html'] += '<tr><td><a href="mass/' + comment[0] + '.txt">' + comment[0] + '</a><td>' + comment[1] + '</tr>\n'; + +sourcefiles = ['main.c', 'mass.h', 'mass.c', 'field.h', 'config.h', + 'input.h', 'video2d.c', 'video3d.c', 'networkplayer.c', + 'mass-server.py', 'tests.c'] +for sourcefile in sourcefiles: + print 'scanning', sourcefile + if sourcefile.endswith('.py'): + comment = open('mass/' + sourcefile).read().split('"')[1].strip() + assert comment + else: + line = open('mass/' + sourcefile).readline() + assert line.startswith('///') + comment = line[3:].strip() + text['code-overview.html'] += '<tr><td><a href="mass/' + sourcefile + '.txt">' + sourcefile + '</a><td>' + comment + '</tr>\n'; text['code-overview.html'] += ''' </table> <p> Modified: trunk/htdocs/update.sh =================================================================== --- trunk/htdocs/update.sh 2004-05-08 15:24:26 UTC (rev 264) +++ trunk/htdocs/update.sh 2004-05-08 15:26:45 UTC (rev 265) @@ -1,7 +1,6 @@ #!/bin/bash set -e svn up -./generate.py || python generate.py [ -d mass ] || svn co svn://old.homeip.net/mass/trunk/mass cd mass && svn up for i in *.h *.c *.py ; do @@ -10,6 +9,7 @@ newer $i $i.txt && cp $i $i.txt done cd .. +./generate.py || python generate.py svn st echo 'Update mirrors via rsync? (RETURN or Ctrl-C)' read |
From: <sv...@ol...> - 2004-05-08 15:24:39
|
Author: martin Date: 2004-05-08 17:24:26 +0200 (Sat, 08 May 2004) New Revision: 264 Modified: trunk/mass/README trunk/mass/config.h trunk/mass/debug.c trunk/mass/field.h trunk/mass/input.c trunk/mass/input.h trunk/mass/level.c trunk/mass/level.h trunk/mass/main.c trunk/mass/mass.c trunk/mass/mass.h trunk/mass/networkplayer.c trunk/mass/tests.c trunk/mass/update-code.py trunk/mass/video2d.c trunk/mass/video3d.c Log: next step towards saving; oneline-comment for most files Modified: trunk/mass/README =================================================================== --- trunk/mass/README 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/README 2004-05-08 15:24:26 UTC (rev 264) @@ -41,6 +41,7 @@ d DEBUG scroll visible area right s DEBUG scroll visible area down m DEBUG press to draw new mass with mouse +f11 DEBUG save game now f12 DEBUG does something, don't hit in network game SCRIPT_DEFAULT_KEYS Modified: trunk/mass/config.h =================================================================== --- trunk/mass/config.h 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/config.h 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// config file and command line parsing #ifndef __CONFIG_H__ #define __CONFIG_H__ Modified: trunk/mass/debug.c =================================================================== --- trunk/mass/debug.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/debug.c 2004-05-08 15:24:26 UTC (rev 264) @@ -58,11 +58,7 @@ void PrintMassInformation(Mass * m) { printf("--- Mass %X ---\n", (int)m); - /* - DebugLevel(1, "m->class = %s\n", m->class); + //DebugLevel(1, "m->class = %s\n", m->class); DebugLevel(1, "m->maxRect = %s (m->massCell = %d)\n", RectString(m->maxRect), m->massCell); - DebugLevel(1, "m->age = %d\n", m->age); - DebugLevel(1, "m->speed = %d\n", m->speed); - */ - DumpMass(m); + DumpMassProperties(stdout, m); } Modified: trunk/mass/field.h =================================================================== --- trunk/mass/field.h 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/field.h 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// struct _FieldPoint_ and wrapping helpers /* Everything to maintain the field, which is a wrapping matrix containing all mass pixels. It's a kind of map, and usually much bigger than the visible part of the screen. */ Modified: trunk/mass/input.c =================================================================== --- trunk/mass/input.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/input.c 2004-05-08 15:24:26 UTC (rev 264) @@ -16,7 +16,7 @@ ConfigData config; /* SCRIPT_NUM_KEYS */ -#define NUM_KEYS 29 +#define NUM_KEYS 30 /* SCRIPT_NUM_KEYS */ /* implementation */ @@ -55,6 +55,7 @@ {"debugScrollRight", "d", "DEBUG scroll visible area right"}, {"debugScrollDown", "s", "DEBUG scroll visible area down"}, {"debugCreateMass", "m", "DEBUG press to draw new mass with mouse"}, + {"debugSave", "f11", "DEBUG save game now"}, {"debugTest", "f12", "DEBUG does something, don't hit in network game"}, /* SCRIPT_KEYINFO_ARRAY */ }; Modified: trunk/mass/input.h =================================================================== --- trunk/mass/input.h 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/input.h 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// keyboard handling #ifndef __INPUT_H__ #define __INPUT_H__ #include "math2d.h" @@ -33,6 +34,7 @@ debugScrollRight "d" "DEBUG scroll visible area right" debugScrollDown "s" "DEBUG scroll visible area down" debugCreateMass "m" "DEBUG press to draw new mass with mouse" +debugSave "f11" "DEBUG save game now" debugTest "f12" "DEBUG does something, don't hit in network game" INPUT_CONFIGKEYS */ @@ -50,7 +52,7 @@ typedef struct { // SCRIPT_KEYSTATES (do not edit, see above) - KeyState *left, *up, *right, *down, *button1, *button2, *fullscreen, *quit, *pause, *nextFrame, *switchInterface, *lookUp, *lookDown, *zoomIn, *zoomOut, *lessDetails, *moreDetails, *toggleGrid, *debugMode, *debugZin, *debugZout, *debugCycle, *debugRect, *debugScrollLeft, *debugScrollUp, *debugScrollRight, *debugScrollDown, *debugCreateMass, *debugTest; + KeyState *left, *up, *right, *down, *button1, *button2, *fullscreen, *quit, *pause, *nextFrame, *switchInterface, *lookUp, *lookDown, *zoomIn, *zoomOut, *lessDetails, *moreDetails, *toggleGrid, *debugMode, *debugZin, *debugZout, *debugCycle, *debugRect, *debugScrollLeft, *debugScrollUp, *debugScrollRight, *debugScrollDown, *debugCreateMass, *debugSave, *debugTest; // SCRIPT_KEYSTATES } KeyStates; extern KeyStates key; Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/level.c 2004-05-08 15:24:26 UTC (rev 264) @@ -371,219 +371,246 @@ return error; } -void DumpMass(Mass * m) +void DumpMassBody(FILE * f, Mass * m) { + // TODO: clever Algorithm + fprintf(f, "TODO-mass-body-goes-here-TODO"); +} + +void DumpMassProperties(FILE * f, Mass * m) +{ Mass * parent; Mass * tmp; tmp = NULL; parent = MassClassByName(m->class); if (!parent) { tmp = parent = CreateMass(NULL); - printf(":\n"); + fprintf(f, ":\n"); } else { - printf(":%s\n", m->class); + fprintf(f, ":%s\n", m->class); } /* SCRIPT_DUMP_MASS */ if (m->bufferMass != parent->bufferMass) { - printf(" bufferMass %.6f\n", ((float)m->bufferMass)/HEIGHT_NORM); + fprintf(f, " bufferMass %.6f\n", ((float)m->bufferMass)/HEIGHT_NORM); } if (m->weakSHR != parent->weakSHR) { - printf(" weakSHR %d\n", m->weakSHR); + fprintf(f, " weakSHR %d\n", m->weakSHR); } if (m->normalSHR != parent->normalSHR) { - printf(" normalSHR %d\n", m->normalSHR); + fprintf(f, " normalSHR %d\n", m->normalSHR); } if (m->strongSHR != parent->strongSHR) { - printf(" strongSHR %d\n", m->strongSHR); + fprintf(f, " strongSHR %d\n", m->strongSHR); } if (m->minBorderHeight != parent->minBorderHeight) { - printf(" minBorderHeight %.6f\n", ((float)m->minBorderHeight)/HEIGHT_NORM); + fprintf(f, " minBorderHeight %.6f\n", ((float)m->minBorderHeight)/HEIGHT_NORM); } if (m->maxBorderHeight != parent->maxBorderHeight) { - printf(" maxBorderHeight %.6f\n", ((float)m->maxBorderHeight)/HEIGHT_NORM); + fprintf(f, " maxBorderHeight %.6f\n", ((float)m->maxBorderHeight)/HEIGHT_NORM); } if (m->speed != parent->speed) { - printf(" speed %d\n", m->speed); + fprintf(f, " speed %d\n", m->speed); } if (m->lookDistance != parent->lookDistance) { - printf(" lookDistance %d\n", m->lookDistance); + fprintf(f, " lookDistance %d\n", m->lookDistance); } if (m->baseColor[0] != parent->baseColor[0] || m->baseColor[1] != parent->baseColor[1] || m->baseColor[2] != parent->baseColor[2]) { - printf(" baseColor %d\n", m->baseColor[3]); + fprintf(f, " baseColor %d\n", m->baseColor[3]); } if (m->secondColor[0] != parent->secondColor[0] || m->secondColor[1] != parent->secondColor[1] || m->secondColor[2] != parent->secondColor[2]) { - printf(" secondColor %d\n", m->secondColor[3]); + fprintf(f, " secondColor %d\n", m->secondColor[3]); } if (m->debugColor[0] != parent->debugColor[0] || m->debugColor[1] != parent->debugColor[1] || m->debugColor[2] != parent->debugColor[2]) { - printf(" debugColor %d\n", m->debugColor[3]); + fprintf(f, " debugColor %d\n", m->debugColor[3]); } if (m->displayType != parent->displayType) { if (m->displayType == DT_NORMAL) { - printf("displayType shadow\n"); + fprintf(f, "displayType shadow\n"); } else if (m->displayType == DT_FLAT) { - printf("displayType flat\n"); + fprintf(f, "displayType flat\n"); } else { assert(0); } } if (m->growRounds != parent->growRounds) { - printf(" growRounds %d\n", m->growRounds); + fprintf(f, " growRounds %d\n", m->growRounds); } if (m->growIfSmallerThan != parent->growIfSmallerThan) { - printf(" growIfSmallerThan %d\n", m->growIfSmallerThan); + fprintf(f, " growIfSmallerThan %d\n", m->growIfSmallerThan); } if (m->shrink != parent->shrink) { - printf(" shrink %.6f\n", ((float)m->shrink)/HEIGHT_NORM); + fprintf(f, " shrink %.6f\n", ((float)m->shrink)/HEIGHT_NORM); } if (m->heading != parent->heading) { - printf(" heading %d\n", m->heading); + fprintf(f, " heading %d\n", m->heading); } if (m->velocity != parent->velocity) { - printf(" velocity %d\n", m->velocity); + fprintf(f, " velocity %d\n", m->velocity); } if (m->player != parent->player) { - printf(" player %d\n", m->player); + fprintf(f, " player %d\n", m->player); } if (m->attractPlayer != parent->attractPlayer) { - printf(" attractPlayer %d\n", m->attractPlayer); + fprintf(f, " attractPlayer %d\n", m->attractPlayer); } if (m->age != parent->age) { - printf(" age %d\n", m->age); + fprintf(f, " age %d\n", m->age); } if (m->energy != parent->energy) { - printf(" energy %d\n", m->energy); + fprintf(f, " energy %d\n", m->energy); } if (m->pulse != parent->pulse) { - printf(" pulse %d\n", m->pulse); + fprintf(f, " pulse %d\n", m->pulse); } if (m->vivid != parent->vivid) { - printf(" vivid %d\n", m->vivid); + fprintf(f, " vivid %d\n", m->vivid); } if (m->vivid2 != parent->vivid2) { - printf(" vivid2 %d\n", m->vivid2); + fprintf(f, " vivid2 %d\n", m->vivid2); } if (m->sickness != parent->sickness) { - printf(" sickness %d\n", m->sickness); + fprintf(f, " sickness %d\n", m->sickness); } if (m->destructive != parent->destructive) { - printf(" destructive %d\n", m->destructive); + fprintf(f, " destructive %d\n", m->destructive); } if (m->plantGrowFruit != parent->plantGrowFruit) { - printf(" plantGrowFruit %d\n", m->plantGrowFruit); + fprintf(f, " plantGrowFruit %d\n", m->plantGrowFruit); } if (m->borderColorHeight != parent->borderColorHeight) { - printf(" borderColorHeight %.6f\n", ((float)m->borderColorHeight)/HEIGHT_NORM); + fprintf(f, " borderColorHeight %.6f\n", ((float)m->borderColorHeight)/HEIGHT_NORM); } if (m->headingAdd != parent->headingAdd) { - printf(" headingAdd %d\n", m->headingAdd); + fprintf(f, " headingAdd %d\n", m->headingAdd); } if (m->slowHeadingAdd != parent->slowHeadingAdd) { - printf(" slowHeadingAdd %d\n", m->slowHeadingAdd); + fprintf(f, " slowHeadingAdd %d\n", m->slowHeadingAdd); } if (strcmp(m->childClass, parent->childClass)) { - printf(" childClass %s\n", m->childClass); + fprintf(f, " childClass %s\n", m->childClass); } if (m->childTime != parent->childTime) { - printf(" childTime %d\n", m->childTime); + fprintf(f, " childTime %d\n", m->childTime); } if (m->childCount != parent->childCount) { - printf(" childCount %d\n", m->childCount); + fprintf(f, " childCount %d\n", m->childCount); } if (m->childDistance != parent->childDistance) { - printf(" childDistance %d\n", m->childDistance); + fprintf(f, " childDistance %d\n", m->childDistance); } if (m->childInside != parent->childInside) { - printf(" childInside %d\n", m->childInside); + fprintf(f, " childInside %d\n", m->childInside); } if (m->childRandomDistance != parent->childRandomDistance) { - printf(" childRandomDistance %d\n", m->childRandomDistance); + fprintf(f, " childRandomDistance %d\n", m->childRandomDistance); } if (m->childRandomDirection != parent->childRandomDirection) { - printf(" childRandomDirection %d\n", m->childRandomDirection); + fprintf(f, " childRandomDirection %d\n", m->childRandomDirection); } if (m->childSetHeading != parent->childSetHeading) { - printf(" childSetHeading %d\n", m->childSetHeading); + fprintf(f, " childSetHeading %d\n", m->childSetHeading); } if (m->childTakesMassFromParent != parent->childTakesMassFromParent) { - printf(" childTakesMassFromParent %d\n", m->childTakesMassFromParent); + fprintf(f, " childTakesMassFromParent %d\n", m->childTakesMassFromParent); } if (m->childAndParentSwapped != parent->childAndParentSwapped) { - printf(" childAndParentSwapped %d\n", m->childAndParentSwapped); + fprintf(f, " childAndParentSwapped %d\n", m->childAndParentSwapped); } if (strcmp(m->transformClass, parent->transformClass)) { - printf(" transformClass %s\n", m->transformClass); + fprintf(f, " transformClass %s\n", m->transformClass); } if (m->transformAt != parent->transformAt) { if (m->transformAt == TR_NEVER) { - printf("transformAt never\n"); + fprintf(f, "transformAt never\n"); } else if (m->transformAt == TR_AGE) { - printf("transformAt age\n"); + fprintf(f, "transformAt age\n"); } else if (m->transformAt == TR_RANDOM) { - printf("transformAt random\n"); + fprintf(f, "transformAt random\n"); } else if (m->transformAt == TR_ENERGY) { - printf("transformAt energy\n"); + fprintf(f, "transformAt energy\n"); } else if (m->transformAt == TR_SIZE) { - printf("transformAt size\n"); + fprintf(f, "transformAt size\n"); } else if (m->transformAt == TR_TOUCH) { - printf("transformAt touch\n"); + fprintf(f, "transformAt touch\n"); } else { assert(0); } } if (m->transformArgument != parent->transformArgument) { - printf(" transformArgument %d\n", m->transformArgument); + fprintf(f, " transformArgument %d\n", m->transformArgument); } if (m->flatteningMovement != parent->flatteningMovement) { - printf(" flatteningMovement %d\n", m->flatteningMovement); + fprintf(f, " flatteningMovement %d\n", m->flatteningMovement); } if (m->expFlattening != parent->expFlattening) { - printf(" expFlattening %d\n", m->expFlattening); + fprintf(f, " expFlattening %d\n", m->expFlattening); } if (m->convolveFlattening != parent->convolveFlattening) { - printf(" convolveFlattening %d\n", m->convolveFlattening); + fprintf(f, " convolveFlattening %d\n", m->convolveFlattening); } if (m->oldFlattening != parent->oldFlattening) { - printf(" oldFlattening %d\n", m->oldFlattening); + fprintf(f, " oldFlattening %d\n", m->oldFlattening); } if (m->playerFood != parent->playerFood) { - printf(" playerFood %d\n", m->playerFood); + fprintf(f, " playerFood %d\n", m->playerFood); } if (m->playerSwarm != parent->playerSwarm) { - printf(" playerSwarm %d\n", m->playerSwarm); + fprintf(f, " playerSwarm %d\n", m->playerSwarm); } if (m->isWall != parent->isWall) { - printf(" isWall %d\n", m->isWall); + fprintf(f, " isWall %d\n", m->isWall); } if (m->isProjectil != parent->isProjectil) { - printf(" isProjectil %d\n", m->isProjectil); + fprintf(f, " isProjectil %d\n", m->isProjectil); } if (m->isMazeWall != parent->isMazeWall) { - printf(" isMazeWall %d\n", m->isMazeWall); + fprintf(f, " isMazeWall %d\n", m->isMazeWall); } if (m->isCoinMass != parent->isCoinMass) { - printf(" isCoinMass %d\n", m->isCoinMass); + fprintf(f, " isCoinMass %d\n", m->isCoinMass); } if (m->isLightningMass != parent->isLightningMass) { - printf(" isLightningMass %d\n", m->isLightningMass); + fprintf(f, " isLightningMass %d\n", m->isLightningMass); } if (m->isNetworkMass != parent->isNetworkMass) { - printf(" isNetworkMass %d\n", m->isNetworkMass); + fprintf(f, " isNetworkMass %d\n", m->isNetworkMass); } if (m->superGrow != parent->superGrow) { - printf(" superGrow %d\n", m->superGrow); + fprintf(f, " superGrow %d\n", m->superGrow); } if (m->wakeOnPlayer != parent->wakeOnPlayer) { - printf(" wakeOnPlayer %d\n", m->wakeOnPlayer); + fprintf(f, " wakeOnPlayer %d\n", m->wakeOnPlayer); } if (m->drawElipsoid != parent->drawElipsoid) { - printf(" drawElipsoid %d\n", m->drawElipsoid); + fprintf(f, " drawElipsoid %d\n", m->drawElipsoid); } if (m->experimentalBorderPoints != parent->experimentalBorderPoints) { - printf(" experimentalBorderPoints %d\n", m->experimentalBorderPoints); + fprintf(f, " experimentalBorderPoints %d\n", m->experimentalBorderPoints); } if (m->debugTest != parent->debugTest) { - printf(" debugTest %d\n", m->debugTest); + fprintf(f, " debugTest %d\n", m->debugTest); } /* SCRIPT_DUMP_MASS */ if (tmp) FreeMass(tmp); } + +void SaveGame(char * filename) +{ + Mass ** massList; + int i; + Mass * m; + FILE * f; + f = fopen(filename, "w"); + if (!f) DebugLevel(0, "Could not write savegame to file '%s'.\n", filename); + // TODO: write files that have to be included so the massclasses are there + + massList = malloc_GetAllMasses(); + for (i=0; (m=massList[i]); i++) { + DumpMassBody(f, m); + DumpMassProperties(f, m); + } + free(massList); + fclose(f); + DebugLevel(1, "Game saved to '%s'.\n", filename); +} + Modified: trunk/mass/level.h =================================================================== --- trunk/mass/level.h 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/level.h 2004-05-08 15:24:26 UTC (rev 264) @@ -1,8 +1,9 @@ -// handle level files and mass classes +/// level files, mass classes and savegames #ifndef __LEVEL_H__ #define __LEVEL_H__ #include "mass.h" #include "config.h" +#include <stdio.h> // Script input, some parts of level.c are autogenerated from this file. // If you change anything, run ./update-code.py @@ -31,6 +32,7 @@ extern void FreeLevel(); // dump a mass as difference to its base class -extern void DumpMass(Mass * m); +extern void DumpMassProperties(FILE * f, Mass * m); +extern void SaveGame(char * filename); #endif Modified: trunk/mass/main.c =================================================================== --- trunk/mass/main.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/main.c 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// main loop and framerate control /* mass - a game without bitmaps @@ -262,6 +263,7 @@ // needed because some keys might have another function in debug mode ResetKeys(); } + if (key.debugSave->hit) SaveGame("debugsave.mss"); } } Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/mass.c 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// most of the engine, always experimental /* * This is the "core" file - which means it's my main playground, * messy, and does much too much. Modified: trunk/mass/mass.h =================================================================== --- trunk/mass/mass.h 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/mass.h 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// the central, big mass struct (struct _Mass_) #ifndef __MASS__ #define __MASS__ Modified: trunk/mass/networkplayer.c =================================================================== --- trunk/mass/networkplayer.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/networkplayer.c 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// gathering/sending player inputs, reply playback /* Network and logging/playback support * * * client/server vs peer to peer Modified: trunk/mass/tests.c =================================================================== --- trunk/mass/tests.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/tests.c 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// make check, mostly tests for the wrapping helpers #include <stdio.h> #include <string.h> #include <stdlib.h> Modified: trunk/mass/update-code.py =================================================================== --- trunk/mass/update-code.py 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/update-code.py 2004-05-08 15:24:26 UTC (rev 264) @@ -46,7 +46,7 @@ def make_notequal(self, prefix, prefix_other): return '(strcmp(%s%s, %s%s))' % (prefix, self.name, prefix_other, self.name) def make_print(self, indent, prefix): - return indent + 'printf(" ' + self.name + ' %s\\n", ' + prefix + self.name + ');\n' + return indent + 'fprintf(f, " ' + self.name + ' %s\\n", ' + prefix + self.name + ');\n' class T_int(T): def make_stringparser(self, indent, prefix, string): @@ -57,7 +57,7 @@ if max: s += indent + 'if (!error && %s%s > %s) error = "out of range, maximum is %s";\n' % (prefix, self.name, max, max) return s def make_print(self, indent, prefix): - return indent + 'printf(" ' + self.name + ' %d\\n", ' + prefix + self.name + ');\n' + return indent + 'fprintf(f, " ' + self.name + ' %d\\n", ' + prefix + self.name + ');\n' class T_h_int(T): def __init__(self, name, args, desc): @@ -66,7 +66,7 @@ def make_stringparser(self, indent, prefix, string): return indent + prefix + self.name + ' = str2h_int(' + string + ', &error);\n' def make_print(self, indent, prefix): - return indent + 'printf(" ' + self.name + ' %.6f\\n", ((float)' + prefix + self.name + ')/HEIGHT_NORM);\n' + return indent + 'fprintf(f, " ' + self.name + ' %.6f\\n", ((float)' + prefix + self.name + ')/HEIGHT_NORM);\n' class T_boolean(T_int): def __init__(self, name, args, desc): @@ -122,7 +122,7 @@ l1.append('%d') l2.append('%s%s[%d]' % (prefix, self.name, i)) i += 1 - return indent + 'printf(" ' + self.name + ' %d\\n", ' + prefix + self.name + '[%d]);\n' % i + return indent + 'fprintf(f, " ' + self.name + ' %d\\n", ' + prefix + self.name + '[%d]);\n' % i class T_enum(T): def __init__(self, name, args, desc): @@ -150,7 +150,7 @@ s = indent for name, cname in self.options: s += 'if (%s%s == %s) {\n' % (prefix, self.name, cname) - s += indent + ' printf("%s %s\\n");\n' % (self.name, name) + s += indent + ' fprintf(f, "%s %s\\n");\n' % (self.name, name) s += indent + '} else ' s += '{\n' + indent + ' assert(0);\n' + indent + '}\n' return s Modified: trunk/mass/video2d.c =================================================================== --- trunk/mass/video2d.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/video2d.c 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// SDL 2D stuff, drawing the masses and the debug HUD #include "video2d.h" #include "field.h" #include "debug.h" Modified: trunk/mass/video3d.c =================================================================== --- trunk/mass/video3d.c 2004-05-07 18:49:52 UTC (rev 263) +++ trunk/mass/video3d.c 2004-05-08 15:24:26 UTC (rev 264) @@ -1,3 +1,4 @@ +/// same as video2d.c but for OpenGL #include "video3d.h" #include <string.h> #include <stdio.h> |
From: <sv...@ol...> - 2004-05-07 18:49:59
|
Author: martin Date: 2004-05-07 20:49:52 +0200 (Fri, 07 May 2004) New Revision: 263 Modified: trunk/mass/debug.c trunk/mass/level.c trunk/mass/mass.c Log: fixed mass leak in child creation code; misc Modified: trunk/mass/debug.c =================================================================== --- trunk/mass/debug.c 2004-05-07 17:00:32 UTC (rev 262) +++ trunk/mass/debug.c 2004-05-07 18:49:52 UTC (rev 263) @@ -57,7 +57,7 @@ void PrintMassInformation(Mass * m) { - DebugLevel(1, "--- Mass %X ---\n", m); + printf("--- Mass %X ---\n", (int)m); /* DebugLevel(1, "m->class = %s\n", m->class); DebugLevel(1, "m->maxRect = %s (m->massCell = %d)\n", RectString(m->maxRect), m->massCell); Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-07 17:00:32 UTC (rev 262) +++ trunk/mass/level.c 2004-05-07 18:49:52 UTC (rev 263) @@ -379,6 +379,9 @@ parent = MassClassByName(m->class); if (!parent) { tmp = parent = CreateMass(NULL); + printf(":\n"); + } else { + printf(":%s\n", m->class); } /* SCRIPT_DUMP_MASS */ if (m->bufferMass != parent->bufferMass) { Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-07 17:00:32 UTC (rev 262) +++ trunk/mass/mass.c 2004-05-07 18:49:52 UTC (rev 263) @@ -897,7 +897,7 @@ if (m->childSetHeading) m2->heading = birthHeading; if (m2->numPixels > 0) { if (m->childCount != -1) m->childCount--; - if (!m->childTakesMassFromParent) { + if (!m->childTakesMassFromParent && m->childInside) { m->bufferMass += CountMassVolume(m2); } if (m->childAndParentSwapped) { @@ -2095,12 +2095,14 @@ /* FIXME: the m->maxRect changes during this algo. Would it be a good idea to do the for loop with those values directly? */ + /* // Experiment if (m->numPixels && m->volume) { m->maxBorderHeight = 10*HEIGHT_NORM - 10*m->volume/sqr(m->numPixels); //m->maxBorderHeight = (float)HEIGHT_NORM*(float)HEIGHT_NORM*(float)m->numPixels/(float)m->volume; //printf("maxBorderHeight = %d, HEIGHT_NORM = %d\n", m->maxBorderHeight, HEIGHT_NORM); } + */ r = m->maxRect; for (y=r.y; y<r.y+r.h; y++) { |
From: <sv...@ol...> - 2004-05-07 17:00:42
|
Author: martin Date: 2004-05-07 19:00:32 +0200 (Fri, 07 May 2004) New Revision: 262 Modified: trunk/mass/compile.sh trunk/mass/mass.c Log: enable mass pixel count check only on HEAVY_DEBUG (speeds up normal game by 7 percent in trapper level) Modified: trunk/mass/compile.sh =================================================================== --- trunk/mass/compile.sh 2004-05-01 16:34:43 UTC (rev 261) +++ trunk/mass/compile.sh 2004-05-07 17:00:32 UTC (rev 262) @@ -24,7 +24,8 @@ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage -DNDEBUG -O0" #LIBS= elif [ $1 == "profile" ] ; then - CFLAGS="$CFLAGS -ggdb -pg -O3 -DNDEBUG" + #CFLAGS="$CFLAGS -ggdb -pg -O3 -DNDEBUG" + CFLAGS="$CFLAGS -ggdb -pg -O3 -DDEBUG" LIBS= elif [ $1 == "fast" ] ; then CFLAGS="$CFLAGS -O3 -DNDEBUG" Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-05-01 16:34:43 UTC (rev 261) +++ trunk/mass/mass.c 2004-05-07 17:00:32 UTC (rev 262) @@ -330,9 +330,7 @@ void DebugCheckMass(Mass * m) { #ifdef DEBUG - int x, y; int empty; - int n; assert(m); empty = 0; if (m->numPixels == 0) empty++; @@ -354,17 +352,20 @@ return; } assert(m->numPixels >= 0); - n = 0; - for (y=m->maxRect.y; y<m->maxRect.y+m->maxRect.h; y++) { - for (x=m->maxRect.x; x<m->maxRect.x+m->maxRect.w; x++) { - FieldPoint * p = FieldXY(x, y); - if (p->owner == m) { - assert(p->height >= 0); - n++; + if (HEAVY_DEBUG_ENABLED) { + int x, y, n; + n = 0; + for (y=m->maxRect.y; y<m->maxRect.y+m->maxRect.h; y++) { + for (x=m->maxRect.x; x<m->maxRect.x+m->maxRect.w; x++) { + FieldPoint * p = FieldXY(x, y); + if (p->owner == m) { + assert(p->height >= 0); + n++; + } } } + assert(m->numPixels == n); } - assert(m->numPixels == n); #endif } |
From: <sv...@ol...> - 2004-05-01 16:34:54
|
Author: martin Date: 2004-05-01 18:34:43 +0200 (Sat, 01 May 2004) New Revision: 261 Modified: trunk/mass/config.c trunk/mass/config.h trunk/mass/level.c trunk/mass/mass.h trunk/mass/networkplayer.c trunk/mass/update-code.py Log: strings changed NULL ==> "" first step towards saving (printf() difference to parent) Modified: trunk/mass/config.c =================================================================== --- trunk/mass/config.c 2004-05-01 10:02:18 UTC (rev 260) +++ trunk/mass/config.c 2004-05-01 16:34:43 UTC (rev 261) @@ -18,10 +18,10 @@ config.fullscreen = FULLSCREEN_DEFAULT; config.display = F_2D; config.grid = 0; - config.server = malloc_strcpy(NULL); + config.server = malloc_strcpy(""); config.serverPort = 3223; config.players = 2; - config.replay = malloc_strcpy(NULL); + config.replay = malloc_strcpy(""); config.udpPort = -1; config.debugLevel = 2; config.profile = 0; @@ -40,7 +40,7 @@ free(config.levelfile); config.levelfile = NULL; } -// split a string into (command value) pair; returns NULL if no value +// split a string into (command value) pair; empty string if none char * SplitCommandValue(char * s) { char * value; value = strchr(s, ' '); @@ -48,7 +48,8 @@ *(value++) = '\0'; // strip leading spaces while (value[0] == ' ') value++; - if (!strlen(value)) value = NULL; + } else { + value = ""; } return value; } @@ -119,7 +120,8 @@ char * malloc_strcpy(const char * src) { char * dst; - if (src == NULL) return NULL; + assert(src); + //if (src == NULL) return NULL; dst = malloc(strlen(src)+1); strcpy(dst, src); return dst; @@ -326,7 +328,7 @@ fprintf(f, "#grid false\n"); fprintf(f, "\n"); fprintf(f, "## dns or ip of server to play on (default: local game)\n"); - fprintf(f, "#server NULL\n"); + fprintf(f, "#server \n"); fprintf(f, "\n"); fprintf(f, "## server port number to connect to\n"); fprintf(f, "#serverPort 3223\n"); @@ -335,7 +337,7 @@ fprintf(f, "#players 2\n"); fprintf(f, "\n"); fprintf(f, "## replay this logfile (usually mass.rep)\n"); - fprintf(f, "#replay NULL\n"); + fprintf(f, "#replay \n"); fprintf(f, "\n"); fprintf(f, "## listen to this udp port (-1 random, 0 disable udp)\n"); fprintf(f, "#udpPort -1\n"); Modified: trunk/mass/config.h =================================================================== --- trunk/mass/config.h 2004-05-01 10:02:18 UTC (rev 260) +++ trunk/mass/config.h 2004-05-01 16:34:43 UTC (rev 261) @@ -13,13 +13,13 @@ Frontend display; //% boolean % default=0 % [OpenGL] draw grids only int grid; - //% string % default=NULL % dns or ip of server to play on (default: local game) + //% string % default= % dns or ip of server to play on (default: local game) char * server; //% int % min=0,default=3223 % server port number to connect to int serverPort; //% int % min=1,default=2,max=MAX_PLAYERS % wait for that many players before starting int players; - //% string % default=NULL % replay this logfile (usually mass.rep) + //% string % default= % replay this logfile (usually mass.rep) char * replay; //% int % min=-1,default=-1 % listen to this udp port (-1 random, 0 disable udp) int udpPort; Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-05-01 10:02:18 UTC (rev 260) +++ trunk/mass/level.c 2004-05-01 16:34:43 UTC (rev 261) @@ -143,7 +143,7 @@ parent = MassClassByName(name + 1); if (!parent) return "cannot inherit, parent not found"; } - if (!value) return "space seperated coordinates missing"; + if (!strlen(value)) return "space seperated coordinates missing"; details.posx = str2int(strvalueindex(value, 0), &error); if (error) return "bad space seperated coordinates"; details.posy = str2int(strvalueindex(value, 1), &error); @@ -158,7 +158,7 @@ name[strlen(name)-1] = '\0'; for (c=name; *c; c++) if (isspace((int)*c)) return "spaces in names are not allowed"; if (MassClassByName(name)) return "this name was already used before"; - if (value) { + if (strlen(value)) { parent = MassClassByName(value); if (!parent) return "cannot inherit, parent not found"; } else { @@ -248,7 +248,6 @@ if (!error && currentMass->growIfSmallerThan < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "shrink")) { currentMass->shrink = str2h_int(value, &error); - if (!error && currentMass->shrink < 0.0*HEIGHT_NORM) error = "out of range, minimum is 0.0"; } else if (!strcmp(name, "heading")) { currentMass->heading = str2int(value, &error); if (!error && currentMass->heading < -1) error = "out of range, minimum is -1"; @@ -374,10 +373,214 @@ void DumpMass(Mass * m) { - /* Mass * parent; - parent = CreateMass(parent); - */ - /* SCRIPT_COMPARE_MASS */ - /* SCRIPT_COMPARE_MASS */ + Mass * tmp; + tmp = NULL; + parent = MassClassByName(m->class); + if (!parent) { + tmp = parent = CreateMass(NULL); + } + /* SCRIPT_DUMP_MASS */ + if (m->bufferMass != parent->bufferMass) { + printf(" bufferMass %.6f\n", ((float)m->bufferMass)/HEIGHT_NORM); + } + if (m->weakSHR != parent->weakSHR) { + printf(" weakSHR %d\n", m->weakSHR); + } + if (m->normalSHR != parent->normalSHR) { + printf(" normalSHR %d\n", m->normalSHR); + } + if (m->strongSHR != parent->strongSHR) { + printf(" strongSHR %d\n", m->strongSHR); + } + if (m->minBorderHeight != parent->minBorderHeight) { + printf(" minBorderHeight %.6f\n", ((float)m->minBorderHeight)/HEIGHT_NORM); + } + if (m->maxBorderHeight != parent->maxBorderHeight) { + printf(" maxBorderHeight %.6f\n", ((float)m->maxBorderHeight)/HEIGHT_NORM); + } + if (m->speed != parent->speed) { + printf(" speed %d\n", m->speed); + } + if (m->lookDistance != parent->lookDistance) { + printf(" lookDistance %d\n", m->lookDistance); + } + if (m->baseColor[0] != parent->baseColor[0] || m->baseColor[1] != parent->baseColor[1] || m->baseColor[2] != parent->baseColor[2]) { + printf(" baseColor %d\n", m->baseColor[3]); + } + if (m->secondColor[0] != parent->secondColor[0] || m->secondColor[1] != parent->secondColor[1] || m->secondColor[2] != parent->secondColor[2]) { + printf(" secondColor %d\n", m->secondColor[3]); + } + if (m->debugColor[0] != parent->debugColor[0] || m->debugColor[1] != parent->debugColor[1] || m->debugColor[2] != parent->debugColor[2]) { + printf(" debugColor %d\n", m->debugColor[3]); + } + if (m->displayType != parent->displayType) { + if (m->displayType == DT_NORMAL) { + printf("displayType shadow\n"); + } else if (m->displayType == DT_FLAT) { + printf("displayType flat\n"); + } else { + assert(0); + } + } + if (m->growRounds != parent->growRounds) { + printf(" growRounds %d\n", m->growRounds); + } + if (m->growIfSmallerThan != parent->growIfSmallerThan) { + printf(" growIfSmallerThan %d\n", m->growIfSmallerThan); + } + if (m->shrink != parent->shrink) { + printf(" shrink %.6f\n", ((float)m->shrink)/HEIGHT_NORM); + } + if (m->heading != parent->heading) { + printf(" heading %d\n", m->heading); + } + if (m->velocity != parent->velocity) { + printf(" velocity %d\n", m->velocity); + } + if (m->player != parent->player) { + printf(" player %d\n", m->player); + } + if (m->attractPlayer != parent->attractPlayer) { + printf(" attractPlayer %d\n", m->attractPlayer); + } + if (m->age != parent->age) { + printf(" age %d\n", m->age); + } + if (m->energy != parent->energy) { + printf(" energy %d\n", m->energy); + } + if (m->pulse != parent->pulse) { + printf(" pulse %d\n", m->pulse); + } + if (m->vivid != parent->vivid) { + printf(" vivid %d\n", m->vivid); + } + if (m->vivid2 != parent->vivid2) { + printf(" vivid2 %d\n", m->vivid2); + } + if (m->sickness != parent->sickness) { + printf(" sickness %d\n", m->sickness); + } + if (m->destructive != parent->destructive) { + printf(" destructive %d\n", m->destructive); + } + if (m->plantGrowFruit != parent->plantGrowFruit) { + printf(" plantGrowFruit %d\n", m->plantGrowFruit); + } + if (m->borderColorHeight != parent->borderColorHeight) { + printf(" borderColorHeight %.6f\n", ((float)m->borderColorHeight)/HEIGHT_NORM); + } + if (m->headingAdd != parent->headingAdd) { + printf(" headingAdd %d\n", m->headingAdd); + } + if (m->slowHeadingAdd != parent->slowHeadingAdd) { + printf(" slowHeadingAdd %d\n", m->slowHeadingAdd); + } + if (strcmp(m->childClass, parent->childClass)) { + printf(" childClass %s\n", m->childClass); + } + if (m->childTime != parent->childTime) { + printf(" childTime %d\n", m->childTime); + } + if (m->childCount != parent->childCount) { + printf(" childCount %d\n", m->childCount); + } + if (m->childDistance != parent->childDistance) { + printf(" childDistance %d\n", m->childDistance); + } + if (m->childInside != parent->childInside) { + printf(" childInside %d\n", m->childInside); + } + if (m->childRandomDistance != parent->childRandomDistance) { + printf(" childRandomDistance %d\n", m->childRandomDistance); + } + if (m->childRandomDirection != parent->childRandomDirection) { + printf(" childRandomDirection %d\n", m->childRandomDirection); + } + if (m->childSetHeading != parent->childSetHeading) { + printf(" childSetHeading %d\n", m->childSetHeading); + } + if (m->childTakesMassFromParent != parent->childTakesMassFromParent) { + printf(" childTakesMassFromParent %d\n", m->childTakesMassFromParent); + } + if (m->childAndParentSwapped != parent->childAndParentSwapped) { + printf(" childAndParentSwapped %d\n", m->childAndParentSwapped); + } + if (strcmp(m->transformClass, parent->transformClass)) { + printf(" transformClass %s\n", m->transformClass); + } + if (m->transformAt != parent->transformAt) { + if (m->transformAt == TR_NEVER) { + printf("transformAt never\n"); + } else if (m->transformAt == TR_AGE) { + printf("transformAt age\n"); + } else if (m->transformAt == TR_RANDOM) { + printf("transformAt random\n"); + } else if (m->transformAt == TR_ENERGY) { + printf("transformAt energy\n"); + } else if (m->transformAt == TR_SIZE) { + printf("transformAt size\n"); + } else if (m->transformAt == TR_TOUCH) { + printf("transformAt touch\n"); + } else { + assert(0); + } + } + if (m->transformArgument != parent->transformArgument) { + printf(" transformArgument %d\n", m->transformArgument); + } + if (m->flatteningMovement != parent->flatteningMovement) { + printf(" flatteningMovement %d\n", m->flatteningMovement); + } + if (m->expFlattening != parent->expFlattening) { + printf(" expFlattening %d\n", m->expFlattening); + } + if (m->convolveFlattening != parent->convolveFlattening) { + printf(" convolveFlattening %d\n", m->convolveFlattening); + } + if (m->oldFlattening != parent->oldFlattening) { + printf(" oldFlattening %d\n", m->oldFlattening); + } + if (m->playerFood != parent->playerFood) { + printf(" playerFood %d\n", m->playerFood); + } + if (m->playerSwarm != parent->playerSwarm) { + printf(" playerSwarm %d\n", m->playerSwarm); + } + if (m->isWall != parent->isWall) { + printf(" isWall %d\n", m->isWall); + } + if (m->isProjectil != parent->isProjectil) { + printf(" isProjectil %d\n", m->isProjectil); + } + if (m->isMazeWall != parent->isMazeWall) { + printf(" isMazeWall %d\n", m->isMazeWall); + } + if (m->isCoinMass != parent->isCoinMass) { + printf(" isCoinMass %d\n", m->isCoinMass); + } + if (m->isLightningMass != parent->isLightningMass) { + printf(" isLightningMass %d\n", m->isLightningMass); + } + if (m->isNetworkMass != parent->isNetworkMass) { + printf(" isNetworkMass %d\n", m->isNetworkMass); + } + if (m->superGrow != parent->superGrow) { + printf(" superGrow %d\n", m->superGrow); + } + if (m->wakeOnPlayer != parent->wakeOnPlayer) { + printf(" wakeOnPlayer %d\n", m->wakeOnPlayer); + } + if (m->drawElipsoid != parent->drawElipsoid) { + printf(" drawElipsoid %d\n", m->drawElipsoid); + } + if (m->experimentalBorderPoints != parent->experimentalBorderPoints) { + printf(" experimentalBorderPoints %d\n", m->experimentalBorderPoints); + } + if (m->debugTest != parent->debugTest) { + printf(" debugTest %d\n", m->debugTest); + } + /* SCRIPT_DUMP_MASS */ + if (tmp) FreeMass(tmp); } Modified: trunk/mass/mass.h =================================================================== --- trunk/mass/mass.h 2004-05-01 10:02:18 UTC (rev 260) +++ trunk/mass/mass.h 2004-05-01 16:34:43 UTC (rev 261) @@ -138,7 +138,7 @@ int growRounds; //% int % min=0,default=0 % whenever the mass has fewer pixel than this count, grow int growIfSmallerThan; - //% h_int % min=0.0,default=0.0 % shrink that much per round + //% h_int % default=0.0 % shrink that much per round int shrink; //% int % min=-1,max=255,default=-1 % the direction (mass orientation), 128 means 180 degree, -1 random (choosen at creation) int heading; Modified: trunk/mass/networkplayer.c =================================================================== --- trunk/mass/networkplayer.c 2004-05-01 10:02:18 UTC (rev 260) +++ trunk/mass/networkplayer.c 2004-05-01 16:34:43 UTC (rev 261) @@ -399,13 +399,13 @@ player[i].exists = 0; } - if (config.replay) { + if (strlen(config.replay)) { playback = 1; logfile = fopen(config.replay, "r"); if (!logfile) Die("Could not open desired logfile '%s'\n", config.replay); } - if (config.server) { + if (strlen(config.server)) { #ifdef DISABLE_SDLNET printf("This binary was compiled with network support disabled.\n"); exit(1); Modified: trunk/mass/update-code.py =================================================================== --- trunk/mass/update-code.py 2004-05-01 10:02:18 UTC (rev 260) +++ trunk/mass/update-code.py 2004-05-01 16:34:43 UTC (rev 261) @@ -27,12 +27,14 @@ return s def make_commandlinehelp(self, indent): return indent + 'printf("--' + self.name.lower().ljust(15) + self.desc + '\\n");\n' + def make_notequal(self, prefix, prefix_other): + return '(' + prefix + self.name + ' != ' + prefix_other + self.name + ')' class T_string(T): def __init__(self, name, args, desc): T.__init__(self, name, args, desc) - if self.cdefault != 'NULL': - self.cdefault = '"' + self.cdefault + '"' + assert self.default != 'NULL' # obsolete, use empty string instead + self.cdefault = '"' + self.cdefault + '"' def make_free(self, indent, prefix): return indent + 'free(' + prefix + self.name + '); ' + prefix + self.name + ' = NULL;\n' def make_setdefault(self, indent, prefix): @@ -41,24 +43,30 @@ return indent + prefix + self.name + ' = malloc_strcpy(' + prefix_other + self.name + ');\n' def make_stringparser(self, indent, prefix, string): return indent + prefix + self.name + ' = malloc_strcpy(' + string + ');\n' + def make_notequal(self, prefix, prefix_other): + return '(strcmp(%s%s, %s%s))' % (prefix, self.name, prefix_other, self.name) + def make_print(self, indent, prefix): + return indent + 'printf(" ' + self.name + ' %s\\n", ' + prefix + self.name + ');\n' -class T_h_int(T): - multiply = '*HEIGHT_NORM' - convert = 'str2h_int' - def __init__(self, name, args, desc): - T.__init__(self, name, args, desc) - self.cdefault += self.multiply +class T_int(T): def make_stringparser(self, indent, prefix, string): - s = indent + prefix + self.name + ' = ' + self.convert + '(' + string + ', &error);\n' + s = indent + prefix + self.name + ' = str2int(' + string + ', &error);\n' min = self.args.get('min') - if min: s += indent + 'if (!error && %s%s < %s%s) error = "out of range, minimum is %s";\n' % (prefix, self.name, min, self.multiply, min) + if min: s += indent + 'if (!error && %s%s < %s) error = "out of range, minimum is %s";\n' % (prefix, self.name, min, min) max = self.args.get('max') - if max: s += indent + 'if (!error && %s%s > %s%s) error = "out of range, maximum is %s";\n' % (prefix, self.name, max, self.multiply, max) + if max: s += indent + 'if (!error && %s%s > %s) error = "out of range, maximum is %s";\n' % (prefix, self.name, max, max) return s + def make_print(self, indent, prefix): + return indent + 'printf(" ' + self.name + ' %d\\n", ' + prefix + self.name + ');\n' -class T_int(T_h_int): - multiply = '' - convert = 'str2int' +class T_h_int(T): + def __init__(self, name, args, desc): + T.__init__(self, name, args, desc) + self.cdefault += '*HEIGHT_NORM' + def make_stringparser(self, indent, prefix, string): + return indent + prefix + self.name + ' = str2h_int(' + string + ', &error);\n' + def make_print(self, indent, prefix): + return indent + 'printf(" ' + self.name + ' %.6f\\n", ((float)' + prefix + self.name + ')/HEIGHT_NORM);\n' class T_boolean(T_int): def __init__(self, name, args, desc): @@ -99,6 +107,22 @@ s += indent + 'if (!error && %s%s[%d] > %s) error = "out of range, maximum is %s";\n' % (prefix, self.name, i, max, max) i += 1 return s + def make_notequal(self, prefix, prefix_other): + l = [] + i = 0 + for value in self.default.split(): + l.append('%s%s[%d] != %s%s[%d]' % (prefix, self.name, i, prefix_other, self.name, i)) + i += 1 + return '(' + ' || '.join(l) + ')' + def make_print(self, indent, prefix): + l1 = [] + l2 = [] + i = 0 + for value in self.default.split(): + l1.append('%d') + l2.append('%s%s[%d]' % (prefix, self.name, i)) + i += 1 + return indent + 'printf(" ' + self.name + ' %d\\n", ' + prefix + self.name + '[%d]);\n' % i class T_enum(T): def __init__(self, name, args, desc): @@ -122,6 +146,14 @@ s += indent + ' error = "allowed values are: %s";\n' % ', '.join(allowed) s += indent + '}\n' return s + def make_print(self, indent, prefix): + s = indent + for name, cname in self.options: + s += 'if (%s%s == %s) {\n' % (prefix, self.name, cname) + s += indent + ' printf("%s %s\\n");\n' % (self.name, name) + s += indent + '} else ' + s += '{\n' + indent + ' assert(0);\n' + indent + '}\n' + return s T_types = {'string':T_string, 'int':T_int, 'h_int':T_h_int, 'int[]':T_int_array, 'boolean':T_boolean, 'enum':T_enum} @@ -176,6 +208,13 @@ for m in self.members: s += m.make_free(indent, prefix) return s + def make_dumpdiff(self, indent, prefix, prefix_other): + s = '' + for m in self.members: + s += indent + 'if ' + m.make_notequal(prefix, prefix_other) + ' {\n' + s += m.make_print(indent + ' ', prefix) + s += indent + '}\n' + return s class ParseKeymap: def __init__(self, line): @@ -227,6 +266,7 @@ writesection('mass.c', 'SCRIPT_COPY_MASS', massoptions.make_copy(' ', 'm->', 'copy->')) writesection('mass.c', 'SCRIPT_FREE_MASS', massoptions.make_free(' ', 'm->')) writesection('level.c', 'SCRIPT_MASS_PROPERTY', massoptions.make_stringparser(' ', 'currentMass->', 'value')) +writesection('level.c', 'SCRIPT_DUMP_MASS', massoptions.make_dumpdiff(' ', 'm->', 'parent->')) writesection('LEVELS', 'SCRIPT_LEVEL_COMMANDS', leveloptions.make_textdocu()) writesection('level.c', 'SCRIPT_LEVEL_LINE', leveloptions.make_stringparser(' ', 'level.', 'value')) |
From: <sv...@ol...> - 2004-05-01 10:02:38
|
Author: martin Date: 2004-05-01 12:02:18 +0200 (Sat, 01 May 2004) New Revision: 260 Modified: trunk/mass/LEVELS trunk/mass/README trunk/mass/TODO trunk/mass/config.c trunk/mass/debug.c trunk/mass/level.c trunk/mass/level.h trunk/mass/mass.c trunk/mass/update-code.py Log: rewrote update-code.py Modified: trunk/mass/LEVELS =================================================================== --- trunk/mass/LEVELS 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/LEVELS 2004-05-01 10:02:18 UTC (rev 260) @@ -108,7 +108,7 @@ whenever the mass has fewer pixel than this count, grow shrink (default: 0.0) - shrink per round - only if grown up + shrink that much per round heading (default: -1) the direction (mass orientation), 128 means 180 degree, -1 random (choosen at Modified: trunk/mass/README =================================================================== --- trunk/mass/README 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/README 2004-05-01 10:02:18 UTC (rev 260) @@ -43,7 +43,6 @@ m DEBUG press to draw new mass with mouse f12 DEBUG does something, don't hit in network game SCRIPT_DEFAULT_KEYS -While in DEBUG mode, use the mouse to select masses. Network support: Start two clients on my (hopefully running) server with Modified: trunk/mass/TODO =================================================================== --- trunk/mass/TODO 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/TODO 2004-05-01 10:02:18 UTC (rev 260) @@ -6,12 +6,11 @@ - implement mass movement that moves further than 1 pixel per cycle - implement goals, at least detect player mass destruction (maybe resurrection) - design at least 3 non-trivial levels and address the most urgent needs -- fix refreshement bugs (much frames skipped, debug mode, lightning) - (maybe) choose screen size / freeze size at runtime - metaserver = levelserver (no ingame joins yet) - fix metaserver NAT problems - remove stupid/nonworking features from the level language -- html version of the level language docu +- html version of the level language docu (linked on homepage) Before release 1.0: - Make a playable game or two! Modified: trunk/mass/config.c =================================================================== --- trunk/mass/config.c 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/config.c 2004-05-01 10:02:18 UTC (rev 260) @@ -18,10 +18,10 @@ config.fullscreen = FULLSCREEN_DEFAULT; config.display = F_2D; config.grid = 0; - config.server = NULL; + config.server = malloc_strcpy(NULL); config.serverPort = 3223; config.players = 2; - config.replay = NULL; + config.replay = malloc_strcpy(NULL); config.udpPort = -1; config.debugLevel = 2; config.profile = 0; @@ -229,56 +229,49 @@ config.display = F_3D; } else if (!strcmp(value, "none")) { config.display = F_NONE; - } else return "allowed values are: sdl, ogl, none"; + } else { + error = "allowed values are: sdl, ogl, none"; + } } else if (!strcmp(name, "grid")) { config.grid = str2boolean(value, &error); } else if (!strcmp(name, "server")) { - free(config.server); + free(config.server); config.server = NULL; config.server = malloc_strcpy(value); } else if (!strcmp(name, "serverport")) { config.serverPort = str2int(value, &error); - if (error) return error; - if (config.serverPort < 0) return "out of range, minimum is 0"; + if (!error && config.serverPort < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "players")) { config.players = str2int(value, &error); - if (error) return error; - if (config.players < 1) return "out of range, minimum is 1"; - if (config.players > MAX_PLAYERS) return "out of range, maximum is MAX_PLAYERS"; + if (!error && config.players < 1) error = "out of range, minimum is 1"; + if (!error && config.players > MAX_PLAYERS) error = "out of range, maximum is MAX_PLAYERS"; } else if (!strcmp(name, "replay")) { - free(config.replay); + free(config.replay); config.replay = NULL; config.replay = malloc_strcpy(value); } else if (!strcmp(name, "udpport")) { config.udpPort = str2int(value, &error); - if (error) return error; - if (config.udpPort < -1) return "out of range, minimum is -1"; + if (!error && config.udpPort < -1) error = "out of range, minimum is -1"; } else if (!strcmp(name, "debuglevel")) { config.debugLevel = str2int(value, &error); - if (error) return error; - if (config.debugLevel < 0) return "out of range, minimum is 0"; - if (config.debugLevel > 4) return "out of range, maximum is 4"; + if (!error && config.debugLevel < 0) error = "out of range, minimum is 0"; + if (!error && config.debugLevel > 4) error = "out of range, maximum is 4"; } else if (!strcmp(name, "profile")) { config.profile = str2int(value, &error); - if (error) return error; - if (config.profile < 0) return "out of range, minimum is 0"; + if (!error && config.profile < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "exitframe")) { config.exitFrame = str2int(value, &error); - if (error) return error; - if (config.exitFrame < 0) return "out of range, minimum is 0"; + if (!error && config.exitFrame < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "heavydebug")) { config.heavyDebug = str2int(value, &error); - if (error) return error; - if (config.heavyDebug < -1) return "out of range, minimum is -1"; + if (!error && config.heavyDebug < -1) error = "out of range, minimum is -1"; } else if (!strcmp(name, "levelfile")) { - free(config.levelfile); + free(config.levelfile); config.levelfile = NULL; config.levelfile = malloc_strcpy(value); } else if (!strcmp(name, "maxcps")) { config.maxCPS = str2int(value, &error); - if (error) return error; - if (config.maxCPS < 0) return "out of range, minimum is 0"; + if (!error && config.maxCPS < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "maxskip")) { config.maxSkip = str2int(value, &error); - if (error) return error; - if (config.maxSkip < 0) return "out of range, minimum is 0"; + if (!error && config.maxSkip < 0) error = "out of range, minimum is 0"; /* END SCRIPT_CONFIG_LINE */ } else if (!strcmp(name, "key")) { char * newvalue; @@ -321,7 +314,7 @@ fprintf(f, "## Mass user config file\n"); fprintf(f, "##\n"); fprintf(f, "## Remove the # if you change an option.\n"); - fprintf(f, "## Remove this file to refill with defaults (and newly added commands).\n"); + fprintf(f, "## Remove this file to refill with defaults (recommended after upgrade).\n"); fprintf(f, "\n"); fprintf(f, "## set fullscreen mode on startup\n"); fprintf(f, "#fullscreen FULLSCREEN_DEFAULT\n"); @@ -330,7 +323,7 @@ fprintf(f, "#display sdl\n"); fprintf(f, "\n"); fprintf(f, "## [OpenGL] draw grids only\n"); - fprintf(f, "#grid 0\n"); + fprintf(f, "#grid false\n"); fprintf(f, "\n"); fprintf(f, "## dns or ip of server to play on (default: local game)\n"); fprintf(f, "#server NULL\n"); Modified: trunk/mass/debug.c =================================================================== --- trunk/mass/debug.c 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/debug.c 2004-05-01 10:02:18 UTC (rev 260) @@ -2,6 +2,7 @@ #include "mass.h" #include "field.h" #include "config.h" +#include "level.h" #include "SDL.h" #include <stdio.h> #include <string.h> @@ -57,8 +58,11 @@ void PrintMassInformation(Mass * m) { DebugLevel(1, "--- Mass %X ---\n", m); + /* DebugLevel(1, "m->class = %s\n", m->class); DebugLevel(1, "m->maxRect = %s (m->massCell = %d)\n", RectString(m->maxRect), m->massCell); DebugLevel(1, "m->age = %d\n", m->age); DebugLevel(1, "m->speed = %d\n", m->speed); + */ + DumpMass(m); } Modified: trunk/mass/level.c =================================================================== --- trunk/mass/level.c 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/level.c 2004-05-01 10:02:18 UTC (rev 260) @@ -78,23 +78,23 @@ level.firstPersonMovement = str2boolean(value, &error); } else if (!strcmp(name, "viewportforce")) { level.viewportForce = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "viewportfriction")) { level.viewportFriction = str2int(value, &error); - if (error) return error; - if (level.viewportFriction < 0) return "out of range, minimum is 0"; + if (!error && level.viewportFriction < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "calculateinvisible")) { level.calculateInvisible = str2boolean(value, &error); } else if (!strcmp(name, "forcefrontend")) { str2lower(value); - if (!strcmp(value, "sdl")) { + if (!strcmp(value, "none")) { + level.forceFrontend = F_NONE; + } else if (!strcmp(value, "sdl")) { level.forceFrontend = F_2D; } else if (!strcmp(value, "ogl")) { level.forceFrontend = F_3D; - } else if (!strcmp(value, "none")) { - level.forceFrontend = F_NONE; - } else return "allowed values are: sdl, ogl, none"; - /* END SCRIPT_LEVEL_LINE */ + } else { + error = "allowed values are: none, sdl, ogl"; + } + /* END SCRIPT_LEVEL_LINE */ } else { return "unknown level command"; } @@ -191,138 +191,112 @@ /* START SCRIPT_MASS_PROPERTY */ if (!strcmp(name, "buffermass")) { currentMass->bufferMass = str2h_int(value, &error); - if (error) return error; } else if (!strcmp(name, "weakshr")) { currentMass->weakSHR = str2int(value, &error); - if (error) return error; - if (currentMass->weakSHR < 0) return "out of range, minimum is 0"; + if (!error && currentMass->weakSHR < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "normalshr")) { currentMass->normalSHR = str2int(value, &error); - if (error) return error; - if (currentMass->normalSHR < 0) return "out of range, minimum is 0"; + if (!error && currentMass->normalSHR < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "strongshr")) { currentMass->strongSHR = str2int(value, &error); - if (error) return error; - if (currentMass->strongSHR < 0) return "out of range, minimum is 0"; + if (!error && currentMass->strongSHR < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "minborderheight")) { currentMass->minBorderHeight = str2h_int(value, &error); - if (error) return error; } else if (!strcmp(name, "maxborderheight")) { currentMass->maxBorderHeight = str2h_int(value, &error); - if (error) return error; } else if (!strcmp(name, "speed")) { currentMass->speed = str2int(value, &error); - if (error) return error; - if (currentMass->speed < 0) return "out of range, minimum is 0"; + if (!error && currentMass->speed < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "lookdistance")) { currentMass->lookDistance = str2int(value, &error); - if (error) return error; - if (currentMass->lookDistance < 0) return "out of range, minimum is 0"; + if (!error && currentMass->lookDistance < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "basecolor")) { - currentMass->baseColor[0] = str2int(strvalueindex(value, 0), &error); - if (error) return "expecting exactly 3 space seperated integers"; - currentMass->baseColor[1] = str2int(strvalueindex(value, 1), &error); - if (error) return "expecting exactly 3 space seperated integers"; - currentMass->baseColor[2] = str2int(strvalueindex(value, 2), &error); - if (error) return "expecting exactly 3 space seperated integers"; + if (!error) currentMass->baseColor[0] = str2int(strvalueindex(value, 0), &error); + if (error) error = "expecting exactly 3 space seperated integers"; + if (!error) currentMass->baseColor[1] = str2int(strvalueindex(value, 1), &error); + if (error) error = "expecting exactly 3 space seperated integers"; + if (!error) currentMass->baseColor[2] = str2int(strvalueindex(value, 2), &error); + if (error) error = "expecting exactly 3 space seperated integers"; } else if (!strcmp(name, "secondcolor")) { - currentMass->secondColor[0] = str2int(strvalueindex(value, 0), &error); - if (error) return "expecting exactly 3 space seperated integers"; - currentMass->secondColor[1] = str2int(strvalueindex(value, 1), &error); - if (error) return "expecting exactly 3 space seperated integers"; - currentMass->secondColor[2] = str2int(strvalueindex(value, 2), &error); - if (error) return "expecting exactly 3 space seperated integers"; + if (!error) currentMass->secondColor[0] = str2int(strvalueindex(value, 0), &error); + if (error) error = "expecting exactly 3 space seperated integers"; + if (!error) currentMass->secondColor[1] = str2int(strvalueindex(value, 1), &error); + if (error) error = "expecting exactly 3 space seperated integers"; + if (!error) currentMass->secondColor[2] = str2int(strvalueindex(value, 2), &error); + if (error) error = "expecting exactly 3 space seperated integers"; } else if (!strcmp(name, "debugcolor")) { - currentMass->debugColor[0] = str2int(strvalueindex(value, 0), &error); - if (error) return "expecting exactly 3 space seperated integers"; - currentMass->debugColor[1] = str2int(strvalueindex(value, 1), &error); - if (error) return "expecting exactly 3 space seperated integers"; - currentMass->debugColor[2] = str2int(strvalueindex(value, 2), &error); - if (error) return "expecting exactly 3 space seperated integers"; + if (!error) currentMass->debugColor[0] = str2int(strvalueindex(value, 0), &error); + if (error) error = "expecting exactly 3 space seperated integers"; + if (!error) currentMass->debugColor[1] = str2int(strvalueindex(value, 1), &error); + if (error) error = "expecting exactly 3 space seperated integers"; + if (!error) currentMass->debugColor[2] = str2int(strvalueindex(value, 2), &error); + if (error) error = "expecting exactly 3 space seperated integers"; } else if (!strcmp(name, "displaytype")) { str2lower(value); - if (!strcmp(value, "flat")) { - currentMass->displayType = DT_FLAT; - } else if (!strcmp(value, "shadow")) { + if (!strcmp(value, "shadow")) { currentMass->displayType = DT_NORMAL; - } else return "allowed values are: flat, shadow"; + } else if (!strcmp(value, "flat")) { + currentMass->displayType = DT_FLAT; + } else { + error = "allowed values are: shadow, flat"; + } } else if (!strcmp(name, "growrounds")) { currentMass->growRounds = str2int(value, &error); - if (error) return error; - if (currentMass->growRounds < 0) return "out of range, minimum is 0"; + if (!error && currentMass->growRounds < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "growifsmallerthan")) { currentMass->growIfSmallerThan = str2int(value, &error); - if (error) return error; - if (currentMass->growIfSmallerThan < 0) return "out of range, minimum is 0"; + if (!error && currentMass->growIfSmallerThan < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "shrink")) { currentMass->shrink = str2h_int(value, &error); - if (error) return error; - if (currentMass->shrink < 0.0*HEIGHT_NORM) return "out of range, minimum is 0.0"; + if (!error && currentMass->shrink < 0.0*HEIGHT_NORM) error = "out of range, minimum is 0.0"; } else if (!strcmp(name, "heading")) { currentMass->heading = str2int(value, &error); - if (error) return error; - if (currentMass->heading < -1) return "out of range, minimum is -1"; - if (currentMass->heading > 255) return "out of range, maximum is 255"; + if (!error && currentMass->heading < -1) error = "out of range, minimum is -1"; + if (!error && currentMass->heading > 255) error = "out of range, maximum is 255"; } else if (!strcmp(name, "velocity")) { currentMass->velocity = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "player")) { currentMass->player = str2int(value, &error); - if (error) return error; - if (currentMass->player < -1) return "out of range, minimum is -1"; + if (!error && currentMass->player < -1) error = "out of range, minimum is -1"; } else if (!strcmp(name, "attractplayer")) { currentMass->attractPlayer = str2int(value, &error); - if (error) return error; - if (currentMass->attractPlayer < 0) return "out of range, minimum is 0"; + if (!error && currentMass->attractPlayer < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "age")) { currentMass->age = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "energy")) { currentMass->energy = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "pulse")) { currentMass->pulse = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "vivid")) { currentMass->vivid = str2int(value, &error); - if (error) return error; - if (currentMass->vivid < 0) return "out of range, minimum is 0"; + if (!error && currentMass->vivid < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "vivid2")) { currentMass->vivid2 = str2int(value, &error); - if (error) return error; - if (currentMass->vivid2 < 0) return "out of range, minimum is 0"; + if (!error && currentMass->vivid2 < 0) error = "out of range, minimum is 0"; } else if (!strcmp(name, "sickness")) { currentMass->sickness = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "destructive")) { currentMass->destructive = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "plantgrowfruit")) { currentMass->plantGrowFruit = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "bordercolorheight")) { currentMass->borderColorHeight = str2h_int(value, &error); - if (error) return error; } else if (!strcmp(name, "headingadd")) { currentMass->headingAdd = str2int(value, &error); - if (error) return error; - if (currentMass->headingAdd < -256) return "out of range, minimum is -256"; - if (currentMass->headingAdd > 255) return "out of range, maximum is 255"; + if (!error && currentMass->headingAdd < -256) error = "out of range, minimum is -256"; + if (!error && currentMass->headingAdd > 255) error = "out of range, maximum is 255"; } else if (!strcmp(name, "slowheadingadd")) { currentMass->slowHeadingAdd = str2boolean(value, &error); } else if (!strcmp(name, "childclass")) { - free(currentMass->childClass); + free(currentMass->childClass); currentMass->childClass = NULL; currentMass->childClass = malloc_strcpy(value); } else if (!strcmp(name, "childtime")) { currentMass->childTime = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "childcount")) { currentMass->childCount = str2int(value, &error); - if (error) return error; - if (currentMass->childCount < -1) return "out of range, minimum is -1"; + if (!error && currentMass->childCount < -1) error = "out of range, minimum is -1"; } else if (!strcmp(name, "childdistance")) { currentMass->childDistance = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "childinside")) { currentMass->childInside = str2boolean(value, &error); } else if (!strcmp(name, "childrandomdistance")) { @@ -336,7 +310,7 @@ } else if (!strcmp(name, "childandparentswapped")) { currentMass->childAndParentSwapped = str2boolean(value, &error); } else if (!strcmp(name, "transformclass")) { - free(currentMass->transformClass); + free(currentMass->transformClass); currentMass->transformClass = NULL; currentMass->transformClass = malloc_strcpy(value); } else if (!strcmp(name, "transformat")) { str2lower(value); @@ -346,16 +320,17 @@ currentMass->transformAt = TR_AGE; } else if (!strcmp(value, "random")) { currentMass->transformAt = TR_RANDOM; - } else if (!strcmp(value, "touch")) { - currentMass->transformAt = TR_TOUCH; } else if (!strcmp(value, "energy")) { currentMass->transformAt = TR_ENERGY; } else if (!strcmp(value, "size")) { currentMass->transformAt = TR_SIZE; - } else return "allowed values are: never, age, random, touch, energy, size"; + } else if (!strcmp(value, "touch")) { + currentMass->transformAt = TR_TOUCH; + } else { + error = "allowed values are: never, age, random, energy, size, touch"; + } } else if (!strcmp(name, "transformargument")) { currentMass->transformArgument = str2int(value, &error); - if (error) return error; } else if (!strcmp(name, "flatteningmovement")) { currentMass->flatteningMovement = str2boolean(value, &error); } else if (!strcmp(name, "expflattening")) { @@ -397,3 +372,12 @@ return error; } +void DumpMass(Mass * m) +{ + /* + Mass * parent; + parent = CreateMass(parent); + */ + /* SCRIPT_COMPARE_MASS */ + /* SCRIPT_COMPARE_MASS */ +} Modified: trunk/mass/level.h =================================================================== --- trunk/mass/level.h 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/level.h 2004-05-01 10:02:18 UTC (rev 260) @@ -30,5 +30,7 @@ //planned, for network too: extern void SaveLevelData(char * filename); extern void FreeLevel(); +// dump a mass as difference to its base class +extern void DumpMass(Mass * m); #endif Modified: trunk/mass/mass.c =================================================================== --- trunk/mass/mass.c 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/mass.c 2004-05-01 10:02:18 UTC (rev 260) @@ -38,6 +38,10 @@ free(m->baseLineGrowth); free(m->cell); free(m->class); + /* SCRIPT_FREE_MASS */ + free(m->childClass); m->childClass = NULL; + free(m->transformClass); m->transformClass = NULL; + /* SCRIPT_FREE_MASS */ free(m); } @@ -160,6 +164,7 @@ m->borderColorHeight = copy->borderColorHeight; m->headingAdd = copy->headingAdd; m->slowHeadingAdd = copy->slowHeadingAdd; + free(m->childClass); m->childClass = NULL; m->childClass = malloc_strcpy(copy->childClass); m->childTime = copy->childTime; m->childCount = copy->childCount; @@ -170,6 +175,7 @@ m->childSetHeading = copy->childSetHeading; m->childTakesMassFromParent = copy->childTakesMassFromParent; m->childAndParentSwapped = copy->childAndParentSwapped; + free(m->transformClass); m->transformClass = NULL; m->transformClass = malloc_strcpy(copy->transformClass); m->transformAt = copy->transformAt; m->transformArgument = copy->transformArgument; Modified: trunk/mass/update-code.py =================================================================== --- trunk/mass/update-code.py 2004-04-30 19:23:38 UTC (rev 259) +++ trunk/mass/update-code.py 2004-05-01 10:02:18 UTC (rev 260) @@ -3,37 +3,186 @@ from textwrap import wrap +class T: + "baseclass for configurable c variables" + def __init__(self, name, args, desc): + self.name = name.strip() + self.desc = desc.strip() + self.args = {} + for o in args: + key, value = o.split('=') + self.args[key.strip()] = value.strip() + self.default = self.args['default'] + self.cdefault = self.default + # standard statements for most c types + def make_free(self, indent, prefix): + return '' + def make_setdefault(self, indent, prefix): + return indent + prefix + self.name + ' = ' + self.cdefault + ';\n' + def make_copy(self, indent, prefix, prefix_other): + return indent + prefix + self.name + ' = ' + prefix_other + self.name + ';\n' + def make_textdocu(self): + s = '%s (default: %s)\n' % (self.name, self.default) + s += ' ' + '\n '.join(wrap(self.desc, 77)) + '\n\n' + return s + def make_commandlinehelp(self, indent): + return indent + 'printf("--' + self.name.lower().ljust(15) + self.desc + '\\n");\n' + +class T_string(T): + def __init__(self, name, args, desc): + T.__init__(self, name, args, desc) + if self.cdefault != 'NULL': + self.cdefault = '"' + self.cdefault + '"' + def make_free(self, indent, prefix): + return indent + 'free(' + prefix + self.name + '); ' + prefix + self.name + ' = NULL;\n' + def make_setdefault(self, indent, prefix): + return indent + prefix + self.name + ' = malloc_strcpy(' + self.cdefault + ');\n' + def make_copy(self, indent, prefix, prefix_other): + return indent + prefix + self.name + ' = malloc_strcpy(' + prefix_other + self.name + ');\n' + def make_stringparser(self, indent, prefix, string): + return indent + prefix + self.name + ' = malloc_strcpy(' + string + ');\n' + +class T_h_int(T): + multiply = '*HEIGHT_NORM' + convert = 'str2h_int' + def __init__(self, name, args, desc): + T.__init__(self, name, args, desc) + self.cdefault += self.multiply + def make_stringparser(self, indent, prefix, string): + s = indent + prefix + self.name + ' = ' + self.convert + '(' + string + ', &error);\n' + min = self.args.get('min') + if min: s += indent + 'if (!error && %s%s < %s%s) error = "out of range, minimum is %s";\n' % (prefix, self.name, min, self.multiply, min) + max = self.args.get('max') + if max: s += indent + 'if (!error && %s%s > %s%s) error = "out of range, maximum is %s";\n' % (prefix, self.name, max, self.multiply, max) + return s + +class T_int(T_h_int): + multiply = '' + convert = 'str2int' + +class T_boolean(T_int): + def __init__(self, name, args, desc): + T.__init__(self, name, args, desc) + if self.default == '0': + self.default = 'false' + elif self.default == '1': + self.default = 'true' + def make_stringparser(self, indent, prefix, string): + return indent + prefix + self.name + ' = str2boolean(' + string + ', &error);\n' + +class T_int_array(T): + def make_setdefault(self, indent, prefix): + i = 0 + s = '' + for value in self.default.split(): + s += indent + '%s%s[%d] = %s;\n' % (prefix, self.name, i, value) + i += 1 + return s + def make_copy(self, indent, prefix, prefix_other): + i = 0 + s = '' + for value in self.default.split(): + s += indent + '%s%s[%d] = %s%s[%d];\n' % (prefix, self.name, i, prefix_other, self.name, i) + i += 1 + return s + def make_stringparser(self, indent, prefix, string): + s = '' + i = 0 + for value in self.default.split(): + s += indent + 'if (!error) %s%s[%d] = str2int(strvalueindex(value, %d), &error);\n' % (prefix, self.name, i, i) + s += indent + 'if (error) error = "expecting exactly %d space seperated integers";\n' % len(self.default.split()) + if self.args.has_key('min'): + min = self.args['min'].split()[i] + s += indent + 'if (!error && %s%s[%d] < %s) error = "out of range, minimum is %s";\n' % (prefix, self.name, i, min, min) + if self.args.has_key('max'): + min = self.args['max'].split()[i] + s += indent + 'if (!error && %s%s[%d] > %s) error = "out of range, maximum is %s";\n' % (prefix, self.name, i, max, max) + i += 1 + return s + +class T_enum(T): + def __init__(self, name, args, desc): + self.name = name.strip() + self.desc = desc.strip() + self.options = [] + for o in args: + name, cname = o.split('=') + self.options.append([name.strip(), cname.strip()]) + self.default, self.cdefault = self.options[0] + def make_stringparser(self, indent, prefix, string): + s = indent + 'str2lower(' + string + ');\n' # assumes string is writeable + s += indent + allowed = [] + for name, cname in self.options: + allowed.append(name) + s += 'if (!strcmp(%s, "%s")) {\n' % (string, name) + s += indent + ' %s%s = %s;\n' % (prefix, self.name, cname) + s += indent + '} else ' + s += '{\n' + s += indent + ' error = "allowed values are: %s";\n' % ', '.join(allowed) + s += indent + '}\n' + return s + +T_types = {'string':T_string, 'int':T_int, 'h_int':T_h_int, 'int[]':T_int_array, 'boolean':T_boolean, 'enum':T_enum} + + +class ParseStruct: + "operate on a whole struct of c variables" + def __init__(self, declaration): + self.members = [] + for statement in declaration.split('//%')[1:]: + comment, declaration, trash = statement.split('\n', 2) + self.parseStatement(comment.strip(), declaration.strip()) + def parseStatement(self, comment, declaration): + ctype = declaration.split()[1] # unused + name = declaration.split()[-1].rstrip(';') + if ':' in declaration: + name = declaration.split()[1].strip() + T, args, desc = comment.split('%') + # create new variable object + self.members.append(T_types[T.strip()](name, args.split(','), desc)) + def make_textdocu(self): + s = '\n' + for m in self.members: + s += m.make_textdocu() + return s + def make_stringparser(self, indent, prefix, string): + s = indent + for m in self.members: + s += 'if (!strcmp(name, "%s")) {\n' % m.name.lower() + s += m.make_free(indent + ' ', prefix) + s += m.make_stringparser(indent + ' ', prefix, string) + s += indent + '} else ' + s = s[:-9] # remove final else + return s + def make_copy(self, indent, prefix, prefix_other): + s = '' + for m in self.members: + s += m.make_free(indent, prefix) + s += m.make_copy(indent, prefix, prefix_other) + return s + def make_setdefault(self, indent, prefix): + s = '' + for m in self.members: + s += m.make_setdefault(indent, prefix) + return s + def make_commandlinehelp(self, indent): + s = '' + for m in self.members: + s += m.make_commandlinehelp(indent) + return s + def make_free(self, indent, prefix): + s = '' + for m in self.members: + s += m.make_free(indent, prefix) + return s + class ParseKeymap: def __init__(self, line): self.name = line.split()[0] self.cdefault = line.split('"')[1] self.desc = line.split('"')[3] -class ParseStatement: - def __init__(self, comment, declaration): - self.ctype = declaration.split()[1] - self.name = declaration.split()[-1].rstrip(';') - if ':' in declaration: - self.name = declaration.split()[1].strip() - type, args, desc = comment.split('%') - self.desc = desc.strip() - self.type = type.strip() - self.args = {} - for o in args.split(','): - key, value = o.split('=') - self.args[key.strip()] = value.strip() - if self.type == 'enum': - self.default = args.split('=')[0].strip() - self.cdefault = self.args[self.default] - else: - self.cdefault = self.args['default'] - self.default = self.cdefault - if self.type == 'h_int': - self.cdefault += '*HEIGHT_NORM' - elif self.type == 'string': - if self.cdefault != 'NULL': - self.cdefault = '"' + self.default + '"' - def writesection(filename, tag, s): print 'Processing', filename, tag pre, old, post = open(filename).read().split(tag) @@ -53,157 +202,46 @@ for line in open('input.h').read().split('INPUT_CONFIGKEYS')[1].split('\n')[1:-1]: keymap.append(ParseKeymap(line)) -for statement in open('config.h').read().split('//%')[1:]: - comment, declaration, trash = statement.split('\n', 2) - useroptions.append(ParseStatement(comment.strip(), declaration.strip())) +useroptions = ParseStruct(open('config.h').read()) +leveloptions = ParseStruct(open('level.h').read()) +massoptions = ParseStruct(open('mass.h').read()) -for statement in open('level.h').read().split('//%')[1:]: - comment, declaration, trash = statement.split('\n', 2) - leveloptions.append(ParseStatement(comment.strip(), declaration.strip())) - -for statement in open('mass.h').read().split('//%')[1:]: - comment, declaration, trash = statement.split('\n', 2) - massoptions.append(ParseStatement(comment.strip(), declaration.strip())) - -# generate the sections - +# generate the keyboard sections s = ' KeyState ' + ', '.join(['*' + key.name for key in keymap]) + ';\n' writesection('input.h', 'SCRIPT_KEYSTATES', s) - s = '#define NUM_KEYS ' + str(len(keymap)) + '\n' writesection('input.c', 'SCRIPT_NUM_KEYS', s) - s = ''.join([' {"%s", "%s", "%s"},\n' % (key.name, key.cdefault, key.desc) for key in keymap]) writesection('input.c', 'SCRIPT_KEYINFO_ARRAY', s) - s = ''.join([key.cdefault.ljust(12) + key.desc + '\n' for key in keymap]) writesection('README', 'SCRIPT_DEFAULT_KEYS', s) -s = ''.join([' printf("--' + o.name.lower().ljust(15) + o.desc + '\\n");\n' for o in useroptions]) -writesection('config.c', 'SCRIPT_SHOW_HELP', s) +# other sections -def makedocu(options): - s = '\n' - for o in options: - default = o.default - if o.type == 'boolean': - if default == '0': - default = 'false' - elif default == '1': - default = 'true' - s += '%s (default: %s)\n' % (o.name, default) - s += ' ' + '\n '.join(wrap(o.desc, 77)) + '\n\n' - return s +writesection('config.c', 'SCRIPT_SHOW_HELP', useroptions.make_commandlinehelp(' ')) +writesection('config.c', 'SCRIPT_CONFIG_LINE', useroptions.make_stringparser(' ', 'config.', 'value')) +writesection('config.c', 'SCRIPT_RESET_CONFIG', useroptions.make_setdefault(' ', 'config.')) -writesection('LEVELS', 'SCRIPT_MASS_ATTRIBUTES', makedocu(massoptions)) -writesection('LEVELS', 'SCRIPT_LEVEL_COMMANDS', makedocu(leveloptions)) +writesection('LEVELS', 'SCRIPT_MASS_ATTRIBUTES', massoptions.make_textdocu()) +writesection('mass.c', 'SCRIPT_SET_MASS_DEFAULTS', massoptions.make_setdefault(' ', 'm->')) +writesection('mass.c', 'SCRIPT_COPY_MASS', massoptions.make_copy(' ', 'm->', 'copy->')) +writesection('mass.c', 'SCRIPT_FREE_MASS', massoptions.make_free(' ', 'm->')) +writesection('level.c', 'SCRIPT_MASS_PROPERTY', massoptions.make_stringparser(' ', 'currentMass->', 'value')) -def makeparser(prefix, options): - s = ' ' - for o in options: - s += 'if (!strcmp(name, "%s")) {\n' % o.name.lower() - if o.type == 'string': - s += ' free(%s%s);\n' % (prefix, o.name) - s += ' %s%s = malloc_strcpy(value);\n' % (prefix, o.name) - elif o.type == 'boolean': - s += ' %s%s = str2boolean(value, &error);\n' % (prefix, o.name) - elif o.type == 'enum': - s += ' str2lower(value);\n' - s += ' ' - for choice in o.args.keys(): - s += 'if (!strcmp(value, "%s")) {\n' % choice - s += ' %s%s = %s;\n' % (prefix, o.name, o.args[choice]) - s += ' } else ' - s += 'return "allowed values are: %s";\n' % ', '.join(o.args.keys()) - elif o.type == 'int': - s += ' %s%s = str2int(value, &error);\n' % (prefix, o.name) - s += ' if (error) return error;\n' - if o.args.has_key('min'): - s += ' if (%s%s < %s) return "out of range, minimum is %s";\n' % (prefix, o.name, o.args['min'], o.args['min']) - if o.args.has_key('max'): - s += ' if (%s%s > %s) return "out of range, maximum is %s";\n' % (prefix, o.name, o.args['max'], o.args['max']) - elif o.type == 'h_int': - s += ' %s%s = str2h_int(value, &error);\n' % (prefix, o.name) - s += ' if (error) return error;\n' - if o.args.has_key('min'): - s += ' if (%s%s < %s*HEIGHT_NORM) return "out of range, minimum is %s";\n' % (prefix, o.name, o.args['min'], o.args['min']) - if o.args.has_key('max'): - s += ' if (%s%s > %s*HEIGHT_NORM) return "out of range, maximum is %s";\n' % (prefix, o.name, o.args['max'], o.args['max']) - elif o.type == 'int[]': - i = 0 - for value in o.default.split(): - s += ' %s%s[%d] = str2int(strvalueindex(value, %d), &error);\n' % (prefix, o.name, i, i) - s += ' if (error) return "expecting exactly %d space seperated integers";\n' % len(o.default.split()) - if o.args.has_key('min'): - min = o.args['min'].split()[i] - s += ' if (%s%s[%d] < %s) return "out of range, minimum is %s";\n' % (prefix, o.name, i, min, min) - if o.args.has_key('max'): - max = o.args['max'].split()[i] - s += ' if (%s%s[%d] > %s) return "out of range, maximum is %s";\n' % (prefix, o.name, i, max, max) - i += 1 - else: - s += ' FIXME in newconfig.py: unhandled command %s;\n' % o.type - s += ' } else ' - s = s[:-9] # remove final else - return s +writesection('LEVELS', 'SCRIPT_LEVEL_COMMANDS', leveloptions.make_textdocu()) +writesection('level.c', 'SCRIPT_LEVEL_LINE', leveloptions.make_stringparser(' ', 'level.', 'value')) +writesection('level.c', 'SCRIPT_RESET_LEVEL', leveloptions.make_setdefault(' ', 'level.')) -s = makeparser('config.', useroptions) -writesection('config.c', 'SCRIPT_CONFIG_LINE', s) -s = makeparser('level.', leveloptions) -writesection('level.c', 'SCRIPT_LEVEL_LINE', s) -def makedefault(prefix, o): - "returns the string of the c statement for setting the default" - if o.type == 'int[]': - s = ''; i = 0 - for value in o.default.split(): - s += '%s%s[%d] = %s;\n' % (prefix, o.name, i, value) - i += 1 - elif o.type == 'string' and o.cdefault != 'NULL': - s = '%s%s = malloc_strcpy(%s);\n' % (prefix, o.name, o.cdefault) - else: - s = '%s%s = %s;\n' % (prefix, o.name, o.cdefault) - return s -s = ''.join([makedefault(' m->', o) for o in massoptions]) -writesection('mass.c', 'SCRIPT_SET_MASS_DEFAULTS', s) -s = ''.join([makedefault(' config.', o) for o in useroptions]) -writesection('config.c', 'SCRIPT_RESET_CONFIG', s) -s = ''.join([makedefault(' level.', o) for o in leveloptions]) -writesection('level.c', 'SCRIPT_RESET_LEVEL', s) - - -def makecopy(prefix1, prefix2, options): - "returns the string of the c statement for copying" - s = '' - for o in options: - if o.type == 'int[]': - for i in range(len(o.default.split())): - s += '%s%s[%d] = %s%s[%d];\n' % (prefix1, o.name, i, prefix2, o.name, i) - elif o.type == 'string': - # assume there is no need to free the string (OK for create-empty-and-copy) - s += '%s%s = malloc_strcpy(%s%s);\n' % (prefix1, o.name, prefix2, o.name) - else: - s += '%s%s = %s%s;\n' % (prefix1, o.name, prefix2, o.name) - return s - -s = makecopy(' m->', 'copy->', massoptions) -writesection('mass.c', 'SCRIPT_COPY_MASS', s) - -s = makeparser('currentMass->', massoptions) -writesection('level.c', 'SCRIPT_MASS_PROPERTY', s) - -s = makeparser('currentMass->', massoptions) -writesection('level.c', 'SCRIPT_MASS_PROPERTY', s) - lines = [ '## Mass user config file', '##', '## Remove the # if you change an option.', - '## Remove this file to refill with defaults (and newly added commands).', + '## Remove this file to refill with defaults (recommended after upgrade).', '', ] -for o in useroptions: +for o in useroptions.members: lines.append('## ' + o.desc) lines.append('#' + o.name + ' ' + o.default) lines.append('') |
From: <sv...@ol...> - 2004-04-30 19:23:45
|
Author: martin Date: 2004-04-30 21:23:38 +0200 (Fri, 30 Apr 2004) New Revision: 259 Modified: trunk/mass/README Log: README shortifications Modified: trunk/mass/README =================================================================== --- trunk/mass/README 2004-04-30 15:56:00 UTC (rev 258) +++ trunk/mass/README 2004-04-30 19:23:38 UTC (rev 259) @@ -1,21 +1,15 @@ mass - a game without bitmaps (http://mass.sourceforge.net) -Well, it is not really a game yet, but you can move the player, eat -the red dots, and watch the masses. +It is not really a game yet, but you can move the player using the +arrow keys, eat the red dots, and watch the masses. -General usage: -Just starting should work, for further options try './mass --help', -or edit ~/.mass/config (windows users: config.txt). -Move with the arrow keys (accelerate forward/reverse, turn -left/right). Press space (player button 1) to transfer your player's -energy to the masses you touch. The energy needs quite some time to -recover. -There are some other test levels in data/*.txt if you are bored. +Just starting should work, for further options try './mass --help', or +edit ~/.mass/config (windows users: config.txt). There are some more +test levels in data/*.txt if you are bored. -You can display it either in two dimension using SDL (that's -what I initially wanted) or in 3D using OpenGL (contributed by Laurenz -Gamper). If OpenGL is available, it will start in 2D mode and you can -press F10 to switch. +You can display mass in two dimension using SDL (what I initially +wanted) or in 3D using OpenGL (contributed by Laurenz Gamper). If +OpenGL is available you start in 2D mode, press F10 to switch. Default keys: SCRIPT_DEFAULT_KEYS @@ -49,7 +43,7 @@ m DEBUG press to draw new mass with mouse f12 DEBUG does something, don't hit in network game SCRIPT_DEFAULT_KEYS -With DHUD turned on, use the mouse to select masses. +While in DEBUG mode, use the mouse to select masses. Network support: Start two clients on my (hopefully running) server with |
From: <sv...@ol...> - 2004-04-30 15:56:10
|
Author: martin Date: 2004-04-30 17:56:00 +0200 (Fri, 30 Apr 2004) New Revision: 258 Modified: trunk/mass/data/trapper.txt Log: removed forbidden command Modified: trunk/mass/data/trapper.txt =================================================================== --- trunk/mass/data/trapper.txt 2004-04-25 18:24:38 UTC (rev 257) +++ trunk/mass/data/trapper.txt 2004-04-30 15:56:00 UTC (rev 258) @@ -1,8 +1,6 @@ # Testlevel with wall-builders (white mass) and # trappers closing a double-circle and sending out lightnings -maxcps 120 - Mass: growRounds 200 bufferMass 900 |
From: <sv...@ol...> - 2004-04-25 19:17:43
|
Author: martin Date: 2004-04-25 20:24:38 +0200 (Sun, 25 Apr 2004) New Revision: 257 Modified: trunk/mass/field.h Log: Rearranged field pixels in memory ==> engine 11% faster! Modified: trunk/mass/field.h =================================================================== --- trunk/mass/field.h 2004-04-18 17:56:59 UTC (rev 256) +++ trunk/mass/field.h 2004-04-25 18:24:38 UTC (rev 257) @@ -45,9 +45,28 @@ extern int displayHeading; /* accessing the field */ -#define FieldXY(x, y) (field + FIELDSIZE*((y)&(FIELDWRAP)) + ((x)&(FIELDWRAP))) +//#define FieldXY(x, y) (field + FIELDSIZE*((y)&(FIELDWRAP)) + ((x)&(FIELDWRAP))) +#define BLOCKBITS 7 +#define BLOCKSIZE (1 << BLOCKBITS) +#define BLOCKWRAP (BLOCKSIZE-1) +/* To keep physically close memory together, pixels are numbered in + blocks of BLOCKSIZE*BLOCKSIZE, like this (for BLOCKBITS = 2): + +-------------+-------------+-- + | 0 1 2 3 | 16 17 18 19 | ... + | 4 5 6 7 | 20 21 22 23 | + | 8 9 10 11 | 24 25 26 27 | + | 12 13 14 15 | 28 29 30 31 | + +-------------+-------------+-- + | ... | | + This helps to keep them in the CPU cache. (On my system: engine 11% + faster, optimal BLOCKBITS=7, but the optimal value certainly depends + on the masses / game / FIELDSIZE / CPU cache) + */ +#define FieldXY(x, y) (field /* Dear compiler. Please simplify this all. */ \ + /* block position */ + ((x)&FIELDWRAP&(~BLOCKWRAP))*BLOCKSIZE + ((y)&FIELDWRAP&(~BLOCKWRAP))*FIELDSIZE \ + /* within a block */ + BLOCKSIZE*((y)&BLOCKWRAP) + ((x)&BLOCKWRAP)) /* FIXME: name conflict! FieldPoint is already used. Strange this works. */ -#define FieldPoint(p) FieldXY(p.x, p.y) +#define FieldPoint(p) FieldXY((p).x, (p).y) extern Point FieldToPoint(FieldPoint * p); /* for main() */ |
From: <sv...@ol...> - 2004-04-18 17:57:03
|
Author: martin Date: 2004-04-18 19:56:59 +0200 (Sun, 18 Apr 2004) New Revision: 256 Removed: tags/old/premortem/ Log: renaming |
From: <sv...@ol...> - 2004-04-18 17:36:13
|
Author: martin Date: 2004-04-18 19:36:08 +0200 (Sun, 18 Apr 2004) New Revision: 255 Added: tags/old/premortem-0.1.x/ Removed: tags/old/premortem/mass/ Log: renaming Copied: tags/old/premortem-0.1.x (from rev 254, tags/old/premortem/mass) |
From: <sv...@ol...> - 2004-04-18 16:56:40
|
Author: martin Date: 2004-04-18 18:56:35 +0200 (Sun, 18 Apr 2004) New Revision: 254 Added: tags/old/modernized-r27/autogen.sh Log: autogen.sh Added: tags/old/modernized-r27/autogen.sh =================================================================== --- tags/old/modernized-r27/autogen.sh 2004-04-18 16:51:56 UTC (rev 253) +++ tags/old/modernized-r27/autogen.sh 2004-04-18 16:56:35 UTC (rev 254) @@ -0,0 +1,6 @@ +#!/bin/sh +set -e +aclocal +automake --add-missing +autoconf + Property changes on: tags/old/modernized-r27/autogen.sh ___________________________________________________________________ Name: svn:executable + * |
From: <sv...@ol...> - 2004-04-18 16:52:02
|
Author: martin Date: 2004-04-18 18:51:56 +0200 (Sun, 18 Apr 2004) New Revision: 253 Modified: tags/old/0.1.2/src/masses_flattening_movement.cc Log: dirty fix by removing assertion Modified: tags/old/0.1.2/src/masses_flattening_movement.cc =================================================================== --- tags/old/0.1.2/src/masses_flattening_movement.cc 2004-04-18 16:50:06 UTC (rev 252) +++ tags/old/0.1.2/src/masses_flattening_movement.cc 2004-04-18 16:51:56 UTC (rev 253) @@ -116,7 +116,7 @@ int value = ptr->height >> 8; value = (value*value) >> 6; // cout << float(value) / float(ptr->height) << endl; - assert(value <= ptr->height); + //LAZY FIX 2004 by commenting out assert(value <= ptr->height); ptr->height -= value; bufferMass += value; MMAC_foreachpoint_end |
From: <sv...@ol...> - 2004-04-18 16:50:12
|
Author: martin Date: 2004-04-18 18:50:06 +0200 (Sun, 18 Apr 2004) New Revision: 252 Added: tags/old/0.1.2/src/lightning1.wav tags/old/0.1.2/src/rules.cc tags/old/0.1.2/src/rules.hh Modified: tags/old/0.1.2/Makefile.am tags/old/0.1.2/autogen.sh tags/old/0.1.2/configure.in tags/old/0.1.2/src/Makefile.am tags/old/0.1.2/src/effects.cc tags/old/0.1.2/src/engine.hh Log: compiles now Modified: tags/old/0.1.2/Makefile.am =================================================================== --- tags/old/0.1.2/Makefile.am 2004-04-18 16:30:05 UTC (rev 251) +++ tags/old/0.1.2/Makefile.am 2004-04-18 16:50:06 UTC (rev 252) @@ -1,4 +1,4 @@ -SUBDIRS = src data +SUBDIRS = src EXTRA_DIST = \ AUTHORS \ Modified: tags/old/0.1.2/autogen.sh =================================================================== --- tags/old/0.1.2/autogen.sh 2004-04-18 16:30:05 UTC (rev 251) +++ tags/old/0.1.2/autogen.sh 2004-04-18 16:50:06 UTC (rev 252) @@ -1,3 +1,5 @@ +#!/bin/sh +set -e aclocal automake --add-missing autoconf Modified: tags/old/0.1.2/configure.in =================================================================== --- tags/old/0.1.2/configure.in 2004-04-18 16:30:05 UTC (rev 251) +++ tags/old/0.1.2/configure.in 2004-04-18 16:50:06 UTC (rev 252) @@ -1,6 +1,8 @@ #process this file with autoconf to produce a configure script. AC_INIT(README) +AC_CANONICAL_TARGET + dnl Setup for automake AM_INIT_AUTOMAKE(mass, 0.1.2) Modified: tags/old/0.1.2/src/Makefile.am =================================================================== --- tags/old/0.1.2/src/Makefile.am 2004-04-18 16:30:05 UTC (rev 251) +++ tags/old/0.1.2/src/Makefile.am 2004-04-18 16:50:06 UTC (rev 252) @@ -39,9 +39,9 @@ mass_DEPENDENCIES = continue_basic.mmac.hh continue_flattening_movement.mmac.hh continue_halfpoint_movement.mmac.hh -CLEANFILES += continue_basic.mmac.hh continue_flattening_movement.mmac.hh continue_halfpoint_movement.mmac.hh +CLEANFILES = continue_basic.mmac.hh continue_flattening_movement.mmac.hh continue_halfpoint_movement.mmac.hh -BUILT_SOURCES += continue_basic.mmac.hh continue_flattening_movement.mmac.hh continue_halfpoint_movement.mmac.hh +BUILT_SOURCES = continue_basic.mmac.hh continue_flattening_movement.mmac.hh continue_halfpoint_movement.mmac.hh continue_basic.mmac.hh : continue_basic.hh mmac.pl perl -w $(srcdir)/mmac.pl $(srcdir)/continue_basic.hh continue_basic.mmac.hh Modified: tags/old/0.1.2/src/effects.cc =================================================================== --- tags/old/0.1.2/src/effects.cc 2004-04-18 16:30:05 UTC (rev 251) +++ tags/old/0.1.2/src/effects.cc 2004-04-18 16:50:06 UTC (rev 252) @@ -80,7 +80,7 @@ dirVector = FloatPoint(start, end); bool inverted; - if (abs(dirVector.x) >= abs(dirVector.y)) { + if (fabs(dirVector.x) >= fabs(dirVector.y)) { inverted = false; } else { inverted = true; @@ -91,7 +91,7 @@ startVector = FloatPoint(-startVector.y, -startVector.x); endVector = FloatPoint(-endVector.y, -endVector.x); } - assert(abs(dirVector.x) >= abs(dirVector.y)); + assert(fabs(dirVector.x) >= fabs(dirVector.y)); if (dirVector.x < 0) { swap(start, end); @@ -117,7 +117,7 @@ //ok, this point is not cropped //calculate distance to the center of the line (0=at the center, 1=at either border of the line) - float pos = abs(float(y) - posy) / (orthogonalBroadness/2); + float pos = fabs(float(y) - posy) / (orthogonalBroadness/2); if (inverted) DrawPixel(y, x, pos); else Modified: tags/old/0.1.2/src/engine.hh =================================================================== --- tags/old/0.1.2/src/engine.hh 2004-04-18 16:30:05 UTC (rev 251) +++ tags/old/0.1.2/src/engine.hh 2004-04-18 16:50:06 UTC (rev 252) @@ -21,13 +21,15 @@ #ifndef __ENGINE__ #define __ENGINE__ -#include <vector.h> +#include <vector> #include <algorithm> #include <math.h> -#include <iostream.h> +#include <iostream> #include <assert.h> #include "SDL.h" +using namespace std; + #ifndef M_PI #define M_PI 3.1415926535897932382646 #endif @@ -249,7 +251,7 @@ inline TemplatePoint operator+(const TemplatePoint& add) { return TemplatePoint(add.x + x, add.y + y); } inline TemplatePoint operator-(const TemplatePoint& add) { return TemplatePoint(add.x - x, add.y - y); } inline TemplatePoint operator-() { return TemplatePoint(-x, -y); } - inline T length() { return (T) sqrt(x*x+y*y); } + inline T length() { return (T) sqrt((double)(x*x+y*y)); } inline double doubleLength() { return sqrt(double(x)*double(x)+double(y)*double(y)); } }; @@ -365,6 +367,5 @@ void CalculateShadowTable(ShadowTableType &table, float lx, float ly, float lz); inline int round(const float d) { return int(d+0.5); } -inline float abs(const float d) { return ((d >= 0) ? d : -d); } #endif Added: tags/old/0.1.2/src/lightning1.wav =================================================================== (Binary files differ) Property changes on: tags/old/0.1.2/src/lightning1.wav ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: tags/old/0.1.2/src/rules.cc =================================================================== --- tags/old/0.1.2/src/rules.cc 2004-04-18 16:30:05 UTC (rev 251) +++ tags/old/0.1.2/src/rules.cc 2004-04-18 16:50:06 UTC (rev 252) @@ -0,0 +1,133 @@ +/* +Copyright (c) 2000 Martin Renold <mar...@gm...> + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "rules.hh" +#include "effects.hh" + +RWorld1::RWorld1(GraphicEngine* _engine, bool createBody) : Rule(_engine, true) +{ + if (createBody) { + for (int i=0; i<2; i++) new MPlayer(engine, true, i); + //for (int i=0; i<2; i++) new MPlayer2(engine, true, i); + for (int i=0; i<30; i++) new MBasic(engine, true); + for (int i=0; i<30; i++) new MFlatteningMovement(engine, true); + for (int i=0; i<30; i++) new MAvoidPoint(engine, true); + for (int i=0; i<5; i++) new MHalfpointMovement(engine, true); + } + chainCheckTime = 100; +} + +void RWorld1::Continue() +{ + /* + if (randarea(0, 40) == 0) { + if (MBasic* m = dynamic_cast<MBasic*>(engine->masses[randarea(0, engine->masses.size())])) { + m->DiePlease(1); + if (randarea(0, 2) == 0) + new MBasic(engine, true); + else + new MFlatteningMovement(engine, true); + } + } + */ + + if (randarea(0, 200) == 22) { + Point start, end; + /* + int desired = 200; + do { + do { start = engine->masses[randarea(0, engine->masses.size())]->GetSignificantPoint(); } while (start.x <= 0); + do { end = engine->masses[randarea(0, engine->masses.size())]->GetSignificantPoint(); } while (end.x <= 0); + } while (abs(start.x-end.x) + abs(start.y-end.y) < desired--); + */ + if (randarea(0, 2) == 0) { + start = Point(randarea(0-SCREENX/2, 2*SCREENX), -10); + end = Point(randarea(0-SCREENX/2, 2*SCREENX), SCREENY-1+10); + } else { + start = Point(-10, randarea(0-SCREENY/2, 2*SCREENY)); + end = Point(SCREENX-1+10, randarea(0-SCREENY/2, 2*SCREENY)); + } + new ELightning(engine, true, start, end, 20); + } + if (chainCheckTime-- < 0 && false) { + chainCheckTime += 100; + int numbChains = 0; + for (int i=0; i<engine->rules.size(); i++) { + if (dynamic_cast<RChain*>(engine->rules[i]) != NULL) numbChains++; + } + if (numbChains < 1) new RChain(engine, true); + } +} + +RChain::RChain(GraphicEngine* _engine, bool createBody) : Rule(_engine, true) +{ + if (createBody) { + cout << "Trying to create chain...\n"; + for (int i=0; i<4; i++) { + int trials = 0; + bool ok; + Mass* m; + do { + assert(engine->masses.size() > 0); + m = engine->masses[randarea(0, engine->masses.size())]; + ok = m->AddMovement(FloatPoint(0, 0)); + if (ok) { + for (int j=0; j<chain.size(); j++) if (chain[j] == m) ok = false; + } + } while (!ok && ++trials < 100); + if (trials == 100) { + Kill(); + return; + } + m->IncRefCount(); + chain.push_back(m); + } + } + cout << "Chain successfully created.\n"; +} + +void RChain::GotKilled(bool destroyBody) +{ + if (destroyBody) { + for (int i=0; i<chain.size(); i++) { + chain[i]->DecRefCount(); + } + chain.clear(); + } + Rule::GotKilled(destroyBody); +} + +void RChain::Continue() +{ + for (int i=0; i<chain.size(); i++) { + if (chain[i]->IsDead()) { Kill(); return; } + Mass *m2; + if (i == 0) + m2 = chain[chain.size()-1]; + else + m2 = chain[i-1]; + FloatPoint v1; + Point v; + v = m2->GetSignificantPoint() - chain[i]->GetSignificantPoint(); + v1 = FloatPoint(v.x, v.y); + float l; + l = 1/v1.length(); + v1 = v1 * l * -0.5; + chain[i]->AddMovement(v1); + } +} Added: tags/old/0.1.2/src/rules.hh =================================================================== --- tags/old/0.1.2/src/rules.hh 2004-04-18 16:30:05 UTC (rev 251) +++ tags/old/0.1.2/src/rules.hh 2004-04-18 16:50:06 UTC (rev 252) @@ -0,0 +1,46 @@ +/* +Copyright (c) 2000 Martin Renold <mar...@gm...> + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __RULES__ +#define __RULES__ + +#include "engine.hh" +#include "masses.hh" + +//should continuously watch the game balance +class RWorld1 : public Rule +{ +public: + RWorld1(GraphicEngine* _engine, bool createBody); +protected: + virtual void Continue(); + int chainCheckTime; +}; + +//searches some masses near each other and lets them form a chain +class RChain : public Rule +{ +public: + RChain(GraphicEngine* _engine, bool createBody); +protected: + virtual void Continue(); + virtual void GotKilled(bool destroyBody); + vector<Mass*> chain; +}; + +#endif |
From: <sv...@ol...> - 2004-04-18 16:30:10
|
Author: martin Date: 2004-04-18 18:30:05 +0200 (Sun, 18 Apr 2004) New Revision: 251 Added: tags/old/0.1.2/autogen.sh Log: autogen.sh Added: tags/old/0.1.2/autogen.sh =================================================================== --- tags/old/0.1.2/autogen.sh 2004-04-18 16:23:16 UTC (rev 250) +++ tags/old/0.1.2/autogen.sh 2004-04-18 16:30:05 UTC (rev 251) @@ -0,0 +1,4 @@ +aclocal +automake --add-missing +autoconf + Property changes on: tags/old/0.1.2/autogen.sh ___________________________________________________________________ Name: svn:executable + * |
From: <sv...@ol...> - 2004-04-18 16:23:27
|
Author: martin Date: 2004-04-18 18:23:16 +0200 (Sun, 18 Apr 2004) New Revision: 250 Removed: tags/old/0.1.2/Makefile.in tags/old/0.1.2/acinclude.m4 tags/old/0.1.2/aclocal.m4 tags/old/0.1.2/install-sh tags/old/0.1.2/missing tags/old/0.1.2/mkinstalldirs tags/old/0.1.2/src/Makefile.in Log: removed generated files Deleted: tags/old/0.1.2/Makefile.in =================================================================== --- tags/old/0.1.2/Makefile.in 2004-04-18 16:20:16 UTC (rev 249) +++ tags/old/0.1.2/Makefile.in 2004-04-18 16:23:16 UTC (rev 250) @@ -1,326 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = . - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -CXX = @CXX@ -MAKEINFO = @MAKEINFO@ -PACKAGE = @PACKAGE@ -SDL_CFLAGS = @SDL_CFLAGS@ -SDL_CONFIG = @SDL_CONFIG@ -SDL_LIBS = @SDL_LIBS@ -VERSION = @VERSION@ - -SUBDIRS = src data - -EXTRA_DIST = AUTHORS COPYING HACKING HISTORY INSTALL NEWS README TODO - -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = -DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ -Makefile.in NEWS TODO acinclude.m4 aclocal.m4 configure configure.in \ -install-sh missing mkinstalldirs - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -all: all-redirect -.SUFFIXES: -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status - -$(ACLOCAL_M4): configure.in acinclude.m4 - cd $(srcdir) && $(ACLOCAL) - -config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck -$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) - cd $(srcdir) && $(AUTOCONF) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. - -@SET_MAKE@ - -all-recursive install-data-recursive install-exec-recursive \ -installdirs-recursive install-recursive uninstall-recursive \ -check-recursive installcheck-recursive info-recursive dvi-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ - rev="$$subdir $$rev"; \ - test "$$subdir" = "." && dot_seen=yes; \ - done; \ - test "$$dot_seen" = "no" && rev=". $$rev"; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - -rm -rf $(distdir) - GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz - mkdir $(distdir)/=build - mkdir $(distdir)/=inst - dc_install_base=`cd $(distdir)/=inst && pwd`; \ - cd $(distdir)/=build \ - && ../configure --srcdir=.. --prefix=$$dc_install_base \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) dist - -rm -rf $(distdir) - @banner="$(distdir).tar.gz is ready for distribution"; \ - dashes=`echo "$$banner" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - echo "$$dashes" -dist: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -dist-all: distdir - -chmod -R a+r $(distdir) - GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) - -rm -rf $(distdir) -distdir: $(DISTFILES) - -rm -rf $(distdir) - mkdir $(distdir) - -chmod 777 $(distdir) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - for subdir in $(SUBDIRS); do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - chmod 777 $(distdir)/$$subdir; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \ - || exit 1; \ - fi; \ - done -info-am: -info: info-recursive -dvi-am: -dvi: dvi-recursive -check-am: all-am -check: check-recursive -installcheck-am: -installcheck: installcheck-recursive -install-exec-am: -install-exec: install-exec-recursive - -install-data-am: -install-data: install-data-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-recursive -uninstall-am: -uninstall: uninstall-recursive -all-am: Makefile -all-redirect: all-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: installdirs-recursive -installdirs-am: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-tags mostlyclean-generic - -mostlyclean: mostlyclean-recursive - -clean-am: clean-tags clean-generic mostlyclean-am - -clean: clean-recursive - -distclean-am: distclean-tags distclean-generic clean-am - -distclean: distclean-recursive - -rm -f config.status - -maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-recursive - -rm -f config.status - -.PHONY: install-data-recursive uninstall-data-recursive \ -install-exec-recursive uninstall-exec-recursive installdirs-recursive \ -uninstalldirs-recursive all-recursive check-recursive \ -installcheck-recursive info-recursive dvi-recursive \ -mostlyclean-recursive distclean-recursive clean-recursive \ -maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ -distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all installdirs-am \ -installdirs mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: Deleted: tags/old/0.1.2/acinclude.m4 =================================================================== --- tags/old/0.1.2/acinclude.m4 2004-04-18 16:20:16 UTC (rev 249) +++ tags/old/0.1.2/acinclude.m4 2004-04-18 16:23:16 UTC (rev 250) @@ -1,168 +0,0 @@ -# Configure paths for SDL -# Sam Lantinga 9/21/99 -# stolen from Manish Singh -# stolen back from Frank Belew -# stolen from Manish Singh -# Shamelessly stolen from Owen Taylor - -dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS -dnl -AC_DEFUN(AM_PATH_SDL, -[dnl -dnl Get the cflags and libraries from the sdl-config script -dnl -AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], - sdl_prefix="$withval", sdl_prefix="") -AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], - sdl_exec_prefix="$withval", sdl_exec_prefix="") -AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], - , enable_sdltest=yes) - - if test x$sdl_exec_prefix != x ; then - sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config - fi - fi - if test x$sdl_prefix != x ; then - sdl_args="$sdl_args --prefix=$sdl_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_prefix/bin/sdl-config - fi - fi - - AC_PATH_PROG(SDL_CONFIG, sdl-config, no) - min_sdl_version=ifelse([$1], ,0.11.0,$1) - AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) - no_sdl="" - if test "$SDL_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` - SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` - - sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_sdltest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" -dnl -dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl-config to some extent -dnl - rm -f conf.sdltest - AC_TRY_RUN([ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <SDL/SDL.h> - -char* -my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else - new_str = NULL; - - return new_str; -} - -int main (int argc, char *argv[]) -{ - int major, minor, micro; - char *tmp_version; - - /* This hangs on some systems (?) - system ("touch conf.sdltest"); - */ - { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_sdl_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_sdl_version"); - exit(1); - } - - if (($sdl_major_version > major) || - (($sdl_major_version == major) && ($sdl_minor_version > minor)) || - (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); - printf("*** to point to the correct copy of sdl-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - -],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_sdl" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$SDL_CONFIG" = "no" ; then - echo "*** The sdl-config script installed by SDL could not be found" - echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL_CONFIG environment variable to the" - echo "*** full path to sdl-config." - else - if test -f conf.sdltest ; then - : - else - echo "*** Could not run SDL test program, checking why..." - CFLAGS="$CFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - AC_TRY_LINK([ -#include <stdio.h> -#include <SDL/SDL.h> -], [ return 0; ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding SDL or finding the wrong" - echo "*** version of SDL. If it is not finding SDL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means SDL was incorrectly installed" - echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - SDL_CFLAGS="" - SDL_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - rm -f conf.sdltest -]) Deleted: tags/old/0.1.2/aclocal.m4 =================================================================== --- tags/old/0.1.2/aclocal.m4 2004-04-18 16:20:16 UTC (rev 249) +++ tags/old/0.1.2/aclocal.m4 2004-04-18 16:23:16 UTC (rev 250) @@ -1,273 +0,0 @@ -dnl aclocal.m4 generated automatically by aclocal 1.4 - -dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without -dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A -dnl PARTICULAR PURPOSE. - -# Configure paths for SDL -# Sam Lantinga 9/21/99 -# stolen from Manish Singh -# stolen back from Frank Belew -# stolen from Manish Singh -# Shamelessly stolen from Owen Taylor - -dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS -dnl -AC_DEFUN(AM_PATH_SDL, -[dnl -dnl Get the cflags and libraries from the sdl-config script -dnl -AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], - sdl_prefix="$withval", sdl_prefix="") -AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], - sdl_exec_prefix="$withval", sdl_exec_prefix="") -AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], - , enable_sdltest=yes) - - if test x$sdl_exec_prefix != x ; then - sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config - fi - fi - if test x$sdl_prefix != x ; then - sdl_args="$sdl_args --prefix=$sdl_prefix" - if test x${SDL_CONFIG+set} != xset ; then - SDL_CONFIG=$sdl_prefix/bin/sdl-config - fi - fi - - AC_PATH_PROG(SDL_CONFIG, sdl-config, no) - min_sdl_version=ifelse([$1], ,0.11.0,$1) - AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) - no_sdl="" - if test "$SDL_CONFIG" = "no" ; then - no_sdl=yes - else - SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` - SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` - - sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - if test "x$enable_sdltest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" -dnl -dnl Now check if the installed SDL is sufficiently new. (Also sanity -dnl checks the results of sdl-config to some extent -dnl - rm -f conf.sdltest - AC_TRY_RUN([ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <SDL/SDL.h> - -char* -my_strdup (char *str) -{ - char *new_str; - - if (str) - { - new_str = malloc ((strlen (str) + 1) * sizeof(char)); - strcpy (new_str, str); - } - else - new_str = NULL; - - return new_str; -} - -int main (int argc, char *argv[]) -{ - int major, minor, micro; - char *tmp_version; - - /* This hangs on some systems (?) - system ("touch conf.sdltest"); - */ - { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } - - /* HP/UX 9 (%@#!) writes to sscanf strings */ - tmp_version = my_strdup("$min_sdl_version"); - if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { - printf("%s, bad version string\n", "$min_sdl_version"); - exit(1); - } - - if (($sdl_major_version > major) || - (($sdl_major_version == major) && ($sdl_minor_version > minor)) || - (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) - { - return 0; - } - else - { - printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); - printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); - printf("*** best to upgrade to the required version.\n"); - printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); - printf("*** to point to the correct copy of sdl-config, and remove the file\n"); - printf("*** config.cache before re-running configure\n"); - return 1; - } -} - -],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - if test "x$no_sdl" = x ; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) - else - AC_MSG_RESULT(no) - if test "$SDL_CONFIG" = "no" ; then - echo "*** The sdl-config script installed by SDL could not be found" - echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the SDL_CONFIG environment variable to the" - echo "*** full path to sdl-config." - else - if test -f conf.sdltest ; then - : - else - echo "*** Could not run SDL test program, checking why..." - CFLAGS="$CFLAGS $SDL_CFLAGS" - LIBS="$LIBS $SDL_LIBS" - AC_TRY_LINK([ -#include <stdio.h> -#include <SDL/SDL.h> -], [ return 0; ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding SDL or finding the wrong" - echo "*** version of SDL. If it is not finding SDL, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means SDL was incorrectly installed" - echo "*** or that you have moved SDL since it was installed. In the latter case, you" - echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - fi - SDL_CFLAGS="" - SDL_LIBS="" - ifelse([$3], , :, [$3]) - fi - AC_SUBST(SDL_CFLAGS) - AC_SUBST(SDL_LIBS) - rm -f conf.sdltest -]) - -# Do all the work for Automake. This macro actually does too much -- -# some checks are only needed if your package does certain things. -# But this isn't really a big deal. - -# serial 1 - -dnl Usage: -dnl AM_INIT_AUTOMAKE(package,version, [no-define]) - -AC_DEFUN(AM_INIT_AUTOMAKE, -[AC_REQUIRE([AC_PROG_INSTALL]) -PACKAGE=[$1] -AC_SUBST(PACKAGE) -VERSION=[$2] -AC_SUBST(VERSION) -dnl test to see if srcdir already configured -if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) -fi -ifelse([$3],, -AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) -AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) -AC_REQUIRE([AM_SANITY_CHECK]) -AC_REQUIRE([AC_ARG_PROGRAM]) -dnl FIXME This is truly gross. -missing_dir=`cd $ac_aux_dir && pwd` -AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) -AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) -AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) -AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) -AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) -AC_REQUIRE([AC_PROG_MAKE_SET])]) - -# -# Check to make sure that the build environment is sane. -# - -AC_DEFUN(AM_SANITY_CHECK, -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftestfile -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` - if test "[$]*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftestfile` - fi - if test "[$]*" != "X $srcdir/configure conftestfile" \ - && test "[$]*" != "X conftestfile $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "[$]2" = conftestfile - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -rm -f conftest* -AC_MSG_RESULT(yes)]) - -dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) -dnl The program must properly implement --version. -AC_DEFUN(AM_MISSING_PROG, -[AC_MSG_CHECKING(for working $2) -# Run test in a subshell; some versions of sh will print an error if -# an executable is not found, even if stderr is redirected. -# Redirect stdin to placate older versions of autoconf. Sigh. -if ($2 --version) < /dev/null > /dev/null 2>&1; then - $1=$2 - AC_MSG_RESULT(found) -else - $1="$3/missing $2" - AC_MSG_RESULT(missing) -fi -AC_SUBST($1)]) - Deleted: tags/old/0.1.2/install-sh =================================================================== --- tags/old/0.1.2/install-sh 2004-04-18 16:20:16 UTC (rev 249) +++ tags/old/0.1.2/install-sh 2004-04-18 16:23:16 UTC (rev 250) @@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 Deleted: tags/old/0.1.2/missing =================================================================== --- tags/old/0.1.2/missing 2004-04-18 16:20:16 UTC (rev 249) +++ tags/old/0.1.2/missing 2004-04-18 16:23:16 UTC (rev 250) @@ -1,190 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. -# Franc,ois Pinard <pi...@ir...>, 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing - GNU libit 0.0" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`configure.in'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`configure.in'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`configure.in'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 Deleted: tags/old/0.1.2/mkinstalldirs =================================================================== --- tags/old/0.1.2/mkinstalldirs 2004-04-18 16:20:16 UTC (rev 249) +++ tags/old/0.1.2/mkinstalldirs 2004-04-18 16:23:16 UTC (rev 250) @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <fri...@pr...> -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.1 2000/05/05 06:57:36 martinxyz Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here Deleted: tags/old/0.1.2/src/Makefile.in =================================================================== --- tags/old/0.1.2/src/Makefile.in 2004-04-18 16:20:16 UTC (rev 249) +++ tags/old/0.1.2/src/Makefile.in 2004-04-18 16:23:16 UTC (rev 250) @@ -1,363 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# Sorry, I really don't know how to write this better. -# Help me please if you are more familliar with automake and co! - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -CXX = @CXX@ -MAKEINFO = @MAKEINFO@ -PACKAGE = @PACKAGE@ -SDL_CFLAGS = @SDL_CFLAGS@ -SDL_CONFIG = @SDL_CONFIG@ -SDL_LIBS = @SDL_LIBS@ -VERSION = @VERSION@ - -EXTRA_DIST = mmac.pl lightning1.wav - -bin_PROGRAMS = mass - -mass_SOURCES = continue_basic.hh continue_flattening_movement.hh continue_halfpoint_movement.hh engine.cc engine.hh sound.cc sound.hh effects.cc effects.hh masses.cc masses.hh rules.cc rules.hh debugtools.cc debugtools.hh game1.cc game1.hh menu1.cc menu1.hh mass.cc masses_basic.cc masses_basic.hh masses_flattening_movement.cc masses_flattening_movement.hh masses_halfpoint_movement.cc masses_halfpoint_movement.hh masses_test.cc masses_test.hh - - -mass_DEPENDENCIES = continue_basic.mmac.hh continue_flattening_movement.mmac.hh continue_halfpoint_movement.mmac.hh - -CLEANFILES = continue_basic.mmac.hh continue_flattening_movement.mmac.hh continue_halfpoint_movement.mmac.hh - -BUILT_SOURCES = continue_basic.mmac.hh continue_flattening_movement.mmac.hh continue_halfpoint_movement.mmac.hh -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_CLEAN_FILES = -PROGRAMS = $(bin_PROGRAMS) - - -DEFS = @DEFS@ -I. -I$(srcdir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -mass_OBJECTS = engine.o sound.o effects.o masses.o rules.o debugtools.o \ -game1.o menu1.o mass.o masses_basic.o masses_flattening_movement.o \ -masses_halfpoint_movement.o masses_test.o -mass_LDADD = $(LDADD) -mass_LDFLAGS = -CXXFLAGS = @CXXFLAGS@ -CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ -CFLAGS = @CFLAGS@ -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = tar -GZIP_ENV = --best -DEP_FILES = .deps/debugtools.P .deps/effects.P .deps/engine.P \ -.deps/game1.P .deps/mass.P .deps/masses.P .deps/masses_basic.P \ -.deps/masses_flattening_movement.P .deps/masses_halfpoint_movement.P \ -.deps/masses_test.P .deps/menu1.P .deps/rules.P .deps/sound.P -SOURCES = $(mass_SOURCES) -OBJECTS = $(mass_OBJECTS) - -all: all-redirect -.SUFFIXES: -.SUFFIXES: .S .c .cc .o .s -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - - -mostlyclean-binPROGRAMS: - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) - -distclean-binPROGRAMS: - -maintainer-clean-binPROGRAMS: - -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - if test -f $$p; then \ - echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ - $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - list='$(bin_PROGRAMS)'; for p in $$list; do \ - rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ - done - -.s.o: - $(COMPILE) -c $< - -.S.o: - $(COMPILE) -c $< - -mostlyclean-compile: - -rm -f *.o core *.core - -clean-compile: - -distclean-compile: - -rm -f *.tab.c - -maintainer-clean-compile: - -mass: $(mass_OBJECTS) $(mass_DEPENDENCIES) - @rm -f mass - $(CXXLINK) $(mass_LDFLAGS) $(mass_OBJECTS) $(mass_LDADD) $(LIBS) -.cc.o: - $(CXXCOMPILE) -c $< - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - here=`pwd` && cd $(srcdir) \ - && mkid -f$$here/ID $$unique $(LISP) - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS)'; \ - unique=`for i in $$list; do echo $$i; done | \ - awk ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ - || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) - -mostlyclean-tags: - -clean-tags: - -distclean-tags: - -rm -f TAGS ID - -maintainer-clean-tags: - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = src - -distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu src/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done - -DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) - --include $(DEP_FILES) - -mostlyclean-depend: - -clean-depend: - -distclean-depend: - -rm -rf .deps - -maintainer-clean-depend: - -%.o: %.c - @echo '$(COMPILE) -c $<'; \ - $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -%.lo: %.c - @echo '$(LTCOMPILE) -c $<'; \ - $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp - -%.o: %.cc - @echo '$(CXXCOMPILE) -c $<'; \ - $(CXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-cp .deps/$(*F).pp .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm .deps/$(*F).pp - -%.lo: %.cc - @echo '$(LTCXXCOMPILE) -c $<'; \ - $(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< - @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ - < .deps/$(*F).pp > .deps/$(*F).P; \ - tr ' ' '\012' < .deps/$(*F).pp \ - | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ - >> .deps/$(*F).P; \ - rm -f .deps/$(*F).pp -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: install-binPROGRAMS -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: uninstall-binPROGRAMS -uninstall: uninstall-am -all-am: Makefile $(PROGRAMS) -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) - - -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -mostlyclean-am: mostlyclean-binPROGRAMS mostlyclean-compile \ - mostlyclean-tags mostlyclean-depend mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-binPROGRAMS clean-compile clean-tags clean-depend \ - clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-binPROGRAMS distclean-compile distclean-tags \ - distclean-depend distclean-generic clean-am - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-binPROGRAMS \ - maintainer-clean-compile maintainer-clean-tags \ - maintainer-clean-depend maintainer-clean-generic \ - distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \ -maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \ -mostlyclean-compile distclean-compile clean-compile \ -maintainer-clean-compile tags mostlyclean-tags distclean-tags \ -clean-tags maintainer-clean-tags distdir mostlyclean-depend \ -distclean-depend clean-depend maintainer-clean-depend info-am info \ -dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ -install-exec install-data-am install-data install-am install \ -uninstall-am uninstall all-redirect all-am all installdirs \ -mostlyclean-generic distclean-generic clean-generic \ -maintainer-clean-generic clean mostlyclean distclean maintainer-clean - - -continue_basic.mmac.hh : continue_basic.hh mmac.pl - perl -w $(srcdir)/mmac.pl $(srcdir)/continue_basic.hh continue_basic.mmac.hh - -continue_flattening_movement.mmac.hh : continue_basic.hh continue_flattening_movement.hh mmac.pl - perl -w $(srcdir)/mmac.pl $(srcdir)/continue_flattening_movement.hh continue_flattening_movement.mmac.hh - -continue_halfpoint_movement.mmac.hh : continue_basic.hh continue_halfpoint_movement.hh mmac.pl - perl -w $(srcdir)/mmac.pl $(srcdir)/continue_halfpoint_movement.hh continue_halfpoint_movement.mmac.hh - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: |