Skip to content

Commit

Permalink
add instance_create_depth (#2356)
Browse files Browse the repository at this point in the history
* add instance_create_depth

* fix instance_copy init order

* Update ENIGMAsystem/SHELL/Universal_System/Instances/instance_create.h

* declare instance_create_depth
  • Loading branch information
RobertBColton committed Aug 16, 2023
1 parent 85c1a3a commit d64a8ec
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions ENIGMAsystem/SHELL/Universal_System/Instances/instance.h
Expand Up @@ -45,6 +45,7 @@ namespace enigma_user
{

enigma::instance_t instance_create(int x,int y,int object);
enigma::instance_t instance_create_depth(int x,int y,int depth,int object);
void instance_deactivate_all(bool notme);
void instance_activate_all();
void instance_activate_object(int obj);
Expand Down
20 changes: 19 additions & 1 deletion ENIGMAsystem/SHELL/Universal_System/Instances/instance_create.h
Expand Up @@ -106,6 +106,24 @@ namespace enigma_user
return idn;
}

enigma::instance_t instance_create_depth(int x, int y, int depth, int object) {
int idn = enigma::maxid++;
enigma::object_basic* ob;
switch((int)object) {
#define NEW_OBJ_PREFIX ob =
#include "Preprocessor_Environment_Editable/IDE_EDIT_object_switch.h"
default:
#ifdef DEBUG_MODE
DEBUG_MESSAGE("Object doesn't exist", MESSAGE_TYPE::M_USER_ERROR);
#endif
return -1;
}
enigma::object_graphics* newinst = (enigma::object_graphics*) (*enigma::fetch_inst_iter_by_int(idn));
newinst->depth = depth;
ob->myevent_create();
return idn;
}

inline void action_change_object(int obj, bool perf) {instance_change(obj,perf);}

void instance_change(int obj, bool perf) {
Expand Down Expand Up @@ -135,12 +153,12 @@ namespace enigma_user
(void)ob;

enigma::object_graphics* newinst = (enigma::object_graphics*) (*enigma::fetch_inst_iter_by_int(idn));
if (perf) newinst->myevent_create();
newinst->yprevious=inst->yprevious; newinst->xprevious=inst->xprevious;
newinst->xstart=inst->xstart; newinst->ystart=inst->ystart;
newinst->image_index=inst->image_index; newinst->image_speed=inst->image_speed;
newinst->visible=inst->visible; newinst->image_xscale=inst->image_xscale; newinst->image_yscale=inst->image_yscale; newinst->image_angle=inst->image_angle;
newinst->hspeed=inst->hspeed; newinst->vspeed=inst->vspeed;
if (perf) newinst->myevent_create();
}
} //namespace enigma_user

Expand Down

0 comments on commit d64a8ec

Please sign in to comment.