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

Error when hit 3PO in torso by saber #54

Open
AntiAnti opened this issue Dec 16, 2023 · 0 comments
Open

Error when hit 3PO in torso by saber #54

AntiAnti opened this issue Dec 16, 2023 · 0 comments

Comments

@AntiAnti
Copy link

AntiAnti commented Dec 16, 2023

It happens, because 3PO model has no "Motion" bone. Should use function similar to SP-vanilla renderer.

rend2-unified-wip/code/rd-rend2/G2_API.cpp

qboolean G2API_SetNewOrigin(CGhoul2Info* ghlInfo, const int boltIndex)
{
	if (G2_SetupModelPointers(ghlInfo))
	{
		/*
		if (boltIndex < 0)
		{
			char modelName[MAX_QPATH];
			if (ghlInfo->currentModel && ghlInfo->currentModel->name[0])
			{
				strcpy(modelName, ghlInfo->currentModel->name);
			}
			else
			{
				strcpy(modelName, "[Unknown - unexpected]");
			}

			Com_Error(ERR_DROP, "Bad boltindex (%i) trying to SetNewOrigin (naughty naughty!)\nModel %s\n", boltIndex, modelName);
		}
		*/

		// log instead of warning message on screen, like in SP-vanilla renderer
		G2ERROR(boltIndex >= 0 && boltIndex < (int)ghlInfo->mBltlist.size(), "invalid boltIndex");
		
		// check for valid boltIndex before applying new origin
		if (boltIndex >= 0 && boltIndex < (int)ghlInfo->mBltlist.size())
		{
			ghlInfo->mNewOrigin = boltIndex;
			ghlInfo->mFlags |= GHOUL2_NEWORIGIN;
		}
		return qtrue;
	}
	return qfalse;
}
SomaZ added a commit that referenced this issue Jun 12, 2024
Fixes #54

Co-Authored-By: AntiAnti <17278566+antianti@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant