forked from zsrtww/tww-gz
-
Notifications
You must be signed in to change notification settings - Fork 0
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
19 changed files
with
510 additions
and
7 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
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 |
---|---|---|
@@ -1 +1,5 @@ | ||
#pragma once | ||
#pragma once | ||
#include "libtww/include/f_op/f_op_actor_mng.h" | ||
|
||
extern fopAc_ac_c* g_currentActor; | ||
extern bool g_actorViewEnabled; |
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,5 @@ | ||
file(GLOB_RECURSE srcs CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") | ||
file(GLOB_RECURSE asms CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.s") | ||
list(APPEND srcs ${asms}) | ||
get_filename_component(rel_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) | ||
twwgz_add_module(${rel_name} "${srcs}" "${CMAKE_CURRENT_SOURCE_DIR}/include") |
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,5 @@ | ||
#pragma once | ||
|
||
namespace ActorViewer { | ||
void execute(); | ||
} // namespace ActorViewer |
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,6 @@ | ||
#pragma once | ||
|
||
namespace twwgz::modules { | ||
void main(); | ||
void exit(); | ||
} // namespace twwgz::modules |
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 "features/actor_view/include/actor_view.h" | ||
#include "menus/utils/menu_mgr.h" | ||
#include "libtww/include/f_op/f_op_actor_mng.h" | ||
//#include "libtww/include/f_op/f_op_draw_tag.h" | ||
#include "menus/menu_actor_list/include/actor_list_menu.h" | ||
#include "geometry_draw.h" | ||
#include "global_data.h" | ||
#include "libtww/include/m_Do/m_Do_printf.h" | ||
|
||
namespace ActorViewer { | ||
void drawGizmo(fopAc_ac_c* actor) { | ||
// Gizmo cube size and angle | ||
cXyz cube_size = {10.0f, 10.0f, 10.0f}; | ||
csXyz cube_angle = {0, 0, 0}; | ||
|
||
// Colors for the gizmo's axis lines and cube | ||
GXColor red = {255, 0, 0, 255}; | ||
GXColor green = {0, 255, 0, 255}; | ||
GXColor blue = {0, 0, 255, 255}; | ||
GXColor white = {255, 255, 255, 255}; | ||
|
||
// length of the gizmo's axis grid lines to draw | ||
f32 grid_line_length = 200.0f; | ||
|
||
// width of the gizmo's axis grid lines to draw | ||
u8 line_width = 20; | ||
|
||
// Draw a cube at the position of the actor | ||
dDbVw_drawCubeXlu(actor->current.pos, cube_size, cube_angle, white); | ||
|
||
// Gizmo axis line points | ||
cXyz point_x_a = {actor->current.pos.x + grid_line_length, actor->current.pos.y, actor->current.pos.z}; | ||
cXyz point_x_b = {actor->current.pos.x - grid_line_length, actor->current.pos.y, actor->current.pos.z}; | ||
cXyz point_y_a = {actor->current.pos.x, actor->current.pos.y + grid_line_length, actor->current.pos.z}; | ||
cXyz point_y_b = {actor->current.pos.x, actor->current.pos.y - grid_line_length, actor->current.pos.z}; | ||
cXyz point_z_a = {actor->current.pos.x, actor->current.pos.y, actor->current.pos.z + grid_line_length}; | ||
cXyz point_z_b = {actor->current.pos.x, actor->current.pos.y, actor->current.pos.z - grid_line_length}; | ||
|
||
|
||
// Gizmo axis lines | ||
dDbVw_drawLineXlu(point_x_a, point_x_b, red, 0, line_width); | ||
dDbVw_drawLineXlu(point_y_a, point_y_b, green, 0, line_width); | ||
dDbVw_drawLineXlu(point_z_a, point_z_b, blue, 0, line_width); | ||
} | ||
|
||
KEEP_FUNC void execute() { | ||
if (g_actorViewEnabled) { | ||
if (g_currentActor != NULL) | ||
drawGizmo(g_currentActor); | ||
} | ||
} | ||
} // namespace ActorViewer |
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,14 @@ | ||
#include <main.h> | ||
#include "features/actor_view/include/actor_view.h" | ||
#include "rels/include/cxx.h" | ||
#include "events/pre_loop_listener.h" | ||
|
||
namespace twwgz::modules { | ||
void main() { | ||
g_PreLoopListener->addListener(ActorViewer::execute); | ||
} | ||
void exit() { | ||
g_PreLoopListener->removeListener(ActorViewer::execute); | ||
} | ||
|
||
} // namespace twwgz::modules |
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,5 @@ | ||
file(GLOB_RECURSE srcs CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") | ||
file(GLOB_RECURSE asms CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.s") | ||
list(APPEND srcs ${asms}) | ||
get_filename_component(rel_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) | ||
twwgz_add_module(${rel_name} "${srcs}" "${CMAKE_CURRENT_SOURCE_DIR}/include") |
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,54 @@ | ||
#include "menu.h" | ||
#include "libtww/include/f_op/f_op_actor_mng.h" | ||
|
||
struct ActorListData { | ||
uint16_t l_index; | ||
}; | ||
|
||
/** | ||
* @struct procBinData | ||
* @brief Structure for entries in res/proc_info/procs.bin | ||
*/ | ||
struct procBinData { | ||
s16 procId; | ||
char procName[30]; | ||
} __attribute__((aligned(32))); | ||
|
||
enum { | ||
ACTOR_NAME_INDEX, | ||
ACTOR_PARAMS_INDEX, | ||
ACTOR_ADDRESS_INDEX, | ||
ACTOR_POSITION_X_INDEX, | ||
ACTOR_POSITION_Y_INDEX, | ||
ACTOR_POSITION_Z_INDEX, | ||
ACTOR_ANGLE_X_INDEX, | ||
ACTOR_ANGLE_Y_INDEX, | ||
ACTOR_ANGLE_Z_INDEX, | ||
|
||
ACTOR_LIST_LINE_COUNT, | ||
}; | ||
|
||
class ActorListMenu : public Menu { | ||
public: | ||
ActorListMenu(Cursor&, ActorListData&); | ||
virtual ~ActorListMenu(); | ||
virtual void draw(); | ||
|
||
private: | ||
void updateActorData(); | ||
template <typename T> | ||
void updateValue(T*, bool); | ||
void loadActorName(); | ||
void checkAndCloseMenu(); | ||
void checkAndRestoreMenu(); | ||
|
||
u16& l_index; | ||
|
||
Line lines[ACTOR_LIST_LINE_COUNT]; | ||
s32 l_cameraPlay; | ||
bool l_halt; | ||
u8 l_menuStatus; | ||
u8 l_windowStatus; | ||
cXyz l_cameraPos; | ||
cXyz l_cameraTarget; | ||
}; |
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,6 @@ | ||
#pragma once | ||
|
||
namespace twwgz::modules { | ||
void main(); | ||
void exit(); | ||
} // namespace twwgz::modules |
Oops, something went wrong.