Skip to content

[CoM/LeGo] support for reinterpret_cast in scripts #119

Description

@Try

Here some code example to illustrate:

func void FADEOUTFINISH() {
	var OCNPC HER;  <---- OCNPC!
	if (FF_ACTIVE(FADESCREENTOBLACKLOOP)) {
		FF_REMOVE(FADESCREENTOBLACKLOOP);
	};
	FADESCREENSTATE = 0;
	SCREENFADED = TRUE;
	if (FADESCREENWORLDCHANGE) {
		HER = HLP_GETNPC(HERO); <----- implicit cast!
		HER.BITFIELD[0] = HER.BITFIELD[0] & ~OCNPC_BITFIELD0_MOVLOCK;
		....
		FADESCREENCHANGEWORLD();
	};
};

or

func void TELEPORTHEROTOPOS(var int X, var int Y, var int Z) {
	var OCNPC HER;
	HER = HLP_GETNPC(HERO);
	HER._ZCVOB_TRAFOOBJTOWORLD[3] = X;
	HER._ZCVOB_TRAFOOBJTOWORLD[7] = Y;
	HER._ZCVOB_TRAFOOBJTOWORLD[11] = Z;
};

Keeping discussion open for now; however my current idea is to:

  • implement type-check for 'default' VM mode - it should throw exception, if C_Npc is assigned to OCNPC or any other non-compatible type.
  • have 'special' mode, when instead of exception callback is called. It's reproducibility of callback to handle conversion. In those examples fro npc to zenkit::DaedalusTransientInstance and vise-versa.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmoddedIssues or features related to modifications of Gothic

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions