MCPcopy Create free account
hub / github.com/atraczyk/2d-engine / G_update

Function G_update

engine/src/game.cpp:632–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

630}
631
632void G_update(double elapsed_time)
633{
634 sound.update();
635 input.update();
636
637 for (int i = 0; i < game.events.size(); i++)
638 game.events[i].update();
639
640 I_updateProgramInput(&input);
641
642 if (bpause || btransitioning) // PAUSED
643 {
644 gametime.pauseTime += elapsed_time;
645
646 if (!btransitioning)
647 I_updateMenuInput(&input);
648
649 if (!bstarted) // DEMO/STARTSCREEN
650 {
651 game.clips.demo.update();
652 if (player.hit < 60)
653 {
654 world.level.layer[3].update();
655 world.level.layer[2].update();
656 world.level.layer[1].update();
657 world.level.layer[0].update();
658 world.level.dynTileMaps.update(gametime.currentFrame);
659 player.update(
660 &world.constraints, &world.level.layer[2],
661 &world.level.layer[3], &(world.level.dynTileMaps.tileMaps),
662 world.gravity, MS_PER_FRAME, &camera, &game.clientRect);
663 for (unsigned int i = 0; i < world.enemies.size(); i++)
664 {
665 world.enemies[i].update(
666 &world.constraints, &world.level.layer[2],
667 &(world.level.dynTileMaps.tileMaps), world.gravity,
668 MS_PER_FRAME, &camera, &game.clientRect, i);
669 }
670 camera.update(&world.constraints);
671 }
672 else
673 {
674 player.hit--;
675 }
676 }
677 }
678 else // IN GAME
679 {
680 if (player.hit < 60)
681 {
682 gametime.gameTime += elapsed_time;
683 gametime.currentFrame++;
684
685 if (bplayercontrol)
686 I_updateGameInput(&input);
687
688 world.level.layer[3].update();
689 world.level.layer[2].update();

Callers 1

P_runFunction · 0.85

Calls 9

I_updateProgramInputFunction · 0.85
I_updateMenuInputFunction · 0.85
I_updateGameInputFunction · 0.85
removeFunction · 0.85
I_resetControlsFunction · 0.85
I_zeroGameInputFunction · 0.85
reinitializeMethod · 0.80
updateMethod · 0.45
initializeMethod · 0.45

Tested by

no test coverage detected