Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (AndrewAMD, Quad, soulman3, Ayumi, steyr, 3run), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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: 987
Budapest
Aku_Aku Offline
User
Aku_Aku  Offline
User

Joined: Sep 2009
Posts: 987
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 | chip programmers | 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