Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add instance_create_depth #2356

Merged
merged 4 commits into from
Aug 16, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion ENIGMAsystem/SHELL/Universal_System/Instances/instance_create.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ namespace enigma_user
return idn;
}

enigma::instance_t instance_create_depth(int x, int y, int object, int depth) {
RobertBColton marked this conversation as resolved.
Show resolved Hide resolved
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;
Comment on lines 156 to 160
Copy link
Contributor

@dc03 dc03 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, what is going on with the indentation formatting here?

if (perf) newinst->myevent_create();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoshDreamland do you have proof that create was supposed to run before the variables were copied?

looks like plionz added it: 9e3060f

}
} //namespace enigma_user

Expand Down