Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 16,643 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 4 of 4 1 2 3 4
Re: Saving a modified model ingame as mdl [Re: TechMuc] #387534
11/20/11 11:41
11/20/11 11:41
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline
Serious User
Aku_Aku  Offline
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
Any news?

Re: Saving a modified model ingame as mdl [Re: Aku_Aku] #387537
11/20/11 11:54
11/20/11 11:54
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline OP
Senior Expert
Pappenheimer  Offline OP
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
What news?
Did you try TechMuc's contribution a few posts above?
It works nicely so far, I made a test with simplysid.mdl, and it keeps the animations as well.

Don't forget to follow the instructions that TechMuc posted.

Try something like this to see the resulting model, instead of the given values in the test.c file:

c.v.y -= random(3);

Code:
function raise_terrain(ENTITY* terrain)
{
	int i = ent_status(terrain,0); // number of vertices
	for (; i>0; i--)
	{
		CONTACT* c = ent_getvertex(terrain,NULL,i);
		c.v.y -= random(3);
		ent_setvertex(terrain,c,i);
	}
}



This is the whole test, how I modified it to see a fast and easy result:
Code:
#include <acknex.h>
#include <windows.h>
#include <default.c>


//exported functions
void* LoadModel(ENTITY* ent);
void* LoadModelFromFile(STRING* str);

BOOL SaveModel(ENTITY* ent);
BOOL SaveModelWithLoader(ENTITY* ent,void* loader);
BOOL SaveModelToFileFile(ENTITY* ent,void* loader,STRING* new_fl);

BOOL FreeLoader(void* loader);

// raise all terrain vertices by 5 units
function raise_terrain(ENTITY* terrain)
{
	int i = ent_status(terrain,0); // number of vertices
	for (; i>0; i--)
	{
		CONTACT* c = ent_getvertex(terrain,NULL,i);
		c.v.y -= random(2);
		ent_setvertex(terrain,c,i);
	}
}



int main() {
	wait(1);
	level_load("");
	wait(3);
	ENTITY* ent = ent_create("simplysid.mdl",vector(10,10,10),0);
	wait(1);
	void* loader = LoadModel(ent);
	wait(1);
	raise_terrain(ent);
	wait(1);
//	SaveModelWithLoader(ent,loader);
	SaveModelToFileFile(ent, loader, "test.mdl");
	FreeLoader(loader);
	
	while(1) {
		wait(1);
	}
	return true;
}



Last edited by Pappenheimer; 11/20/11 11:55.
Page 4 of 4 1 2 3 4

Moderated by  aztec, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1