Compare commits
	
		
			3 Commits
		
	
	
		
			eb43986876
			...
			14fd15f776
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 14fd15f776 | |||
| b323bd0728 | |||
| 5ceb0eae5d | 
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,4 +1,3 @@ | |||||||
| raylib.h | raylib.h | ||||||
| game |  | ||||||
| 
 | 
 | ||||||
| */data/*.c | */data/*.c | ||||||
							
								
								
									
										1
									
								
								01_text_adventure/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								01_text_adventure/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | fatal_text_adventure_linux | ||||||
| @ -1,10 +1,12 @@ | |||||||
| CC=gcc | CC=gcc | ||||||
| CFLAGS=-Wall -lraylib -lm -lpthread -ldl -lX11 | CFLAGS=-Wall -lraylib -lm -lpthread -ldl -lX11 | ||||||
|  | BUTLER=../butler/butler | ||||||
|  | ITCH_CHANNEL=01-text-adventure-linux-x64-amd | ||||||
| 
 | 
 | ||||||
| .PHONY: clean run | .PHONY: clean run butler_upload | ||||||
| 
 | 
 | ||||||
| game: data/actions.c data/rooms.c data/room_ins.c data/words.c data/flags.c data/items.c *.c | fatal_text_adventure_linux: data/actions.c data/rooms.c data/room_ins.c data/words.c data/flags.c data/items.c *.c | ||||||
| 	$(CC) *.c $(CFLAGS) -o game | 	$(CC) *.c $(CFLAGS) -o fatal_text_adventure_linux | ||||||
| 
 | 
 | ||||||
| data/%.c: data/%.txt | data/%.c: data/%.txt | ||||||
| 	echo "char *data_$*_txt = " > data/$*.c | 	echo "char *data_$*_txt = " > data/$*.c | ||||||
| @ -14,9 +16,12 @@ data/%.c: data/%.txt | |||||||
| 	perl -pe 's/$$/\\n"/' >> data/$*.c | 	perl -pe 's/$$/\\n"/' >> data/$*.c | ||||||
| 	echo ";" >> data/$*.c | 	echo ";" >> data/$*.c | ||||||
| 
 | 
 | ||||||
| run: game | run: fatal_text_adventure_linux | ||||||
| 	./game | 	./fatal_text_adventure_linux | ||||||
| 
 | 
 | ||||||
| clean: | clean: | ||||||
| 	rm -f ./game | 	rm -f ./fatal_text_adventure_linux | ||||||
| 	rm -f ./data/*.c | 	rm -f ./data/*.c | ||||||
|  | 
 | ||||||
|  | butler_upload: fatal_text_adventure_linux | ||||||
|  | 	$(BUTLER) push ./fatal_text_adventure_linux bassguitarbill/fatal-distractions:$(ITCH_CHANNEL) | ||||||
|  | |||||||
| @ -8,15 +8,32 @@ EAST | * | 1 | You can't go east from here. | | |||||||
| WEST | * | 1 | You can't go west from here. | | WEST | * | 1 | You can't go west from here. | | ||||||
| NORTH | IN(FIRST_ROOM) | 10 | You head through the door. | GOTO(SECOND_ROOM) | NORTH | IN(FIRST_ROOM) | 10 | You head through the door. | GOTO(SECOND_ROOM) | ||||||
| SOUTH | IN(SECOND_ROOM) | 10 | You head back through the door. | GOTO(FIRST_ROOM) | SOUTH | IN(SECOND_ROOM) | 10 | You head back through the door. | GOTO(FIRST_ROOM) | ||||||
| EAST | IN(FIRST_ROOM) & ENABLED(LEVER_PULLED) | 20 | You crouch under the portcullis and enter the room. | GOTO(LAST_ROOM) | EAST | IN(FIRST_ROOM) & ENABLED(LEVER_PULLED) | 20 | You crouch under the portcullis and enter the room. | GOTO(FIRE_ROOM) | ||||||
| EAST | IN(FIRST_ROOM) | 10 | There is a portcullis in the way. | | EAST | IN(FIRST_ROOM) | 10 | There is a portcullis in the way. | | ||||||
| WEST | IN(LAST_ROOM) | 10 | You crouch under the portcullis and return to the room. | GOTO(FIRST_ROOM) | WEST | IN(FIRE_ROOM) | 10 | You crouch under the portcullis and return to the room. | GOTO(FIRST_ROOM) | ||||||
|  | WEST | IN(FIRST_ROOM) | 10 | It's way too dark in there. You shouldn't go in without a light source. | | ||||||
|  | WEST | IN(FIRST_ROOM) & HAS_ITEM(LIT_TORCH) | 100 | You cautiously enter the darkened room. | GOTO(DARK_ROOM) | ||||||
|  | EAST | IN(DARK_ROOM) | 10 | You make your way out of the darkened room. | GOTO(FIRST_ROOM) | ||||||
| PULL       | *                                      | 1    | You don't see anything to pull | | PULL       | *                                      | 1    | You don't see anything to pull | | ||||||
| PULL       | IN(SECOND_ROOM)                         | 10   | What do you want to pull? | | PULL       | IN(SECOND_ROOM)                         | 10   | What do you want to pull? | | ||||||
| PULL LEVER | IN(SECOND_ROOM)                         | 100  | You pull the lever and the sound of grinding machinery comes from the first room. | ENABLE(LEVER_PULLED) | PULL LEVER | IN(SECOND_ROOM)                         | 100  | You pull the lever and the sound of grinding machinery comes from the first room. | ENABLE(LEVER_PULLED) | ||||||
| PULL LEVER | IN(SECOND_ROOM) & ENABLED(LEVER_PULLED) | 1000 | You already pulled it.    | | PULL LEVER | IN(SECOND_ROOM) & ENABLED(LEVER_PULLED) | 1000 | You already pulled it.    | | ||||||
| TAKE TORCH | ITEM_HERE(UNLIT_TORCH) | 1000 | You pick up the torch | TAKE(UNLIT_TORCH) | TAKE TORCH | ITEM_HERE(UNLIT_TORCH) | 1000 | You pick up the torch | TAKE(UNLIT_TORCH) | ||||||
|  | TAKE TORCH | ITEM_HERE(LIT_TORCH) | 1000 | You carefully pick up the torch | TAKE(LIT_TORCH) | ||||||
| TAKE TORCH | HAS_ITEM(UNLIT_TORCH) | 1001 | You already have a torch | | TAKE TORCH | HAS_ITEM(UNLIT_TORCH) | 1001 | You already have a torch | | ||||||
|  | TAKE TORCH | HAS_ITEM(LIT_TORCH) | 1001 | You already have a torch | | ||||||
| TAKE TORCH | * | 100 | What torch? | | TAKE TORCH | * | 100 | What torch? | | ||||||
| DROP TORCH | * | 100 | What torch? | | DROP TORCH | * | 100 | What torch? | | ||||||
| DROP TORCH | HAS_ITEM(UNLIT_TORCH) | 1000 | You lay the torch carefully on the ground. | DROP(UNLIT_TORCH) | DROP TORCH | HAS_ITEM(UNLIT_TORCH) | 1000 | You lay the torch carefully on the ground. | DROP(UNLIT_TORCH) | ||||||
|  | DROP TORCH | HAS_ITEM(LIT_TORCH) | 1000 | You lay the torch carefully on the ground. | DROP(LIT_TORCH) | ||||||
|  | LIGHT TORCH | HAS_ITEM(LIT_TORCH) | 1000 | The torch is already burning brightly. | | ||||||
|  | LIGHT TORCH | * | 1 | What torch? | | ||||||
|  | LIGHT TORCH | HAS_ITEM(UNLIT_TORCH) | 10 | You don't have any way to light that. | | ||||||
|  | LIGHT TORCH | HAS_ITEM(UNLIT_TORCH) & IN(FIRE_ROOM) | 100 | You light the torch in the fire. It can illuminate a decent area. | TAKE(LIT_TORCH) & DESTROY(UNLIT_TORCH) | ||||||
|  | TOUCH FIRE | * | 1 | Why? What fire? | | ||||||
|  | TOUCH FIRE | HAS_ITEM(LIT_TORCH) | 10 | The torch singes your hand. Why would you do such a thing? | | ||||||
|  | TOUCH FIRE | IN(FIRE_ROOM) | 100 | You burn your hand quite badly in the flames! Why would you do that? | | ||||||
|  | LOOK PORTCULLIS | * | 1 | What portcullis? | | ||||||
|  | LOOK PORTCULLIS | IN(FIRST_ROOM) | 10 | The portcullis is made of wide metal slabs. In the room behind it, a merry fire crackles. | | ||||||
|  | LOOK PORTCULLIS | IN(FIRST_ROOM) & ENABLED(LEVER_PULLED) | 100 | The portcullis is mostly retracted into a slot in the ceiling in the doorway. | | ||||||
|  | LOOK PORTCULLIS | IN(FIRE_ROOM) | 100 | The portcullis is mostly retracted into a slot in the ceiling in the doorway. | | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| FIRST_ROOM  | *                     | 1  | You are in a plain room. A doorway is on the north wall, and a portcullis obstructs a doorway to the east.  | FIRST_ROOM  | *                     | 1  | You are in a plain room. A doorway is on the north wall, and a portcullis obstructs a doorway to the east. A pitch-dark room is through a doorway to the west. | ||||||
| FIRST_ROOM  | ENABLED(LEVER_PULLED) | 10 | You are in a plain room. A doorway is on the north wall, and the doorway once obstructed by the portcullis is to the east. | FIRST_ROOM  | ENABLED(LEVER_PULLED) | 10 | You are in a plain room. A doorway is on the north wall, and the doorway once obstructed by the portcullis is to the east. | ||||||
| SECOND_ROOM | *                     | 1 | This is a small room. It's painted blue. There's a doorway on the south wall, and a conspicuous lever in the middle of the floor. | SECOND_ROOM | *                     | 1 | This is a small room. It's painted blue. There's a doorway on the south wall, and a conspicuous lever in the middle of the floor. | ||||||
| LAST_ROOM   | *                     | 1 | This room is in disrepair. A doorway is open to the west. | FIRE_ROOM   | *                     | 1 | This room is in disrepair. A fire crackles merrily in a small fireplace. A doorway is open to the west. | ||||||
|  | DARK_ROOM | * | 1 | This room is gloomy and very cold. There's no reason to be in here, but it's the last room in the game so far. | ||||||
|  | |||||||
| @ -1,3 +1,4 @@ | |||||||
| FIRST_ROOM | FIRST_ROOM | ||||||
| SECOND_ROOM | SECOND_ROOM | ||||||
| LAST_ROOM | FIRE_ROOM | ||||||
|  | DARK_ROOM | ||||||
|  | |||||||
| @ -14,3 +14,7 @@ FLASK|FLASK,BOTTLE,JAR | |||||||
| TORCH|TORCH | TORCH|TORCH | ||||||
| TAKE|TAKE,PICKUP,GET | TAKE|TAKE,PICKUP,GET | ||||||
| DROP|DROP | DROP|DROP | ||||||
|  | LIGHT|LIGHT | ||||||
|  | TOUCH|TOUCH,FEEL | ||||||
|  | FIRE|FIRE,FLAMES,FLAME | ||||||
|  | PORTCULLIS|PORTCULLIS | ||||||
|  | |||||||
| @ -40,6 +40,9 @@ void cause_effect(Game *g, Effect *e) { | |||||||
|   case EFFECT_DROP_ITEM: |   case EFFECT_DROP_ITEM: | ||||||
|     drop_item(g, e->argument); |     drop_item(g, e->argument); | ||||||
|     break; |     break; | ||||||
|  |   case EFFECT_DESTROY_ITEM: | ||||||
|  |     destroy_item(g, e->argument); | ||||||
|  |     break; | ||||||
|   case EFFECT_CHECK_INVENTORY: |   case EFFECT_CHECK_INVENTORY: | ||||||
|     check_inventory(g); |     check_inventory(g); | ||||||
|     break; |     break; | ||||||
| @ -74,6 +77,8 @@ Effect *create_effect(Game *g, const char *string) { | |||||||
|       e->type = EFFECT_TAKE_ITEM; |       e->type = EFFECT_TAKE_ITEM; | ||||||
|     } else if (strcmp(token, "DROP") == 0) { |     } else if (strcmp(token, "DROP") == 0) { | ||||||
|       e->type = EFFECT_DROP_ITEM; |       e->type = EFFECT_DROP_ITEM; | ||||||
|  |     } else if (strcmp(token, "DESTROY") == 0) { | ||||||
|  |       e->type = EFFECT_DESTROY_ITEM; | ||||||
|     } else if (strcmp(token, "CHECK_INVENTORY") == 0) { |     } else if (strcmp(token, "CHECK_INVENTORY") == 0) { | ||||||
|       e->type = EFFECT_CHECK_INVENTORY; |       e->type = EFFECT_CHECK_INVENTORY; | ||||||
|     } |     } | ||||||
| @ -121,6 +126,9 @@ void print_effect(Effect *e) { | |||||||
|   case EFFECT_DROP_ITEM: |   case EFFECT_DROP_ITEM: | ||||||
|     printf("DROP(%s)", e->argument); |     printf("DROP(%s)", e->argument); | ||||||
|     break; |     break; | ||||||
|  |   case EFFECT_DESTROY_ITEM: | ||||||
|  |     printf("DESTROY(%s)", e->argument); | ||||||
|  |     break; | ||||||
|   case EFFECT_CHECK_INVENTORY: |   case EFFECT_CHECK_INVENTORY: | ||||||
|     printf("CHECK_INVENTORY()"); |     printf("CHECK_INVENTORY()"); | ||||||
|     break; |     break; | ||||||
|  | |||||||
| @ -14,6 +14,7 @@ typedef enum EffectType { | |||||||
|   EFFECT_LOOK_ROOM, |   EFFECT_LOOK_ROOM, | ||||||
|   EFFECT_TAKE_ITEM, |   EFFECT_TAKE_ITEM, | ||||||
|   EFFECT_DROP_ITEM, |   EFFECT_DROP_ITEM, | ||||||
|  |   EFFECT_DESTROY_ITEM, | ||||||
|   EFFECT_CHECK_INVENTORY, |   EFFECT_CHECK_INVENTORY, | ||||||
| } EffectType; | } EffectType; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -80,6 +80,12 @@ void drop_item(Game *g, char *item_name) { | |||||||
|   item->in_inventory = false; |   item->in_inventory = false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void destroy_item(Game *g, char *item_name) { | ||||||
|  |   Item *item = find_item(g->items, item_name); | ||||||
|  |   item->location = NULL; | ||||||
|  |   item->in_inventory = false; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void check_inventory(Game *g) { | void check_inventory(Game *g) { | ||||||
|   bool empty = true; |   bool empty = true; | ||||||
|   for (int i = 0; i < g->items->count; i++) { |   for (int i = 0; i < g->items->count; i++) { | ||||||
|  | |||||||
| @ -26,6 +26,7 @@ void log_items_in_room(Game *g, Room *r); | |||||||
| Item *find_item(Items *items, char *item_name); | Item *find_item(Items *items, char *item_name); | ||||||
| void take_item(Game *g, char *item_name); | void take_item(Game *g, char *item_name); | ||||||
| void drop_item(Game *g, char *item_name); | void drop_item(Game *g, char *item_name); | ||||||
|  | void destroy_item(Game *g, char *item_name); | ||||||
| void check_inventory(Game *g); | void check_inventory(Game *g); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								butler/7z.so
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								butler/7z.so
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								butler/butler
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								butler/butler
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								butler/libc7zip.so
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								butler/libc7zip.so
									
									
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user