- Added doco generation function (./edit -dump)
This commit is contained in:
parent
095c92d17f
commit
dba3c41970
17
defs.h
17
defs.h
|
@ -147,6 +147,16 @@
|
||||||
#define B_TRUE -1
|
#define B_TRUE -1
|
||||||
#define B_FALSE 0
|
#define B_FALSE 0
|
||||||
|
|
||||||
|
// fruit types
|
||||||
|
#define FT_FRUIT 1
|
||||||
|
#define FT_PERM 2
|
||||||
|
#define FT_TEMP 3
|
||||||
|
#define FT_OTHER 4
|
||||||
|
|
||||||
|
// monster types
|
||||||
|
#define MT_MONSTER 1
|
||||||
|
#define MT_BOSS 2
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
#define WANTFPS 60 // try to run at this many frames per sec
|
#define WANTFPS 60 // try to run at this many frames per sec
|
||||||
|
|
||||||
|
@ -436,6 +446,12 @@ typedef struct levelentry_s {
|
||||||
char desc[MIDBUFLEN];
|
char desc[MIDBUFLEN];
|
||||||
} levelentry_t;
|
} levelentry_t;
|
||||||
|
|
||||||
|
typedef struct spriteinfo_s {
|
||||||
|
char *name;
|
||||||
|
char *desc;
|
||||||
|
char *file;
|
||||||
|
} spriteinfo_t;
|
||||||
|
|
||||||
typedef struct sprite_s {
|
typedef struct sprite_s {
|
||||||
int id; // what kind of sprite? (eg. player, cheese, rat)
|
int id; // what kind of sprite? (eg. player, cheese, rat)
|
||||||
int score; // player's score, for monsters how much they are worth
|
int score; // player's score, for monsters how much they are worth
|
||||||
|
@ -565,5 +581,6 @@ extern int numlevels;
|
||||||
extern int maxlevid;
|
extern int maxlevid;
|
||||||
extern char *deathtext[];
|
extern char *deathtext[];
|
||||||
extern char *bifftext[];
|
extern char *bifftext[];
|
||||||
|
extern spriteinfo_t spriteinfo[];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
5
edit.c
5
edit.c
|
@ -68,12 +68,17 @@ int main (int argc, char **argv) {
|
||||||
|
|
||||||
levelbg = NULL;
|
levelbg = NULL;
|
||||||
|
|
||||||
|
setfruitinfo();
|
||||||
|
|
||||||
/* handle arguments */
|
/* handle arguments */
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (!strcmp(argv[i], "-fs")) {
|
if (!strcmp(argv[i], "-fs")) {
|
||||||
printf("Fullscreen mode enabled.\n");
|
printf("Fullscreen mode enabled.\n");
|
||||||
vidargs |= SDL_FULLSCREEN;
|
vidargs |= SDL_FULLSCREEN;
|
||||||
|
} else if (!strcmp(argv[i], "-dump")) {
|
||||||
|
dumpinfo();
|
||||||
|
exit(1);
|
||||||
} else if (!strcmp(argv[i], "-l")) {
|
} else if (!strcmp(argv[i], "-l")) {
|
||||||
if (++i >= argc) {
|
if (++i >= argc) {
|
||||||
printf("Missing level number.\n");
|
printf("Missing level number.\n");
|
||||||
|
|
|
@ -9,6 +9,8 @@ int numlevels;
|
||||||
|
|
||||||
int maxlevid;
|
int maxlevid;
|
||||||
|
|
||||||
|
spriteinfo_t spriteinfo[MAXPTYPES];
|
||||||
|
|
||||||
|
|
||||||
SDL_Surface *levelbg; // level background image
|
SDL_Surface *levelbg; // level background image
|
||||||
SDL_Surface *temps; // temporary surface
|
SDL_Surface *temps; // temporary surface
|
||||||
|
|
Before Width: | Height: | Size: 333 KiB After Width: | Height: | Size: 333 KiB |
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 449 KiB |
Binary file not shown.
140
shared.c
140
shared.c
|
@ -1704,6 +1704,7 @@ int isfruit(int id) {
|
||||||
case P_CHIPS:
|
case P_CHIPS:
|
||||||
case P_BURGER:
|
case P_BURGER:
|
||||||
case P_DIAMOND:
|
case P_DIAMOND:
|
||||||
|
return FT_FRUIT;
|
||||||
/* permenant powerups */
|
/* permenant powerups */
|
||||||
case P_SPEED:
|
case P_SPEED:
|
||||||
case P_NUMNETS:
|
case P_NUMNETS:
|
||||||
|
@ -1711,6 +1712,8 @@ int isfruit(int id) {
|
||||||
case P_HELP:
|
case P_HELP:
|
||||||
case P_GEMBOOST:
|
case P_GEMBOOST:
|
||||||
case P_BELL:
|
case P_BELL:
|
||||||
|
case P_TROPHY:
|
||||||
|
return FT_PERM;
|
||||||
/* one-off level only powerups */
|
/* one-off level only powerups */
|
||||||
case P_BOXING:
|
case P_BOXING:
|
||||||
case P_MACEPOWERUP:
|
case P_MACEPOWERUP:
|
||||||
|
@ -1719,13 +1722,13 @@ int isfruit(int id) {
|
||||||
case P_BOMB:
|
case P_BOMB:
|
||||||
case P_HELMET:
|
case P_HELMET:
|
||||||
case P_SHIELD:
|
case P_SHIELD:
|
||||||
case P_TROPHY:
|
|
||||||
case P_RINGSILVER:
|
case P_RINGSILVER:
|
||||||
case P_RINGGOLD:
|
case P_RINGGOLD:
|
||||||
case P_CLOCK:
|
case P_CLOCK:
|
||||||
case P_SNOWMAN:
|
case P_SNOWMAN:
|
||||||
case P_SPRAY:
|
case P_SPRAY:
|
||||||
case P_CANNONPOWERUP:
|
case P_CANNONPOWERUP:
|
||||||
|
return FT_TEMP;
|
||||||
/* flowers */
|
/* flowers */
|
||||||
case P_FLOWERYELLOW:
|
case P_FLOWERYELLOW:
|
||||||
case P_FLOWERRED:
|
case P_FLOWERRED:
|
||||||
|
@ -1734,9 +1737,10 @@ int isfruit(int id) {
|
||||||
case P_GEMYELLOW:
|
case P_GEMYELLOW:
|
||||||
case P_GEMRED:
|
case P_GEMRED:
|
||||||
case P_GEMPURPLE:
|
case P_GEMPURPLE:
|
||||||
|
return FT_FRUIT;
|
||||||
/* misc */
|
/* misc */
|
||||||
case P_POWERUPPOS:
|
case P_POWERUPPOS:
|
||||||
return B_TRUE;
|
return FT_OTHER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2073,13 +2077,17 @@ int candoslopes(int sid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ismonster(int id) {
|
int ismonster(int id) {
|
||||||
if (id == P_RAT) return B_TRUE;
|
switch (id) {
|
||||||
if (id == P_BEE) return B_TRUE;
|
case P_RAT:
|
||||||
if (id == P_SPIDER) return B_TRUE;
|
case P_BEE:
|
||||||
if (id == P_SNAKE) return B_TRUE;
|
case P_SPIDER:
|
||||||
if (id == P_BLACKCLOUD) return B_TRUE;
|
case P_SNAKE:
|
||||||
if (id == P_COKE) return B_TRUE;
|
case P_COKE:
|
||||||
if (id == P_KINGRAT) return B_TRUE;
|
return MT_MONSTER;
|
||||||
|
case P_BLACKCLOUD:
|
||||||
|
case P_KINGRAT:
|
||||||
|
return MT_BOSS;
|
||||||
|
}
|
||||||
|
|
||||||
return B_FALSE;
|
return B_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2390,3 +2398,117 @@ void getpixelrgb(SDL_Surface *where, int x, int y, SDL_Color *clr) {
|
||||||
//*g = color.g;
|
//*g = color.g;
|
||||||
//*b = color.b;
|
//*b = color.b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setfruitinfo(void) {
|
||||||
|
setinfo(P_CHEESE, "Cheese", "", "cheese.png");
|
||||||
|
setinfo(P_ICECREAM, "Ice Cream","", "icecream.png");
|
||||||
|
setinfo(P_CHIPS, "Chips", "", "chips.png");
|
||||||
|
setinfo(P_BURGER, "Burger", "", "burger.png");
|
||||||
|
setinfo(P_DIAMOND, "Diamond", "", "diamond.png");
|
||||||
|
setinfo(P_FLOWERYELLOW, "Yellow Flower", "", "flower-yellow.png");
|
||||||
|
setinfo(P_FLOWERRED, "Red Flower", "", "flower-red.png");
|
||||||
|
setinfo(P_FLOWERPURPLE, "Purple Flower", "", "flower-purple.png");
|
||||||
|
setinfo(P_GEMYELLOW, "Yellow Gem", "", "gem-yellow.png");
|
||||||
|
setinfo(P_GEMRED, "Red Gem", "", "gem-red.png");
|
||||||
|
setinfo(P_GEMPURPLE, "Purple Gem", "", "gem-purple.png");
|
||||||
|
|
||||||
|
|
||||||
|
setinfo(P_SPEED, "Speed Up", "Makes you walk faster.", "speed.png");
|
||||||
|
setinfo(P_NUMNETS, "More Nets", "Increases the number of monsters you can catchsimultaneously.", "numnets.png");
|
||||||
|
setinfo(P_BIGNET, "Big Net", "Makes your nets reach further.", "bignet.png");
|
||||||
|
setinfo(P_HELP, "Help", "Gives useful game information or hints.", "help.png");
|
||||||
|
setinfo(P_GEMBOOST, "Gem Boost", "Increases the length of gem streams.", "gemboost.png");
|
||||||
|
setinfo(P_BELL, "Powerup Bell", "Rings if a permenant powerup is going to appear on the level", "bell.png");
|
||||||
|
setinfo(P_TROPHY, "Trophy", "Gives the player all powerups", "trophy.png");
|
||||||
|
setinfo(P_HELMET, "Helmet","Gives you a suit of armour which will protect you from death.", "helmet.png");
|
||||||
|
|
||||||
|
|
||||||
|
setinfo(P_BOXING, "Boxing Glove", "Your net will punch monsters, killing them instantly.", "glove.png");
|
||||||
|
setinfo(P_MACEPOWERUP, "Mace", "Slamming your net will cause a lethal explosion!", "macepowerup.png");
|
||||||
|
setinfo(P_FTODIAMOND, "Flowers-to-diamonds","Transforms all flowers on the level into diamonds.", "flowertodiamond.png");
|
||||||
|
setinfo(P_FTOGEM, "Flowers-to-gems", "Transforms all flowers on the level into gems, and turns itself into an extra-long stream of gems.", "flowertogem.png");
|
||||||
|
setinfo(P_BOMB, "Bomb", "Explodes and kills all monsters on the level.", "bomb.png");
|
||||||
|
setinfo(P_SHIELD, "Shield", "Temporary invulnerability", "shield.png");
|
||||||
|
setinfo(P_RINGSILVER, "Silver Ring", "Until the end of the level, you gain points for jumping.", "ring-silver.png");
|
||||||
|
setinfo(P_RINGGOLD, "Gold Ring", "Until the end of the level, you gain points for walking.", "ring-gold.png");
|
||||||
|
setinfo(P_CLOCK, "Stopwatch", "Stops time for 10 seconds", "clock.png");
|
||||||
|
setinfo(P_SNOWMAN, "Snowman", "Freezes the level, turning everything to ice - touch a monster to shatter it!", "snowman.png");
|
||||||
|
setinfo(P_SPRAY, "Fly Spray", "Sickens all monsters, causing them to slow down to half speed.","spray.png");
|
||||||
|
setinfo(P_CANNONPOWERUP, "Fusion Cannon", "A powerful weapon which will shoot out laser beams in all directions!", "cannonpowerup.png");
|
||||||
|
|
||||||
|
setinfo(P_RAT, "Rat", "The weakest of the monsters, the rat will simply walk back and forth waiting to be caught. Beward an angry rat though, as it will try to fall or jump in order to catch you!", "rat.png");
|
||||||
|
setinfo(P_BEE, "Bee", "Bees, while still relatively weak, gain an advantage over bats in that they are able to fly. They move in a simple diagonal pattern, changing direction when they get near a wall or spikes. Bees will speed up when angry.", "newbee.png");
|
||||||
|
|
||||||
|
setinfo(P_SPIDER, "Spider", "Spiders will lurk quietly on the ceiling, crawling back and forth. If they notice a player nearby however they will swiftly pounce down onto their prey!", "spider.png");
|
||||||
|
|
||||||
|
setinfo(P_SNAKE, "Snake", "The snake moves in a similar fashion to the rat with one important exception - upon seeing a player they will spit a glob of deadly venom at them!", "snake.png");
|
||||||
|
|
||||||
|
|
||||||
|
setinfo(P_COKE, "Coke Can", "The coke can is small but intelligent - even in its regular placid state it will move in the same manner as an angry rat. Because of their small size, they are also difficult to arget with a slam!", "coke.png");
|
||||||
|
|
||||||
|
setinfo(P_BLACKCLOUD, "Cloud of Doom", "This unkillable cloud will appear if you spend too much time on one level. Beware, as the only way to defeat the cloud of doom is to complete the level before it grows too large to handle!", "cloud.png");
|
||||||
|
|
||||||
|
setinfo(P_KINGRAT, "King Rat", "This mighty creature is the ruler of the rats, and impervious to the player's net. It can only be harmed by slamming another monster into it! King Rat will roam the level searching for a player, and upon locating them will charge at high speed.", "kingrat.png");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void setinfo(int id, char *name, char *desc, char *file) {
|
||||||
|
spriteinfo[id].name = strdup(name);
|
||||||
|
spriteinfo[id].desc = strdup(desc);
|
||||||
|
spriteinfo[id].file = strdup(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dump html doco
|
||||||
|
void dumpinfo(void) {
|
||||||
|
int i;
|
||||||
|
// header
|
||||||
|
printf("<center><h2>Power-Ups</h2></center>\n");
|
||||||
|
printf("<table border=1>\n");
|
||||||
|
// fruits
|
||||||
|
printf("<tr><th colspan=2>Fruits</th></tr>\n");
|
||||||
|
for (i = 0; i < MAXPTYPES; i++) {
|
||||||
|
if (isfruit(i) == FT_FRUIT) {
|
||||||
|
printf("<tr><td align=center><img src=\"%s\"><br>%s</td><td>Worth %d points.</td></tr>\n",
|
||||||
|
spriteinfo[i].file, spriteinfo[i].name,getpoints(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// perm powerup
|
||||||
|
printf("<tr><th colspan=2>Permenant Powerups</th></tr>\n");
|
||||||
|
for (i = 0; i < MAXPTYPES; i++) {
|
||||||
|
if (isfruit(i) == FT_PERM) {
|
||||||
|
printf("<tr><td align=center><img src=\"%s\"><br>%s</td><td>%s</td></tr>\n",
|
||||||
|
spriteinfo[i].file, spriteinfo[i].name,spriteinfo[i].desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// temp powerup
|
||||||
|
printf("<tr><th colspan=2>Temporary Powerups</th></tr>\n");
|
||||||
|
for (i = 0; i < MAXPTYPES; i++) {
|
||||||
|
if (isfruit(i) == FT_TEMP) {
|
||||||
|
printf("<tr><td align=center><img src=\"%s\"><br>%s</td><td>%s</td></tr>\n",
|
||||||
|
spriteinfo[i].file, spriteinfo[i].name,spriteinfo[i].desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("</table>\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf("<center><h2>Creatures</h2></center>\n");
|
||||||
|
printf("<table border=1>\n");
|
||||||
|
// monsters
|
||||||
|
printf("<tr><th colspan=2>Monsters</th></tr>\n");
|
||||||
|
for (i = 0; i < MAXPTYPES; i++) {
|
||||||
|
if (ismonster(i) == MT_MONSTER) {
|
||||||
|
printf("<tr><td align=center><img src=\"%s\"><br>%s</td><td>%s</td></tr>\n",
|
||||||
|
spriteinfo[i].file, spriteinfo[i].name,spriteinfo[i].desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// bosses
|
||||||
|
printf("<tr><th colspan=2>Bosses</th></tr>\n");
|
||||||
|
for (i = 0; i < MAXPTYPES; i++) {
|
||||||
|
if (ismonster(i) == MT_BOSS) {
|
||||||
|
printf("<tr><td align=center><img src=\"%s\"><br>%s</td><td>%s</td></tr>\n",
|
||||||
|
spriteinfo[i].file, spriteinfo[i].name,spriteinfo[i].desc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
4
shared.h
4
shared.h
|
@ -49,5 +49,9 @@ int isnettable(int monid);
|
||||||
int isboss(int monid);
|
int isboss(int monid);
|
||||||
int getbosshealth(int mid);
|
int getbosshealth(int mid);
|
||||||
void getpixelrgb(SDL_Surface *where, int x, int y, SDL_Color *clr);
|
void getpixelrgb(SDL_Surface *where, int x, int y, SDL_Color *clr);
|
||||||
|
// for doco
|
||||||
|
void setfruitinfo(void);
|
||||||
|
void setinfo(int id, char *name, char *desc, char *file);
|
||||||
|
void dumpinfo(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue