mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-11 04:31:35 -10:00
This adds a mechanism for running generic operations at specific points of the frame execution. This can be used by any part of the code an not just Lua since it simply executes std::functions. It also adds an "execution context" concept that specifies in which situation an operation should be executed. This is then used by the Lua Coroutines code for resuming coroutines at specific points instead of always when the awaited promise resolves.
95 lines
2.2 KiB
C++
95 lines
2.2 KiB
C++
/*
|
|
* Copyright (C) Volition, Inc. 1999. All rights reserved.
|
|
*
|
|
* All source code herein is the property of Volition, Inc. You may not sell
|
|
* or otherwise commercially exploit the source or things you created based on the
|
|
* source.
|
|
*
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __JUMPNODE_H__
|
|
#define __JUMPNODE_H__
|
|
|
|
#include <cstdlib>
|
|
|
|
#include "globalincs/globals.h"
|
|
#include "graphics/2d.h"
|
|
|
|
struct vec3d;
|
|
class object;
|
|
|
|
class model_draw_list;
|
|
|
|
//Jump node flags
|
|
#define JN_USE_DISPLAY_COLOR (1<<0) //Use display_color instead of HUD color
|
|
#define JN_SHOW_POLYS (1<<1) //Display model normally, rather than as wireframe
|
|
#define JN_HIDE (1<<2) //Hides a jump node
|
|
#define JN_SPECIAL_MODEL (1<<3) //If non-default model
|
|
|
|
class CJumpNode
|
|
{
|
|
private:
|
|
char m_name[NAME_LENGTH];
|
|
float m_radius {0.0f};
|
|
|
|
int m_modelnum {-1};
|
|
int m_objnum {-1}; // objnum of this jump node
|
|
int m_polymodel_instance_num {-1}; // polymodel instance number, used for rotations
|
|
|
|
int m_flags {0};
|
|
color m_display_color; // Color node will be shown in (Default:0/255/0/255)
|
|
vec3d m_pos;
|
|
|
|
CJumpNode(const CJumpNode&);
|
|
CJumpNode& operator=(const CJumpNode&);
|
|
public:
|
|
//Constructors
|
|
CJumpNode();
|
|
CJumpNode(vec3d *position);
|
|
CJumpNode(CJumpNode&& other) noexcept;
|
|
|
|
CJumpNode& operator=(CJumpNode&&) noexcept;
|
|
|
|
//Destructor
|
|
~CJumpNode();
|
|
|
|
//Getting
|
|
char *GetName();
|
|
int GetModelNumber();
|
|
int GetSCPObjectNumber();
|
|
int GetPolymodelInstanceNum();
|
|
object *GetSCPObject();
|
|
color GetColor();
|
|
vec3d *GetPosition();
|
|
|
|
//Setting
|
|
void SetAlphaColor(int r, int g, int b, int alpha);
|
|
void SetModel(char *model_name, bool show_polys=false);
|
|
void SetName(const char *new_name);
|
|
void SetVisibility(bool enabled);
|
|
|
|
//Query
|
|
bool IsHidden();
|
|
bool IsColored();
|
|
bool IsSpecialModel();
|
|
|
|
//Rendering
|
|
void Render(vec3d *pos, vec3d *view_pos = NULL);
|
|
void Render(model_draw_list *scene, vec3d *pos, vec3d *view_pos = NULL);
|
|
};
|
|
|
|
//-----Globals------
|
|
extern SCP_list<CJumpNode> Jump_nodes;
|
|
|
|
//-----Functions-----
|
|
CJumpNode *jumpnode_get_by_name(const char *name);
|
|
CJumpNode *jumpnode_get_by_objnum(int objnum);
|
|
CJumpNode *jumpnode_get_which_in(object *objp);
|
|
|
|
void jumpnode_render_all();
|
|
void jumpnode_level_close();
|
|
|
|
#endif
|