4573d1ecce77d7260c4f05d50d4e37626317b37d.svn-base (17515B)
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 mSpatMon = SpatialMonitor(mHeight, mWidth); 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 213 for (int i = 0; i < cJSON_GetArraySize(actors); i++) 214 { 215 cJSON* act = cJSON_GetArrayItem(actors, i); 216 217 char* anim_pack = cJSON_GetObjectItem(act, "anim_pack")->valuestring; 218 //gCons->ConsPrintf("sought set name: %s\n", anim_pack); 219 220 AnimGraph* actor_pack = NULL; 221 for (int j = 0; j < (int)mAnimData.size(); j++) 222 { 223 if (!strcmp(anim_pack, mAnim_names[j])) 224 { 225 actor_pack = new AnimGraph(mAnimGraphs.at(j)); 226 } 227 } 228 #ifdef DEBUG 229 assert(actor_pack != NULL); 230 #endif 231 232 233 SDL_Rect PosRect; 234 PosRect.x = cJSON_GetObjectItem(act, "x")->valueint; 235 PosRect.y = cJSON_GetObjectItem(act, "y")->valueint; 236 PosRect.h = actor_pack->GetAnimPack()->GetAnimData()->GetCol_h(); 237 PosRect.w = actor_pack->GetAnimPack()->GetAnimData()->GetCol_w(); 238 SDL_Rect DrawRect; 239 DrawRect.x = actor_pack->GetAnimPack()->GetAnimData()->GetOff_x(); 240 DrawRect.y = actor_pack->GetAnimPack()->GetAnimData()->GetOff_y(); 241 DrawRect.h = actor_pack->GetH(); 242 DrawRect.w = actor_pack->GetW(); 243 244 ActorName* ref = new ActorName; 245 ref->name = cJSON_GetObjectItem(act, "name")->valuestring; 246 247 char* type = cJSON_GetObjectItem(act, "type")->valuestring; 248 if (!strcmp(type, "player")) 249 { 250 Player* actor = new Player(mColMap, actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); //needs a delete 251 ref->act = actor; 252 mSpatMon.LogActor(*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")) 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 //ref->act = actor; Gate ref refers to the paired winch because its more useful 282 mSpatMon.LogActor(*actor); 283 mCast.push_back(actor); 284 actor_pack->mFeed.Subscribe(actor); 285 286 AnimGraph* winch_pack = NULL; 287 for (int j = 0; j < (int)mAnimData.size(); j++) 288 { 289 if (!strcmp("winch", mAnim_names[j])) 290 { 291 winch_pack = new AnimGraph(mAnimGraphs.at(j)); 292 } 293 } 294 PosRect.h = winch_pack->GetAnimPack()->GetAnimData()->GetCol_h(); 295 PosRect.w = winch_pack->GetAnimPack()->GetAnimData()->GetCol_w(); 296 PosRect.y -= 29; 297 if (dir == LEFT) 298 { 299 PosRect.x += 7; 300 } 301 else //dir == right 302 { 303 PosRect.x -= (21); 304 } 305 306 DrawRect.x = winch_pack->GetAnimPack()->GetAnimData()->GetOff_x(); 307 DrawRect.y = winch_pack->GetAnimPack()->GetAnimData()->GetOff_y(); 308 DrawRect.h = winch_pack->GetH(); 309 DrawRect.w = winch_pack->GetW(); 310 Winch* actor2 = new Winch(winch_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, actor, dir); 311 ref->act = actor2; 312 actor2->mFeed.Subscribe(actor); 313 mSpatMon.LogActor(*actor2); 314 mCast.push_back(actor2); 315 } 316 else if (!strcmp(type, "gateman")) 317 { 318 Gateman* actor = new Gateman(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, cJSON_GetObjectItem(act, "lines")->valuestring, FindRef(ActorRefs, "gate0")->GetHandle()); 319 ref->act = actor; 320 mSpatMon.LogActor(*actor); 321 mCast.push_back(actor); 322 } 323 else if (!strcmp(type, "talker")) 324 { 325 Talker* actor = new Talker(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, cJSON_GetObjectItem(act, "lines")->valuestring); 326 ref->act = actor; 327 mSpatMon.LogActor(*actor); 328 mCast.push_back(actor); 329 } 330 else if (!strcmp(type, "door")) 331 { 332 int x_off = cJSON_GetObjectItem(act, "x_off")->valueint; 333 int y_off = cJSON_GetObjectItem(act, "y_off")->valueint; 334 Door* actor = new Door(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, x_off, y_off); 335 ref->act = actor; 336 PosRect.x = cJSON_GetObjectItem(act, "x2")->valueint; 337 PosRect.y = cJSON_GetObjectItem(act, "y2")->valueint; 338 Door* actor2 = new Door(actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib, x_off, y_off); 339 actor->SetTeleDest(actor2->GetTelePos()); 340 actor2->SetTeleDest(actor->GetTelePos()); 341 SDL_Rect* r = new SDL_Rect; 342 r->h = 0; 343 r->w = 0; 344 r->x = 100; 345 r->y = 100; 346 //actor->SetTeleDest(r); 347 mSpatMon.LogActor(*actor); 348 mSpatMon.LogActor(*actor2); 349 mCast.push_back(actor); 350 mCast.push_back(actor2); 351 } 352 else if (!strcmp(type, "pursuer")) 353 { 354 Pursuer* actor = new Pursuer(mColMap, actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); 355 ref->act = actor; 356 mSpatMon.LogActor(*actor); 357 mCast.push_back(actor); 358 } 359 else if (!strcmp(type, "wanderer")) 360 { 361 Wanderer* actor = new Wanderer(mColMap, actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); 362 ref->act = actor; 363 mSpatMon.LogActor(*actor); 364 mCast.push_back(actor); 365 } 366 else if (!strcmp(type, "rabbit")) 367 { 368 Rabbit* actor = new Rabbit(mColMap, actor_pack, PosRect, DrawRect, &mAHM, &mSpatMon, &mPrtLib, &mSoundLib); 369 ref->act = actor; 370 mSpatMon.LogActor(*actor); 371 mCast.push_back(actor); 372 } 373 else 374 { 375 gCons->ConsPrintf("Failed to load actor: %s is an unrecognized actor type\n", type); 376 } 377 ActorRefs.push_back(ref); 378 } 379 380 return true; 381 } 382 383 bool Level::LoadParticles(cJSON* level) 384 { 385 cJSON* particles = cJSON_GetObjectItem(level, "particles"); 386 for (int i = 0; i < cJSON_GetArraySize(particles); i++) 387 { 388 cJSON* prt = cJSON_GetArrayItem(particles, i); 389 390 char* anim_pack = cJSON_GetObjectItem(prt, "anim_pack")->valuestring; 391 //gCons->ConsPrintf("sought set name: %s\n", anim_pack); 392 393 //AnimDataPack* particle_anims = NULL; 394 AnimGraph* particle_anims = NULL; 395 for (int j = 0; j < (int)mAnimData.size(); j++) 396 { 397 //gCons->ConsPrintf("stored set name: %s\n", anim_names[j]); 398 if (!strcmp(anim_pack, mAnim_names[j])) 399 { 400 particle_anims = new AnimGraph(mAnimGraphs.at(j)); 401 } 402 } 403 #ifdef DEBUG 404 assert(particle_anims != NULL); 405 #endif 406 int prth = particle_anims->GetH(); 407 int prtw = particle_anims->GetW(); 408 409 ParticleData* pd = new ParticleData; 410 pd->AnimData = particle_anims; 411 pd->Height = prth; 412 pd->Width = prtw; 413 pd->spat = &mSpatMon; 414 415 mPrtLib.LogParticleData(pd, anim_pack); 416 return true; 417 } 418 return false; 419 } 420 421 bool Level::LoadSounds(cJSON* level) 422 { 423 cJSON* sounds = cJSON_GetObjectItem(level, "sounds"); 424 425 for (int i = 0; i < cJSON_GetArraySize(sounds); i++) 426 { 427 cJSON* sound = cJSON_GetArrayItem(sounds, i); 428 char* fname = cJSON_GetObjectItem(sound, "filename")->valuestring; 429 char* name = cJSON_GetObjectItem(sound, "name" )->valuestring; 430 int vol = cJSON_GetObjectItem(sound, "vol" )->valueint; 431 432 Mix_Chunk* snd = new Mix_Chunk; 433 snd = LoadSound(fname); 434 Mix_VolumeChunk(snd, vol); 435 436 mSoundLib.LogSoundData(snd, name); 437 } 438 439 cJSON* sound_regions = cJSON_GetObjectItem(level, "sound_regions"); 440 441 for (int i = 0; i < cJSON_GetArraySize(sound_regions); i++) 442 { 443 cJSON* region = cJSON_GetArrayItem(sound_regions, i); 444 SDL_Rect reg_rect; 445 reg_rect.x = cJSON_GetObjectItem(region, "x")->valueint; 446 reg_rect.y = cJSON_GetObjectItem(region, "y")->valueint; 447 reg_rect.h = cJSON_GetObjectItem(region, "h")->valueint; 448 reg_rect.w = cJSON_GetObjectItem(region, "w")->valueint; 449 450 RegionSound* rs = mSoundLib.SpawnRegionSound(reg_rect); 451 452 cJSON* tracks = cJSON_GetObjectItem(region, "tracks"); 453 for (int j = 0; j < cJSON_GetArraySize(tracks); j++) 454 { 455 char* track = cJSON_GetArrayItem(tracks, j)->valuestring; 456 rs->LogTrack(mSoundLib.GetSoundData(track)); 457 } 458 } 459 460 return false; 461 } 462 463 bool Level::LoadHud(cJSON* level) 464 { 465 cJSON* texs = cJSON_GetObjectItem(level, "hud_textures"); 466 467 //Load LifeMeter Widget 468 char* life_base = cJSON_GetObjectItem(texs, "life_base")->valuestring; 469 char* life_bar = cJSON_GetObjectItem(texs, "life_bar" )->valuestring; 470 471 SDL_Rect LifePos; 472 LifePos.h = 15; 473 LifePos.w = 250; 474 LifePos.x = 25; 475 LifePos.y = 25; 476 mHUD.LogWidget( new LifeMeter(mPlayer, LifePos, mRen, life_base, life_bar) ); 477 // 478 479 //Load Fader widget 480 char* black = cJSON_GetObjectItem(texs, "fader")->valuestring; 481 482 Fader* f = new Fader(mRen, black); 483 mPlayer->mFeed.Subscribe(f); 484 mHUD.LogWidget(f); 485 // 486 487 //Load Dialogue Widget 488 char* text_box = cJSON_GetObjectItem(texs, "text_box")->valuestring; 489 490 SDL_Rect DialoguePos; 491 DialoguePos.h = 0; 492 DialoguePos.w = 0; 493 DialoguePos.x = 300; 494 DialoguePos.y = 200; 495 496 SDL_Color fg = {0,0,0}; 497 498 Dialogue* d = new Dialogue(DialoguePos, mRen, "Tapestry.ttf", text_box, fg, mPlayer); 499 mPlayer->mFeed.Subscribe(d); 500 501 mHUD.LogWidget(d); 502 // 503 504 return true; 505 } 506 507 bool Level::Load(const char* filename) 508 { 509 cJSON* root = LoadJSON(filename); 510 //PrintJSON(root); 511 cJSON* level = cJSON_GetObjectItem(root, "level"); 512 513 LoadWorld(level); 514 515 LoadCamera(level); 516 517 gDiagDraw = new DiagnosticDraw(mRen, mCam); 518 519 LoadAnimations(level); 520 521 LoadActors(level); 522 523 LoadParticles(level); 524 525 LoadSounds(level); 526 527 LoadHud(level); 528 529 int cells[9]; 530 531 mSpatMon.GetAdjacentCells(36, cells); 532 533 return true; 534 } 535 536 bool Level::Update() 537 { 538 ///Update Actors 539 for (int i = 0; i < (int)(mCast.size()); i++) 540 { 541 mCast.at(i)->ActorUpdate(); 542 } 543 ///Update Particles 544 for (int i = 0; i < (int)(mPrtLib.GetParticles()->size()); i++) 545 { 546 mPrtLib.GetParticles()->at(i)->ActorUpdate(); 547 } 548 549 ///Draw HUD 550 mHUD.UpdateWidgets(); 551 552 mCam.ActorFollow(mRen, 150, 75); 553 554 ///Draw Backgrounds 555 for (int i = 0; i < (int)mBack.size(); i++) 556 { 557 DrawParallax(mRen, mBack.at(i), mCam, mParallax_back.at(i), mHeight, mWidth); 558 } 559 ///Draw Foregrounds 560 for (int i = 0; i < (int)mFore.size(); i++) 561 { 562 SDL_RenderCopy(mRen, mFore.at(i), mCam.GetCamView(), NULL); 563 } 564 565 ///Draw Actors 566 for (int i = 0; i < (int)mCast.size(); i++) 567 { 568 DrawActor(mRen, *mCast.at(i), mCam); 569 } 570 571 ///Draw Particles 572 for (int i = 0; i < (int)(mPrtLib.GetParticles()->size()); i++) 573 { 574 DrawActor(mRen, *mPrtLib.GetParticles()->at(i), mCam); 575 } 576 577 ///Draw overlays 578 for (int l = 0; l < (int)mOver.size(); l++) 579 { 580 DrawParallax(mRen, mOver.at(l), mCam, mParallax_over.at(l), mHeight, mWidth); 581 } 582 583 mHUD.DrawWidgets(); 584 585 ///Play Sounds 586 mSoundLib.UpdateRegionSounds(mPlayer->GetPosition()); 587 mSoundLib.UpdatePointSounds(mCam.GetCenterX(), mCam.GetCenterY()); 588 589 //gCons->ConsPrintf("%d channels are playing\n", Mix_Playing(-1)); 590 591 ///Draw Diagnositic rectangles 592 gDiagDraw->Update(); 593 594 return true; 595 } 596 597 bool Level::EventProcess(Event eve) 598 { 599 return true; 600 }