a6eef2ff4d8d42063f9bca6148453302948f8f94.svn-base (17609B)
1 #include "Level.h" 2 3 Actor* FindRef(std::vector<ActorName*> refs, char* name) 4 { 5 for (int i = 0; i < (int)refs.size(); i++) 6 { 7 if (strcmp(refs.at(i)->name, name) == false) 8 { 9 return refs.at(i)->act; 10 } 11 } 12 13 return NULL; 14 } 15 16 bool Level::LoadWorld(cJSON* level) 17 { 18 cJSON* world = cJSON_GetObjectItem(level, "world"); 19 mHeight = cJSON_GetObjectItem(world, "world_h")->valueint; 20 mWidth = cJSON_GetObjectItem(world, "world_w")->valueint; 21 22 23 24 char * ter = cJSON_GetObjectItem(world, "terrain")->valuestring; 25 mColMap = LoadSurfaceBMP(ter); 26 27 cJSON* backs = cJSON_GetObjectItem(world, "backgrounds"); 28 for (int i = 0; i < cJSON_GetArraySize(backs); i++) 29 { 30 cJSON* layer = cJSON_GetArrayItem(backs, i); 31 char* back = cJSON_GetObjectItem(layer, "back")->valuestring; 32 33 SDL_Texture* back_tex = SDL_CreateTextureFromSurface(mRen, LoadSurfaceBMP(back)); 34 int alpha = cJSON_GetObjectItem(layer, "alpha")->valueint; 35 36 if (alpha != 0) 37 { 38 SDL_SetTextureAlphaMod(back_tex, alpha); 39 } 40 41 mBack.push_back(back_tex); 42 43 float p_factor = (float)cJSON_GetObjectItem(layer, "parallax_factor")->valueint; 44 mParallax_back.push_back(p_factor); 45 } 46 47 cJSON* fores = cJSON_GetObjectItem(world, "foregrounds"); 48 for (int i = 0; i < cJSON_GetArraySize(fores); i++) 49 { 50 cJSON* layer = cJSON_GetArrayItem(fores, i); 51 char* fore = cJSON_GetObjectItem(layer, "fore")->valuestring; 52 53 SDL_Texture* fore_tex = SDL_CreateTextureFromSurface(mRen, LoadSurfaceBMP(fore)); 54 int alpha = cJSON_GetObjectItem(layer, "alpha")->valueint; 55 56 if (alpha != 0) 57 { 58 SDL_SetTextureAlphaMod(fore_tex, alpha); 59 } 60 61 mFore.push_back(fore_tex); 62 } 63 64 cJSON* overs = cJSON_GetObjectItem(world, "overlays"); 65 for (int i = 0; i < cJSON_GetArraySize(overs); i++) 66 { 67 cJSON* layer = cJSON_GetArrayItem(overs, i); 68 char* overs = cJSON_GetObjectItem(layer, "over")->valuestring; 69 70 SDL_Texture* over_tex = SDL_CreateTextureFromSurface(mRen, LoadSurfaceBMP(overs)); 71 int alpha = cJSON_GetObjectItem(layer, "alpha")->valueint; 72 73 if (alpha != 0) 74 { 75 SDL_SetTextureAlphaMod(over_tex, alpha); 76 } 77 78 mOver.push_back(over_tex); 79 80 float p_factor = (float)cJSON_GetObjectItem(layer, "parallax_factor")->valueint; 81 mParallax_over.push_back(p_factor); 82 } 83 return true; 84 } 85 86 bool Level::LoadCamera(cJSON* level) 87 { 88 cJSON* camera = cJSON_GetObjectItem(level, "camera"); 89 int camx = cJSON_GetObjectItem(camera, "x")->valueint; 90 int camy = cJSON_GetObjectItem(camera, "y")->valueint; 91 int camh = cJSON_GetObjectItem(camera, "h")->valueint; 92 int camw = cJSON_GetObjectItem(camera, "w")->valueint; 93 94 mCam = Camera(camh, camw, camx, camy, mHeight, mWidth); 95 96 cJSON* blockers = cJSON_GetObjectItem(camera, "blockers"); 97 98 for (int i = 0; i < cJSON_GetArraySize(blockers); i++) 99 { 100 cJSON* blocker = cJSON_GetArrayItem(blockers, i); 101 SDL_Rect* r = new SDL_Rect; 102 r->h = cJSON_GetObjectItem(blocker, "h")->valueint; 103 r->w = cJSON_GetObjectItem(blocker, "w")->valueint; 104 r->x = cJSON_GetObjectItem(blocker, "x")->valueint; 105 r->y = cJSON_GetObjectItem(blocker, "y")->valueint; 106 107 mCam.LogBlocker(r); 108 } 109 110 return true; 111 } 112 113 bool Level::LoadAnimations(cJSON* level) 114 { 115 cJSON* animations = cJSON_GetObjectItem(level, "animations"); 116 mAnim_names = (char**)malloc(cJSON_GetArraySize(animations) * sizeof(char*)); 117 for (int i = 0; i < cJSON_GetArraySize(animations); i++) 118 { 119 cJSON* anim_pack = cJSON_GetArrayItem(animations, i); 120 mAnim_names[i] = cJSON_GetObjectItem(anim_pack, "pack_name")->valuestring; 121 //gCons->ConsPrintf("Animation Pack Name: %s\n", anim_names[i]); 122 123 cJSON* frame_size = cJSON_GetObjectItem(anim_pack, "frame_size"); 124 int h = cJSON_GetObjectItem(frame_size, "h")->valueint; 125 int w = cJSON_GetObjectItem(frame_size, "w")->valueint; 126 127 cJSON* col_data = cJSON_GetObjectItem(anim_pack, "col_data"); 128 int off_x = cJSON_GetObjectItem(col_data, "off_x")->valueint; 129 int off_y = cJSON_GetObjectItem(col_data, "off_y")->valueint; 130 int col_h = cJSON_GetObjectItem(col_data, "col_h")->valueint; 131 int col_w = cJSON_GetObjectItem(col_data, "col_w")->valueint; 132 133 cJSON* anim_set = cJSON_GetObjectItem(anim_pack, "anim_set"); 134 135 FrameSet* frame_data = (FrameSet*)malloc(cJSON_GetArraySize(anim_set) * sizeof(FrameSet)); 136 int* Index = (int*)malloc(cJSON_GetArraySize(anim_set) * sizeof(int)); 137 138 for (int j = 0; j < cJSON_GetArraySize(anim_set); j++) 139 { 140 cJSON* anim = cJSON_GetArrayItem(anim_set, j); 141 char* filename = cJSON_GetObjectItem(anim, "filename")->valuestring; 142 int frame_count = cJSON_GetObjectItem(anim, "frame_count")->valueint; 143 int frame_rate = cJSON_GetObjectItem(anim, "frame_rate")->valueint; 144 //int h = cJSON_GetObjectItem(anim, "h")->valueint; 145 //int w = cJSON_GetObjectItem(anim, "w")->valueint; 146 char* id_str = cJSON_GetObjectItem(anim, "id")->valuestring; 147 148 int id = ConvertStringToSymbol(id_str); 149 //gCons->ConsPrintf("image source path: %s\n", filename); 150 frame_data[j] = FrameSet(mRen, filename, frame_count, frame_rate, h, w); 151 Index[j] = id; 152 } 153 AnimDataPack* pack = new AnimDataPack(cJSON_GetArraySize(anim_set), frame_data, Index); 154 pack->SetColData(off_x, off_y, col_h, col_w); 155 mAnimData.push_back(pack); 156 157 158 LoadAnimGraph(anim_pack); 159 } 160 161 return true; 162 } 163 164 bool Level::LoadAnimGraph(cJSON* anim_pack) 165 { 166 AnimGraphData* anim_g = new AnimGraphData( *mAnimData.back() ); 167 168 cJSON* loop_ids = cJSON_GetObjectItem(anim_pack, "loop_ids"); 169 for (int i = 0; i < (int)cJSON_GetArraySize(loop_ids); i++) 170 { 171 int id = ConvertStringToSymbol(cJSON_GetArrayItem(loop_ids, i)->valuestring); 172 anim_g->DefineLoop(id); 173 } 174 anim_g->CreateTranisitionMatrix(); 175 176 cJSON* transition_ids = cJSON_GetObjectItem(anim_pack, "transition_ids"); 177 for (int i = 0; i < (int)cJSON_GetArraySize(transition_ids); i++) 178 { 179 int id = ConvertStringToSymbol(cJSON_GetArrayItem(transition_ids, i)->valuestring); 180 anim_g->DefineTransitions(id); 181 } 182 183 cJSON* anim_graph = cJSON_GetObjectItem(anim_pack, "anim_graph"); 184 for (int i = 0; i < (int)cJSON_GetArraySize(anim_graph); i++) 185 { 186 cJSON* loop = cJSON_GetArrayItem(anim_graph, i); 187 char* loop_name = cJSON_GetObjectItem(loop, "loop_name")->valuestring; 188 int init_id = ConvertStringToSymbol(loop_name); 189 190 cJSON* transitions = cJSON_GetObjectItem(loop, "transitions"); 191 for(int j = 0; j < (int)cJSON_GetArraySize(transitions); j++) 192 { 193 char* transition = cJSON_GetArrayItem(transitions, j)->valuestring; 194 int trans_id = ConvertStringToSymbol(transition); 195 196 int target_id = anim_g->GetLoopIDIndex(j); 197 198 anim_g->PopulateTransitionMatrix(init_id, target_id, trans_id); 199 } 200 } 201 mAnimGraphs.push_back(anim_g); 202 203 return false; 204 } 205 206 bool Level::LoadActors(cJSON* level) 207 { 208 cJSON* actors = cJSON_GetObjectItem(level, "actors"); 209 std::vector<ActorName*> ActorRefs; 210 211 mAHM = ActorHandleManager(); 212 mSpatMon = SpatialMonitor(mHeight, mWidth, &mAHM); 213 214 for (int i = 0; i < cJSON_GetArraySize(actors); i++) 215 { 216 cJSON* act = cJSON_GetArrayItem(actors, i); 217 218 char* anim_pack = cJSON_GetObjectItem(act, "anim_pack")->valuestring; 219 //gCons->ConsPrintf("sought set name: %s\n", anim_pack); 220 221 AnimGraph* actor_pack = NULL; 222 for (int j = 0; j < (int)mAnimData.size(); j++) 223 { 224 if (!strcmp(anim_pack, mAnim_names[j])) 225 { 226 actor_pack = new AnimGraph(mAnimGraphs.at(j)); 227 } 228 } 229 #ifdef DEBUG 230 assert(actor_pack != NULL); 231 #endif 232 233 234 SDL_Rect PosRect; 235 PosRect.x = cJSON_GetObjectItem(act, "x")->valueint; 236 PosRect.y = cJSON_GetObjectItem(act, "y")->valueint; 237 PosRect.h = actor_pack->GetAnimPack()->GetAnimData()->GetCol_h(); 238 PosRect.w = actor_pack->GetAnimPack()->GetAnimData()->GetCol_w(); 239 SDL_Rect DrawRect; 240 DrawRect.x = actor_pack->GetAnimPack()->GetAnimData()->GetOff_x(); 241 DrawRect.y = actor_pack->GetAnimPack()->GetAnimData()->GetOff_y(); 242 DrawRect.h = actor_pack->GetH(); 243 DrawRect.w = actor_pack->GetW(); 244 245 ActorName* ref = new ActorName; 246 ref->name = cJSON_GetObjectItem(act, "name")->valuestring; 247 248 char* type = cJSON_GetObjectItem(act, "type")->valuestring; 249 if (!strcmp(type, "player")) 250 { 251 Player* actor = new Player(mColMap, actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); //needs a delete 252 ref->act = actor; 253 mInput->mFeed.Subscribe(actor); 254 255 256 mCam.SetFollowTarget(actor); 257 mCast.push_back(actor); 258 mPlayer = actor; 259 260 AnimGraph* hat_pack = NULL; 261 for (int j = 0; j < (int)mAnimData.size(); j++) 262 { 263 if (!strcmp("sword", mAnim_names[j])) 264 { 265 hat_pack = new AnimGraph(mAnimGraphs.at(j)); 266 } 267 } 268 actor->SetSword(actor->AttachHat(new sword(hat_pack, actor, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib))); 269 } 270 else if (!strcmp(type, "test_blocker")) 271 { 272 Test_Blocker* actor = new Test_Blocker(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); 273 ref->act = actor; 274 //mSpatMon.LogActor(*actor); 275 mCast.push_back(actor); 276 } 277 else if (!strcmp(type, "gate")) //Gate is a multiactor entity. 278 { 279 int dir = ConvertStringToSymbol(cJSON_GetObjectItem(act, "dir")->valuestring); 280 Gate* actor = new Gate(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, dir); 281 //mSpatMon.LogActor(*actor); 282 mCast.push_back(actor); 283 actor_pack->mFeed.Subscribe(actor); 284 285 AnimGraph* winch_pack = NULL; 286 for (int j = 0; j < (int)mAnimData.size(); j++) 287 { 288 if (!strcmp("winch", mAnim_names[j])) 289 { 290 winch_pack = new AnimGraph(mAnimGraphs.at(j)); 291 } 292 } 293 PosRect.h = winch_pack->GetAnimPack()->GetAnimData()->GetCol_h(); 294 PosRect.w = winch_pack->GetAnimPack()->GetAnimData()->GetCol_w(); 295 PosRect.y -= 29; 296 if (dir == LEFT) 297 { 298 PosRect.x += 7; 299 } 300 else //dir == right 301 { 302 PosRect.x -= (21); 303 } 304 305 DrawRect.x = winch_pack->GetAnimPack()->GetAnimData()->GetOff_x(); 306 DrawRect.y = winch_pack->GetAnimPack()->GetAnimData()->GetOff_y(); 307 DrawRect.h = winch_pack->GetH(); 308 DrawRect.w = winch_pack->GetW(); 309 Winch* actor2 = new Winch(winch_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, actor, dir); 310 ref->act = actor2; //Gate ref refers to the paired winch because its more useful 311 actor2->mFeed.Subscribe(actor); 312 //mSpatMon.LogActor(*actor2); 313 mCast.push_back(actor2); 314 } 315 else if (!strcmp(type, "gateman")) //Gateman must be attached to a gate. currently hardcoded to actor name "gate0" 316 { 317 Gateman* actor = new Gateman(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, cJSON_GetObjectItem(act, "lines")->valuestring, FindRef(ActorRefs, "gate0")->GetHandle()); 318 ref->act = actor; 319 //mSpatMon.LogActor(*actor); 320 mCast.push_back(actor); 321 } 322 else if (!strcmp(type, "talker")) 323 { 324 Talker* actor = new Talker(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, cJSON_GetObjectItem(act, "lines")->valuestring); 325 ref->act = actor; 326 //mSpatMon.LogActor(*actor); 327 mCast.push_back(actor); 328 } 329 else if (!strcmp(type, "door")) 330 { 331 int x_off = cJSON_GetObjectItem(act, "x_off")->valueint; 332 int y_off = cJSON_GetObjectItem(act, "y_off")->valueint; 333 Door* actor = new Door(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, x_off, y_off); 334 ref->act = actor; 335 PosRect.x = cJSON_GetObjectItem(act, "x2")->valueint; 336 PosRect.y = cJSON_GetObjectItem(act, "y2")->valueint; 337 Door* actor2 = new Door(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, x_off, y_off); 338 actor->SetTeleDest(actor2->GetTelePos()); 339 actor2->SetTeleDest(actor->GetTelePos()); 340 SDL_Rect* r = new SDL_Rect; 341 r->h = 0; 342 r->w = 0; 343 r->x = 100; 344 r->y = 100; 345 //actor->SetTeleDest(r); 346 //mSpatMon.LogActor(*actor); 347 //mSpatMon.LogActor(*actor2); 348 mCast.push_back(actor); 349 mCast.push_back(actor2); 350 } 351 else if (!strcmp(type, "pursuer")) 352 { 353 Pursuer* actor = new Pursuer(mColMap, actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); 354 ref->act = actor; 355 //mSpatMon.LogActor(*actor); 356 mCast.push_back(actor); 357 } 358 else if (!strcmp(type, "wanderer")) 359 { 360 Wanderer* actor = new Wanderer(mColMap, actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); 361 ref->act = actor; 362 //mSpatMon.LogActor(*actor); 363 mCast.push_back(actor); 364 } 365 else if (!strcmp(type, "rabbit")) 366 { 367 Rabbit* actor = new Rabbit(mColMap, actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); 368 ref->act = actor; 369 //mSpatMon.LogActor(*actor); 370 mCast.push_back(actor); 371 } 372 else 373 { 374 gCons->ConsPrintf("Failed to load actor: %s is an unrecognized actor type\n", type); 375 } 376 ActorRefs.push_back(ref); 377 } 378 379 return true; 380 } 381 382 bool Level::LoadParticles(cJSON* level) 383 { 384 cJSON* particles = cJSON_GetObjectItem(level, "particles"); 385 for (int i = 0; i < cJSON_GetArraySize(particles); i++) 386 { 387 cJSON* prt = cJSON_GetArrayItem(particles, i); 388 389 char* anim_pack = cJSON_GetObjectItem(prt, "anim_pack")->valuestring; 390 //gCons->ConsPrintf("sought set name: %s\n", anim_pack); 391 392 //AnimDataPack* particle_anims = NULL; 393 AnimGraph* particle_anims = NULL; 394 for (int j = 0; j < (int)mAnimData.size(); j++) 395 { 396 //gCons->ConsPrintf("stored set name: %s\n", anim_names[j]); 397 if (!strcmp(anim_pack, mAnim_names[j])) 398 { 399 particle_anims = new AnimGraph(mAnimGraphs.at(j)); 400 } 401 } 402 #ifdef DEBUG 403 assert(particle_anims != NULL); 404 #endif 405 int prth = particle_anims->GetH(); 406 int prtw = particle_anims->GetW(); 407 408 ParticleData* pd = new ParticleData; 409 pd->AnimData = particle_anims; 410 pd->Height = prth; 411 pd->Width = prtw; 412 pd->spat = &mSpatMon; 413 414 mPrtLib.LogParticleData(pd, anim_pack); 415 return true; 416 } 417 return false; 418 } 419 420 bool Level::LoadSounds(cJSON* level) 421 { 422 cJSON* sounds = cJSON_GetObjectItem(level, "sounds"); 423 424 for (int i = 0; i < cJSON_GetArraySize(sounds); i++) 425 { 426 cJSON* sound = cJSON_GetArrayItem(sounds, i); 427 char* fname = cJSON_GetObjectItem(sound, "filename")->valuestring; 428 char* name = cJSON_GetObjectItem(sound, "name" )->valuestring; 429 int vol = cJSON_GetObjectItem(sound, "vol" )->valueint; 430 431 Mix_Chunk* snd = new Mix_Chunk; 432 snd = LoadSound(fname); 433 Mix_VolumeChunk(snd, vol); 434 435 mSoundLib.LogSoundData(snd, name); 436 } 437 438 cJSON* sound_regions = cJSON_GetObjectItem(level, "sound_regions"); 439 440 for (int i = 0; i < cJSON_GetArraySize(sound_regions); i++) 441 { 442 cJSON* region = cJSON_GetArrayItem(sound_regions, i); 443 SDL_Rect reg_rect; 444 reg_rect.x = cJSON_GetObjectItem(region, "x")->valueint; 445 reg_rect.y = cJSON_GetObjectItem(region, "y")->valueint; 446 reg_rect.h = cJSON_GetObjectItem(region, "h")->valueint; 447 reg_rect.w = cJSON_GetObjectItem(region, "w")->valueint; 448 449 RegionSound* rs = mSoundLib.SpawnRegionSound(reg_rect); 450 451 cJSON* tracks = cJSON_GetObjectItem(region, "tracks"); 452 for (int j = 0; j < cJSON_GetArraySize(tracks); j++) 453 { 454 char* track = cJSON_GetArrayItem(tracks, j)->valuestring; 455 rs->LogTrack(mSoundLib.GetSoundData(track)); 456 } 457 } 458 459 return false; 460 } 461 462 bool Level::LoadHud(cJSON* level) 463 { 464 cJSON* texs = cJSON_GetObjectItem(level, "hud_textures"); 465 466 //Load LifeMeter Widget 467 char* life_base = cJSON_GetObjectItem(texs, "life_base")->valuestring; 468 char* life_bar = cJSON_GetObjectItem(texs, "life_bar" )->valuestring; 469 470 SDL_Rect LifePos; 471 LifePos.h = 15; 472 LifePos.w = 250; 473 LifePos.x = 25; 474 LifePos.y = 25; 475 mHUD.LogWidget( new LifeMeter(mPlayer, LifePos, mRen, life_base, life_bar) ); 476 // 477 478 //Load Fader widget 479 char* black = cJSON_GetObjectItem(texs, "fader")->valuestring; 480 481 Fader* f = new Fader(mRen, black); 482 mPlayer->mFeed.Subscribe(f); 483 mHUD.LogWidget(f); 484 // 485 486 //Load Dialogue Widget 487 char* text_box = cJSON_GetObjectItem(texs, "text_box")->valuestring; 488 489 SDL_Rect DialoguePos; 490 DialoguePos.h = 0; 491 DialoguePos.w = 0; 492 DialoguePos.x = 300; 493 DialoguePos.y = 200; 494 495 SDL_Color fg = {0,0,0}; 496 497 Dialogue* d = new Dialogue(DialoguePos, mRen, "Tapestry.ttf", text_box, fg, mPlayer); 498 mPlayer->mFeed.Subscribe(d); 499 500 mHUD.LogWidget(d); 501 // 502 503 return true; 504 } 505 506 bool Level::Load(const char* filename) 507 { 508 cJSON* root = LoadJSON(filename); 509 //PrintJSON(root); 510 cJSON* level = cJSON_GetObjectItem(root, "level"); 511 512 LoadWorld(level); 513 514 LoadCamera(level); 515 516 gDiagDraw = new DiagnosticDraw(mRen, mCam); 517 518 LoadAnimations(level); 519 520 LoadActors(level); 521 522 LoadParticles(level); 523 524 LoadSounds(level); 525 526 LoadHud(level); 527 528 // int cells[9]; 529 530 // mSpatMon.GetAdjacentCells(36, cells); 531 532 return true; 533 } 534 535 bool Level::Update() 536 { 537 ///Update Actors 538 for (int i = 0; i < (int)(mCast.size()); i++) 539 { 540 mCast.at(i)->ActorUpdate(); 541 } 542 ///Update Particles 543 for (int i = 0; i < (int)(mPrtLib.GetParticles()->size()); i++) 544 { 545 mPrtLib.GetParticles()->at(i)->ActorUpdate(); 546 } 547 548 ///Draw HUD 549 mHUD.UpdateWidgets(); 550 551 mCam.ActorFollow(mRen, 150, 75); 552 553 ///Draw Backgrounds 554 for (int i = 0; i < (int)mBack.size(); i++) 555 { 556 DrawParallax(mRen, mBack.at(i), mCam, mParallax_back.at(i), mHeight, mWidth); 557 } 558 ///Draw Foregrounds 559 for (int i = 0; i < (int)mFore.size(); i++) 560 { 561 SDL_RenderCopy(mRen, mFore.at(i), mCam.GetCamView(), NULL); 562 } 563 564 ///Draw Actors 565 for (int i = 0; i < (int)mCast.size(); i++) 566 { 567 DrawActor(mRen, *mCast.at(i), mCam); 568 } 569 570 ///Draw Particles 571 for (int i = 0; i < (int)(mPrtLib.GetParticles()->size()); i++) 572 { 573 DrawActor(mRen, *mPrtLib.GetParticles()->at(i), mCam); 574 } 575 576 ///Draw overlays 577 for (int l = 0; l < (int)mOver.size(); l++) 578 { 579 DrawParallax(mRen, mOver.at(l), mCam, mParallax_over.at(l), mHeight, mWidth); 580 } 581 582 mHUD.DrawWidgets(); 583 584 ///Play Sounds 585 mSoundLib.UpdateRegionSounds(mPlayer->GetPosition()); 586 mSoundLib.UpdatePointSounds(mCam.GetCenterX(), mCam.GetCenterY()); 587 588 //gCons->ConsPrintf("%d channels are playing\n", Mix_Playing(-1)); 589 590 ///Draw Diagnositic rectangles 591 gDiagDraw->Update(); 592 593 return true; 594 } 595 596 bool Level::EventProcess(Event eve) 597 { 598 return true; 599 }