Changeset 336
- Timestamp:
- Feb 2, 2011, 6:43:38 PM (10 years ago)
- Location:
- trunk/monsterz
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/monsterz/title.cpp
r334 r336 56 56 }; 57 57 58 static int2 const animsize[] = 59 { 60 int2(384, 384), 61 int2(284, 81), 62 int2(38, 146), 63 int2(29, 137), 64 int2(284, 82), 65 int2(384, 384), 66 }; 67 68 static int2 const animpos[] = 69 { 70 int2(0, 0), 71 int2(65, 255), 72 int2(239, 168), 73 int2(248, 168), 74 int2(63, 255), 75 int2(0, 0), 76 }; 77 78 static int2 const eventsize[] = 79 { 80 int2(143, 16), 81 int2(68, 49), 82 int2(17, 29), 83 int2(50, 80), 84 int2(237, 238), 85 int2(59, 53), 86 int2(140, 15), 87 }; 88 89 static int2 const eventpos[] = 90 { 91 int2(0, 322), 92 int2(316, 286), 93 int2(246, 245), 94 int2(279, 173), 95 int2(42, 101), 96 int2(231, 154), 97 int2(0, 322), 98 }; 99 58 100 /* 59 101 * Public Title class … … 68 110 data->title = Tiler::Register(PNG_TITLE, 384, 384, 1.0f); 69 111 for (int n = 0; n < 6; n++) 70 data->anim[n] = Tiler::Register(PNG_TITLEANIM[n], 384, 384, 1.0f); 112 data->anim[n] = Tiler::Register(PNG_TITLEANIM[n], 113 animsize[n].x, animsize[n].y, 1.0f); 71 114 for (int n = 0; n < 7; n++) 72 data->event[n] = Tiler::Register(PNG_TITLEEVENT[n], 384, 384, 1.0f); 115 data->event[n] = Tiler::Register(PNG_TITLEEVENT[n], 116 eventsize[n].x, eventsize[n].y, 1.0f); 73 117 data->state = TitleData::IDLE; 74 118 data->period = TitleData::DAY; … … 187 231 Entity::TickDraw(deltams); 188 232 189 int tiler = data->title; 233 /* The background, always here. */ 234 int backid = (int)data->period; 235 Scene::GetDefault()->AddTile((data->title << 16) | backid, 24, 72, 1, 0); 236 237 /* Maybe an animation? */ 238 int tiler = 0; 190 239 int id = 0; 240 int2 pos; 191 241 192 242 switch (data->state) 193 243 { 194 244 case TitleData::IDLE: 195 id = (int)data->period;196 245 break; 197 246 case TitleData::ANIM: 198 247 tiler = data->anim[data->animid]; 248 pos = animpos[data->animid]; 249 pos.y = 384 - animsize[data->animid].y - pos.y; // Hack 199 250 id = data->nframes - 1 - (data->nframes * data->timer / data->length); 200 251 if (id < 0) id = 0; … … 203 254 case TitleData::EVENT: 204 255 tiler = data->event[data->animid]; 256 pos = eventpos[data->animid]; 257 pos.y = 384 - eventsize[data->animid].y - pos.y; // Hack 205 258 id = data->nframes - 1 - (data->nframes * data->timer / data->length); 206 259 if (id < 0) id = 0; … … 208 261 break; 209 262 } 210 211 Scene::GetDefault()->AddTile((tiler << 16) | id, 24, 72, 1, 0); 263 if (tiler) 264 Scene::GetDefault()->AddTile((tiler << 16) | id, 24 + pos.x, 72 + pos.y, 1, 0); 265 266 /* The logo, on top of the rest. */ 212 267 Scene::GetDefault()->AddTile((data->logo << 16) | 0, 26, 250, 2, 0); 213 268 }
Note: See TracChangeset
for help on using the changeset viewer.