Digimon World 3 decomp
The European version, SLES_039.36
Loading...
Searching...
No Matches
update_scroll_bar.inc.c
Go to the documentation of this file.
1/* The scroll bar's task: once its range and count are set, sizes the thumb,
2 then draws it each frame as a white rectangle at the list's place */
4 Layer *layer;
5 u_long *ot;
6 POLY_F4 *poly;
7 s32 range;
8#if VERSION_US
9 s32 pages;
10#endif
11
12 switch (bar->state) {
13 case TASK_INIT:
14 default:
15 if (bar->hasRange != 0 && bar->hasCount != 0) {
16#if VERSION_US
17 bar->nextState(bar);
18 pages = bar->count / bar->pageSize + (bar->count % bar->pageSize != 0);
19 range = (bar->bottom - bar->top) << 8;
20 bar->size = range / pages;
21 bar->posStep = range / bar->count;
22#elif VERSION_EU || VERSION_JP
23 /* the European and Japanese versions size the thumb for the visible items */
24 range = (bar->bottom - bar->top) << 8;
25 bar->size = range / bar->count * bar->pageSize;
26 bar->posStep = range / bar->count;
27 bar->nextState(bar);
28#endif
29 }
30 break;
31 case TASK_RUN:
32 layer = GFX.funcs.getLayer(bar->layer);
33 ot = layer->getOtEntry(layer, bar->depth);
34 poly = GFX.funcs.getPrim();
35 if (bar->pos < bar->count - 1) {
36 bar->y = bar->top + ((bar->pos * bar->posStep) >> 8);
37 if (bar->bottom - (bar->size >> 8) < bar->y) {
38 bar->y = bar->bottom - (bar->size >> 8);
39 }
40 } else {
41 bar->y = bar->bottom - (bar->size >> 8);
42 }
43 setlen(poly, 5);
44 poly->code = 0x28;
45 poly->r0 = poly->g0 = poly->b0 = 0xFF;
46 poly->x0 = poly->x2 = bar->x;
47 poly->x1 = poly->x3 = bar->x + bar->width;
48 poly->y0 = poly->y1 = bar->y;
49 poly->y2 = poly->y3 = bar->y + (bar->size >> 8);
50 addPrim(ot, poly);
51 GFX.funcs.setPrim(poly + 1);
52 break;
53 case TASK_DONE:
54 case TASK_KILL:
55 break;
56 }
57}
#define OVL_NAME(name)
The name of this overlay's copy of a function of src/shared/.
Definition battle_mode.h:26
signed int s32
Definition common.h:11
GfxState GFX
GFX: the graphics state and its methods.
Definition display.c:209
#define TASK_RUN
Definition task.h:35
#define TASK_KILL
Definition task.h:37
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
Definition task.h:34
#define TASK_DONE
Definition task.h:36
void *(* getPrim)(void)
Definition gfx.h:19
struct Layer *(* getLayer)(s32 id)
Definition gfx.h:28
void(* setPrim)(void *next)
Definition gfx.h:20
GfxFuncs funcs
Definition gfx.h:77
A drawing layer (GFX.funcs.createLayer): a DRAWENV with a pair of ordering tables,...
Definition gfx.h:128
u_long *(* getOtEntry)(struct Layer *, s32 depth)
Definition gfx.h:155
A vertical scroll bar, as the menu overlays (STSTATUS, STGDGLAB) draw one.
Definition menu.h:38
void updateScrollBar(ScrollBar *bar)
The scroll bar's task: once its range and count are set, sizes the thumb, then draws it each frame as...