-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
193 additions
and
1 deletion.
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
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
Binary file not shown.
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
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
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,61 @@ | ||
#include "turret.h" | ||
|
||
#include "defs.h" | ||
#include "scene/dynamic_scene.h" | ||
#include "util/dynamic_asset_loader.h" | ||
|
||
#include "codegen/assets/materials/static.h" | ||
#include "codegen/assets/models/dynamic_animated_model_list.h" | ||
|
||
void turretRender(void* data, struct DynamicRenderDataList* renderList, struct RenderState* renderState) { | ||
struct Turret* turret = (struct Turret*)data; | ||
|
||
Mtx* matrix = renderStateRequestMatrices(renderState, 1); | ||
|
||
if (!matrix) { | ||
return; | ||
} | ||
|
||
transformToMatrixL(&turret->rigidBody.transform, matrix, SCENE_SCALE); | ||
|
||
Mtx* armature = renderStateRequestMatrices(renderState, turret->armature.numberOfBones); | ||
|
||
if (!armature) { | ||
return; | ||
} | ||
|
||
skCalculateTransforms(&turret->armature, armature); | ||
|
||
dynamicRenderListAddDataTouchingPortal( | ||
renderList, | ||
turret->armature.displayList, | ||
matrix, | ||
TURRET_INDEX, | ||
&turret->rigidBody.transform.position, | ||
armature, | ||
turret->rigidBody.flags | ||
); | ||
} | ||
|
||
void turretInit(struct Turret* turret, struct TurretDefinition* definition) { | ||
// TODO: | ||
// * Physics (collidable and grabbable) | ||
// * Fizzleable | ||
|
||
struct SKArmatureWithAnimations* armature = dynamicAssetAnimatedModel(PROPS_TURRET_01_DYNAMIC_ANIMATED_MODEL); | ||
skArmatureInit(&turret->armature, armature->armature); | ||
|
||
turret->rigidBody.transform.position = definition->position; | ||
turret->rigidBody.transform.rotation = definition->rotation; | ||
turret->rigidBody.transform.scale = gOneVec; | ||
turret->rigidBody.currentRoom = definition->roomIndex; | ||
|
||
// TODO: radius | ||
turret->dynamicId = dynamicSceneAdd(turret, turretRender, &turret->rigidBody.transform.position, 1.5f); | ||
|
||
dynamicSceneSetRoomFlags(turret->dynamicId, ROOM_FLAG_FROM_INDEX(turret->rigidBody.currentRoom)); | ||
} | ||
|
||
void turretUpdate(struct Turret* turret) { | ||
// TODO | ||
} |
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,19 @@ | ||
#ifndef __TURRET_H__ | ||
#define __TURRET_H__ | ||
|
||
// #include "../physics/collision_object.h" | ||
#include "levels/level_definition.h" | ||
// #include "../sk64/skeletool_armature.h" | ||
|
||
struct Turret { | ||
//struct CollisionObject collisionObject; | ||
struct RigidBody rigidBody; | ||
struct SKArmature armature; | ||
short dynamicId; | ||
//float fizzleTime; | ||
}; | ||
|
||
void turretInit(struct Turret* turret, struct TurretDefinition* definition); | ||
void turretUpdate(struct Turret* turret); | ||
|
||
#endif |
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