diff options
| author | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:51:24 +0200 |
|---|---|---|
| committer | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:51:24 +0200 |
| commit | 44daf03024fbf7cbffa10349044786f6ab784821 (patch) | |
| tree | fe311eb22e2d853dfc18fde1a9e55d21815f4f82 /src/screen/screen_credits.c | |
| parent | e12753d2ec9db83ec08bb9db63902a82fb245cdd (diff) | |
Revert "X"
This reverts commit e12753d2ec9db83ec08bb9db63902a82fb245cdd.
Diffstat (limited to 'src/screen/screen_credits.c')
| -rw-r--r-- | src/screen/screen_credits.c | 190 |
1 files changed, 93 insertions, 97 deletions
diff --git a/src/screen/screen_credits.c b/src/screen/screen_credits.c index 67e39eb..0d65c07 100644 --- a/src/screen/screen_credits.c +++ b/src/screen/screen_credits.c @@ -28,131 +28,127 @@ static textFile_t *textFile; static int offset; static int creditExists; -void -startScreenCredits() +void startScreenCredits() { #ifndef NO_SOUND - playMusic("menu", MUSIC_GROUP_BASE); + playMusic("menu", MUSIC_GROUP_BASE); #endif - offset = 0; + offset = 0; } -void -drawScreenCredits() +void drawScreenCredits() { - int i; + int i; - drawWidgetImage(image_backgorund); + drawWidgetImage(image_backgorund); - drawWidgetButton(button_back); + drawWidgetButton(button_back); - for (i = 0; i < listWidgetLabel->count; i++) { - int z; + for( i = 0 ; i < listWidgetLabel->count ; i++ ) + { + int z; - widget_t *this; - this = (widget_t *) listWidgetLabel->list[i]; + widget_t *this; + this = (widget_t *)listWidgetLabel->list[i]; + + z = this->y; + this->y += offset; - z = this->y; - this->y += offset; + if( this->y > SCREEN_CREDITS_OFFSET_MIN && this->y < SCREEN_CREDITS_OFFSET_MAX ) + { + drawWidgetLabel(this); + } - if (this->y > SCREEN_CREDITS_OFFSET_MIN - && this->y < SCREEN_CREDITS_OFFSET_MAX) { - drawWidgetLabel(this); - } - - this->y = z; - } + this->y = z; + } } -void -eventScreenCredits() +void eventScreenCredits() { - eventWidgetButton(button_back); - - offset -= SCREEN_CREDITS_OFFSET_SPEED; + eventWidgetButton(button_back); + + offset -= SCREEN_CREDITS_OFFSET_SPEED; - if (offset < SCREEN_CREDITS_OFFSET_RESTART) { - offset = 0; - } + if( offset < SCREEN_CREDITS_OFFSET_RESTART ) + { + offset = 0; + } - //printf("offset = %d\n", offset); + //printf("offset = %d\n", offset); } -void -stopScreenCredits() +void stopScreenCredits() { } -static void -eventWidget(void *p) +static void eventWidget(void *p) { - widget_t *button; - - button = (widget_t *) (p); - - if (button == button_back) { - setScreen("mainMenu"); - } + widget_t *button; + + button = (widget_t *)(p); + + if( button == button_back ) + { + setScreen("mainMenu"); + } } -void -initScreenCredits() +void initScreenCredits() { - image_t *image; - int i; - - image = getImage(IMAGE_GROUP_BASE, "screen_main"); - image_backgorund = newWidgetImage(0, 0, image); - - button_back = - newWidgetButton(_("back"), WINDOW_SIZE_X / 2 - WIDGET_BUTTON_WIDTH / 2, - WINDOW_SIZE_Y - 80, eventWidget); - - listWidgetLabel = newList(); - - if (tryExistFile(PATH_DOC SCREEN_CREDITS_FILE) == 0) { - creditExists = 1; - textFile = loadTextFile(PATH_DOC SCREEN_CREDITS_FILE); - for (i = 0; i < textFile->text->count; i++) { - widget_t *label; - char *line; - line = (char *) textFile->text->list[i]; - label = newWidgetLabel(line, WINDOW_SIZE_X / 2 - WINDOW_SIZE_X / 4, - (WINDOW_SIZE_Y - 100) + i * 20, - WIDGET_LABEL_LEFT); - - addList(listWidgetLabel, label); - } - } - else { - for (i = 0; i < 5; i++) { - creditExists = 0; - widget_t *label; - char line[STR_SIZE]; - sprintf(line, _("Credit file not found... %s/%s"), PATH_DOC, - SCREEN_CREDITS_FILE); - label = - newWidgetLabel(line, WINDOW_SIZE_X / 2, - (WINDOW_SIZE_Y - 100) + i * 20, - WIDGET_LABEL_CENTER); - - addList(listWidgetLabel, label); - } - } - - registerScreen(newScreen("credits", startScreenCredits, eventScreenCredits, - drawScreenCredits, stopScreenCredits)); + image_t *image; + int i; + + image = getImage(IMAGE_GROUP_BASE, "screen_main"); + image_backgorund = newWidgetImage(0, 0, image); + + button_back = newWidgetButton(_("back"), WINDOW_SIZE_X/2 -WIDGET_BUTTON_WIDTH/2, WINDOW_SIZE_Y-80, eventWidget); + + listWidgetLabel = newList(); + + if( tryExistFile(PATH_DOC SCREEN_CREDITS_FILE) == 0 ) + { + creditExists = 1; + textFile = loadTextFile(PATH_DOC SCREEN_CREDITS_FILE); + for( i = 0 ; i < textFile->text->count ; i++ ) + { + widget_t *label; + char *line; + line = (char *)textFile->text->list[i]; + label = newWidgetLabel(line, WINDOW_SIZE_X/2-WINDOW_SIZE_X/4, + (WINDOW_SIZE_Y-100)+i*20, WIDGET_LABEL_LEFT); + + addList(listWidgetLabel, label); + } + } + else + { + for( i = 0 ; i < 5 ; i++ ) + { + creditExists = 0; + widget_t *label; + char line[STR_SIZE]; + sprintf(line, _("Credit file not found... %s/%s"),PATH_DOC,SCREEN_CREDITS_FILE); + label = newWidgetLabel(line, WINDOW_SIZE_X/2, (WINDOW_SIZE_Y-100)+i*20, + WIDGET_LABEL_CENTER); + + addList(listWidgetLabel, label); + } + } + + registerScreen( newScreen("credits", startScreenCredits, eventScreenCredits, + drawScreenCredits, stopScreenCredits) ); } -void -quitScreenCredits() +void quitScreenCredits() { - destroyWidgetImage(image_backgorund); - - destroyWidgetButton(button_back); - destroyListItem(listWidgetLabel, destroyWidgetLabel); - if (creditExists) { - destroyTextFile(textFile); - } + destroyWidgetImage(image_backgorund); + + destroyWidgetButton(button_back); + destroyListItem(listWidgetLabel, destroyWidgetLabel); + if( creditExists ) + { + destroyTextFile(textFile); + } } + |