Skip to content

Commit

Permalink
Add Gamerzilla support.
Browse files Browse the repository at this point in the history
  • Loading branch information
dulsi committed Aug 4, 2021
1 parent 201b3e2 commit f987030
Show file tree
Hide file tree
Showing 17 changed files with 88 additions and 4 deletions.
Binary file added gamerzilla/amazing0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/amazing1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions gamerzilla/anagramarama.game
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"shortname": "anagramarama",
"name": "Anagramarama",
"image": "gamerzilla/anagramarama.png",
"version": "1",
"trophy": [
{
"trophy_name": "Fun",
"trophy_desc": "Find all the three letter words.",
"max_progress": "0",
"trueimage": "gamerzilla/fun1.png",
"falseimage": "gamerzilla/fun0.png"
},
{
"trophy_name": "Good",
"trophy_desc": "Find all the four letter words.",
"max_progress": "0",
"trueimage": "gamerzilla/good1.png",
"falseimage": "gamerzilla/good0.png"
},
{
"trophy_name": "Great",
"trophy_desc": "Find all the five letter words.",
"max_progress": "0",
"trueimage": "gamerzilla/great1.png",
"falseimage": "gamerzilla/great0.png"
},
{
"trophy_name": "Exceed",
"trophy_desc": "Find all the six letter words.",
"max_progress": "0",
"trueimage": "gamerzilla/exceed1.png",
"falseimage": "gamerzilla/exceed0.png"
},
{
"trophy_name": "Amazing",
"trophy_desc": "Find all the seven letter words.",
"max_progress": "0",
"trueimage": "gamerzilla/amazing1.png",
"falseimage": "gamerzilla/amazing0.png"
},
{
"trophy_name": "Beat the Clock",
"trophy_desc": "Win the game.",
"max_progress": "0",
"trueimage": "gamerzilla/clock1.png",
"falseimage": "gamerzilla/clock0.png"
}
]
}
Binary file added gamerzilla/anagramarama.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/clock0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/clock1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/exceed0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/exceed1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/fun0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/fun1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/good0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/good1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/great0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gamerzilla/great1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
CC=gcc
LD=gcc
CFLAGS =-Wall `sdl-config --cflags`
CFLAGS +=-O9 -funroll-loops -fomit-frame-pointer
LDFLAGS=`sdl-config --libs` -lSDL_mixer
CFLAGS +=-O9 -funroll-loops -fomit-frame-pointer -DGAMERZILLA `pkg-config gamerzilla --cflags`
LDFLAGS=`sdl-config --libs` -lSDL_mixer `pkg-config gamerzilla --libs`

ifdef DEBUG
CFLAGS +=-g -DDEBUG -D_DEBUG
Expand Down
4 changes: 4 additions & 0 deletions readme
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ Version 0.5 - Italian translation (by Michele Bucelli)
Copyright (c) 2003-2010 Colm Gallagher et al.

Licensed under the terms of the GPL - see gpl.txt for details.

Clock in gamerzilla/clock1.png is under CC-BY-3.0 and was created by Keith333
Clocks & Watches - black clock - Seamless Texture with Normalmap
https://opengameart.org/content/clocks-watches-black-clock-seamless-texture-with-normalmap
34 changes: 32 additions & 2 deletions src/ag.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
#include "sprite.h"
#include "ag.h"

#ifdef GAMERZILLA
#include <gamerzilla.h>
#endif

#ifdef _MSC_VER
#define snprintf _snprintf
#endif
Expand Down Expand Up @@ -147,6 +151,13 @@ struct sound {
};
struct sound* soundCache = NULL;

#ifdef GAMERZILLA
int gameId = -1;
const char *trophies[] = {
"Fun", "Good", "Great", "Exceed", "Amazing"
};
#endif

/*
* On Windows the standard IO channels are not connected to anything
* so we must use alternative methods to see error and debug output.
Expand Down Expand Up @@ -458,11 +469,13 @@ checkGuess(char* answer, struct node* head)
struct node* current = head;
int i, len;
int foundWord = 0;
int foundAllLength = 1;
char test[8];

memset(test, 0, sizeof(test));
len = nextBlank(answer) - 1;
if (len == -1) len = sizeof(test);
if (len == -1) len = sizeof(test) - 1;
printf("%d\n", len);
for (i = 0; i < len; i++) {
assert(i < sizeof(test));
test[i] = answer[i];
Expand All @@ -478,7 +491,7 @@ checkGuess(char* answer, struct node* head)
score += current->length;
totalScore += current->length;
answersGot++;
if (len-1 == bigWordLen) {
if (len == bigWordLen) {
gotBigWord = 1;
Mix_PlayChannel(-1, getSound("foundbig"), 0);
} else {
Expand All @@ -489,6 +502,9 @@ checkGuess(char* answer, struct node* head)
/* getting all answers gives us the game score again!!*/
totalScore += score;
winGame = 1;
#ifdef GAMERZILLA
GamerzillaSetTrophy(gameId, "Beat the Clock");
#endif
}
current->found = 1;
current->guessed = 1;
Expand All @@ -500,13 +516,19 @@ checkGuess(char* answer, struct node* head)
updateAnswers = 1;
break;
}
else if ((!current->found) && (len == strlen(current->anagram))) {
foundAllLength = 0;
}

current = current->next;
}

if (!foundWord) {
Mix_PlayChannel(-1, getSound("badword"),0);
}
else if (foundAllLength && !foundDuplicate) {
GamerzillaSetTrophy(gameId, trophies[len - 3]);
}
}

/***********************************************************
Expand Down Expand Up @@ -1680,6 +1702,11 @@ main(int argc, char *argv[])
int audio_channels = 1;
int audio_buffers = 256;

#ifdef GAMERZILLA
GamerzillaStart(false, "save/");
gameId = GamerzillaSetGameFromFile("./gamerzilla/anagramarama.game", "./");
#endif

/* seed the random generator */
srand((unsigned int)time(NULL));

Expand Down Expand Up @@ -1744,6 +1771,9 @@ main(int argc, char *argv[])
SDL_FreeSurface(smallLetterBank);
SDL_FreeSurface(numberBank);
/*SDL_Quit(); */
#ifdef GAMERZILLA
GamerzillaQuit();
#endif
return 0;
}

Expand Down

0 comments on commit f987030

Please sign in to comment.