-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update graphics * Update animation * Update animation refs * Get with ref * I am feel sorry about not to commit on time * Revert clang-format * Add new line
- Loading branch information
Showing
75 changed files
with
25,991 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"player_config": { | ||
"t_speed": 2.0, | ||
"r_speed": 0.4, | ||
"width": 0.4, | ||
"height": 1.0 | ||
}, | ||
"config_enemy": { | ||
"soldier": { | ||
"t_speed": 0.8, | ||
"r_speed": 0.4, | ||
"width": 0.3, | ||
"height": 0.6 | ||
}, | ||
"caco_demon": { | ||
"t_speed": 0.8, | ||
"r_speed": 0.4, | ||
"width": 0.4, | ||
"height": 0.8 | ||
}, | ||
"cyber_demon": { | ||
"t_speed": 0.8, | ||
"r_speed": 0.4, | ||
"width": 0.5, | ||
"height": 1.0 | ||
} | ||
}, | ||
"config_dynamic": { | ||
"light": { | ||
"animation_speed": 0.3, | ||
"width": 0.2, | ||
"height": 0.9 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"map": "map1.txt", | ||
"player": { "position": { "x": 3, "y": 1.5, "theta": 1.5} }, | ||
"enemies": [ | ||
{ "type": "soldier", "position": { "x": 9, "y": 7, "theta": 0 }}, | ||
{ "type": "soldier", "position": { "x": 9, "y": 8, "theta": 0 }}, | ||
{ "type": "soldier", "position": { "x": 18, "y": 10.5, "theta": 0 }}, | ||
{ "type": "soldier", "position": { "x": 23, "y": 10.5, "theta": 0 }}, | ||
{ "type": "caco_demon", "position": { "x": 13.5, "y": 2.5, "theta": 0 }}, | ||
{ "type": "caco_demon", "position": { "x": 6, "y": 11.5, "theta": 0 }}, | ||
{ "type": "caco_demon", "position": { "x": 21, "y": 14, "theta": 0 }}, | ||
{ "type": "cyber_demon", "position": { "x": 12.5, "y": 14.5, "theta": 0 }}, | ||
{ "type": "cyber_demon", "position": { "x": 23, "y": 4, "theta": 0 }}, | ||
{ "type": "cyber_demon", "position": { "x": 20, "y": 4, "theta": 0 }} | ||
], | ||
"dynamicObjects": [ | ||
{ "type": "red_light", "position": { "x": 12.1, "y": 8.15 } }, | ||
{ "type": "red_light", "position": { "x": 10.9, "y": 8.15 } }, | ||
{ "type": "green_light", "position": { "x": 9.9, "y": 10.9 } }, | ||
{ "type": "green_light", "position": { "x": 9.9, "y": 13.1 } }, | ||
{ "type": "green_light", "position": { "x": 12.1, "y": 13.1 } }, | ||
{ "type": "green_light", "position": { "x": 12.1, "y": 10.9 } } | ||
], | ||
"staticObjects": [ | ||
|
||
], | ||
"next_level": "level2.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"map": "map2.txt", | ||
"player": { "position": { "x": 1.5, "y": 1.5, "theta": 1.5} }, | ||
"enemies": [ | ||
{ "type": "soldier", "position": { "x": 8.5, "y": 10.5, "theta": 0 }}, | ||
{ "type": "soldier", "position": { "x": 9.6, "y": 6.2, "theta": 0 }}, | ||
{ "type": "soldier", "position": { "x": 19, "y": 9.3, "theta": 0 }}, | ||
{ "type": "soldier", "position": { "x": 3.5, "y": 15.5, "theta": 0 }}, | ||
{ "type": "soldier", "position": { "x": 2.5, "y": 23.5, "theta": 0 }}, | ||
{ "type": "soldier", "position": { "x": 8.5, "y": 22.5, "theta": 0 }}, | ||
{ "type": "caco_demon", "position": { "x": 5.9, "y": 22, "theta": 0 }}, | ||
{ "type": "caco_demon", "position": { "x": 22.5, "y": 5.5, "theta": 0 }}, | ||
{ "type": "caco_demon", "position": { "x": 13.5, "y": 2.5, "theta": 0 }}, | ||
{ "type": "caco_demon", "position": { "x": 11.5, "y": 18, "theta": 0 }}, | ||
{ "type": "caco_demon", "position": { "x": 18, "y": 6, "theta": 0 }}, | ||
{ "type": "cyber_demon", "position": { "x": 13.5, "y": 22.5, "theta": 0 }}, | ||
{ "type": "cyber_demon", "position": { "x": 16.5, "y": 23.5, "theta": 0 }}, | ||
{ "type": "cyber_demon", "position": { "x": 21.5, "y": 19.5, "theta": 0 }}, | ||
{ "type": "cyber_demon", "position": { "x": 15.5, "y": 8, "theta": 0 }} | ||
], | ||
"dynamicObjects": [ | ||
{ "type": "red_light", "position": { "x": 6.1, "y": 4.9 } }, | ||
{ "type": "red_light", "position": { "x": 1.9, "y": 4.9 } }, | ||
{ "type": "red_light", "position": { "x": 1.9, "y": 13.1 } }, | ||
{ "type": "red_light", "position": { "x": 6.1, "y": 10.9 } }, | ||
{ "type": "green_light", "position": { "x": 14.1, "y": 9.9 } }, | ||
{ "type": "green_light", "position": { "x": 14.9, "y": 9.9 } }, | ||
{ "type": "green_light", "position": { "x": 14.9, "y": 21.1 } }, | ||
{ "type": "green_light", "position": { "x": 14.1, "y": 21.1 } } | ||
], | ||
"staticObjects": [ | ||
|
||
], | ||
"next_level": "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
height 26 | ||
width 16 | ||
3333333333333333 | ||
3000000000000003 | ||
3000000000000003 | ||
3001111000000003 | ||
3000000002222003 | ||
3001110022000053 | ||
3000000002000053 | ||
3000000002222003 | ||
3000000000000003 | ||
3000000000000003 | ||
3333333300044003 | ||
3000000000044003 | ||
3000333300000003 | ||
3000300000000003 | ||
3000300000000003 | ||
3111111111111003 | ||
3000000100000003 | ||
3000000100000003 | ||
3000000100001013 | ||
3000000100001003 | ||
3111000101101003 | ||
3000000100001003 | ||
3000000000001103 | ||
3000000000001003 | ||
3000000000001003 | ||
3333333333333333 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
height 24 | ||
width 30 | ||
111111111111111111111111111111 | ||
100000000000000001111111111111 | ||
100001111111100001100000000011 | ||
111001111111100001111110111111 | ||
111001111111100001111110111111 | ||
111001111111100000000000111111 | ||
111000000001111111111000111111 | ||
111000000000011111111000111111 | ||
111001110001111111100000111111 | ||
111000010000011111111100000111 | ||
111111111011111110000000110111 | ||
111111111011111100011111110111 | ||
111111111011100000000000110111 | ||
111100000011111111111000110111 | ||
111111100000000000000000110111 | ||
111011100011111111111000010111 | ||
111000000011111000000000000111 | ||
111100000011111111111100011111 | ||
111100000011111111000000011111 | ||
111100000011111111111111011111 | ||
111111111011111111000000011111 | ||
111111111011111111000111111111 | ||
111000000011111111000111111111 | ||
111111111111111111111111111111 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/Animation/include/Animation/triggered_single_animation.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* @file animation.h | ||
* @author Bilal Kahraman ([email protected]) | ||
* @brief | ||
* @version 0.1 | ||
* @date 2024-08-18 | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
*/ | ||
|
||
#ifndef ANIMATION_INCLUDE_ANIMATION_TRIGGERED_SINGLE_ANIMATION_H_ | ||
#define ANIMATION_INCLUDE_ANIMATION_TRIGGERED_SINGLE_ANIMATION_H_ | ||
|
||
#include "Animation/animation.h" | ||
#include <cstdint> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace wolfenstein { | ||
|
||
class Texture; | ||
|
||
class TriggeredSingleAnimation : public IAnimation | ||
{ | ||
public: | ||
TriggeredSingleAnimation(const uint16_t texture_id, | ||
const double animation_speed, | ||
int alpha_start = 128, int alpha_end = 0); | ||
~TriggeredSingleAnimation() = default; | ||
|
||
void Update(const double& delta_time) override; | ||
void Reset() override; | ||
|
||
int GetCurrentFrame() const override; | ||
bool IsAnimationFinishedOnce() const override; | ||
|
||
private: | ||
Texture& texture; | ||
uint16_t texture_id; | ||
double counter; | ||
double animation_speed; | ||
int transparancy; | ||
int alpha_start; | ||
int alpha_end; | ||
int direction; | ||
bool is_animation_finished_once; | ||
}; | ||
|
||
} // namespace wolfenstein | ||
#endif // ANIMATION_INCLUDE_ANIMATION_TRIGGERED_SINGLE_ANIMATION_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include "Animation/triggered_single_animation.h" | ||
#include "TextureManager/texture_manager.h" | ||
#include <cassert> | ||
|
||
#define assertm(exp, msg) assert((void(msg), exp)) | ||
|
||
namespace wolfenstein { | ||
|
||
TriggeredSingleAnimation::TriggeredSingleAnimation(const uint16_t texture_id, | ||
const double animation_speed, | ||
int alpha_start, | ||
int alpha_end) | ||
: texture(TextureManager::GetInstance().GetTexture(texture_id)), | ||
texture_id(texture_id), | ||
counter(0), | ||
animation_speed(animation_speed), | ||
transparancy(alpha_start), | ||
alpha_start(alpha_start), | ||
alpha_end(alpha_end), | ||
direction((alpha_end - alpha_start) / abs((alpha_end - alpha_start))), | ||
is_animation_finished_once(false) {} | ||
|
||
void TriggeredSingleAnimation::Update(const double& delta_time) { | ||
if (is_animation_finished_once) { | ||
return; | ||
} | ||
counter += delta_time; | ||
transparancy = | ||
static_cast<int>(alpha_start + (counter * direction * animation_speed) * | ||
abs(alpha_start - alpha_end)); | ||
SDL_SetTextureAlphaMod(texture.texture, transparancy); | ||
|
||
if (!is_animation_finished_once && transparancy == alpha_end) { | ||
is_animation_finished_once = true; | ||
} | ||
} // namespace wolfenstein | ||
|
||
void TriggeredSingleAnimation::Reset() { | ||
counter = 0; | ||
transparancy = alpha_start; | ||
is_animation_finished_once = false; | ||
} | ||
|
||
int TriggeredSingleAnimation::GetCurrentFrame() const { | ||
return texture_id; | ||
} | ||
|
||
bool TriggeredSingleAnimation::IsAnimationFinishedOnce() const { | ||
return is_animation_finished_once; | ||
} | ||
|
||
} // namespace wolfenstein |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,4 +45,6 @@ target_link_libraries( | |
ray | ||
vector | ||
map | ||
character | ||
scene | ||
) |
Oops, something went wrong.