Jump to content
Eternal Lands Official Forums
Sign in to follow this  
Cpp

"el Movie" Making

Recommended Posts

Hmm, maybe your update_all_actors function is not the same that i have here... Uhh, damn, just a stupid guess...

well my is latest cvs code

also head file not properly defined

 

Edit geting following in my error log

Error: Unable to add command 26 to 137

Error: Unable to add command 22 to 1148

Share this post


Link to post
Share on other sites

Ok, i've edited my last diff. It is now diffed with newest version. I hope it works, because i couldnt test it cause of libxml2.dll version differences...

Share this post


Link to post
Share on other sites

Cpp, would this also movie-maker work like a real camera? That is to say - is it possible to record things like zooming in and out, rotating the viewpoint to a bird's eye or ground-level view, and stuff like that? If it's not, is it possible to incorporate these features into the movie-maker?

 

-Lyn-

Share this post


Link to post
Share on other sites
Cpp, would this also movie-maker work like a real camera? That is to say - is it possible to record things like zooming in and out, rotating the viewpoint to a bird's eye or ground-level view, and stuff like that? If it's not, is it possible to incorporate these features into the movie-maker?

 

-Lyn-

It could probably be incorporated - But as of yet, this only makes a "movie" of incoming server commands - recording EVENTS (ie, zoom, mouse, and other client side stuff) should be possible, but will require additional coding. (By someone else - this time I can't back up my theory because I'm busy :D )

Share this post


Link to post
Share on other sites

Yea, that should be possible.

 

It would probably be something like an additional "protocol" with event data. However, this would make the record file larger and input may flicker.

 

I think i should reprogramm the replay/record stuff a bit so that you could record while replaying. That way you could make a big record with only server commands and later break it to smaller files with player input (except typing, i suppose). You could also make the record with player input at once.

 

The only problem is that I also have no time now :D

Share this post


Link to post
Share on other sites

I used the camara for the latest EL War

 

It was really easy then to get an good story on the event and then also get just the right screen-shots.

Share this post


Link to post
Share on other sites

record.c record.h no longer can be download

so here are

record.c

#include "global.h"
Uint8 record_file[256];
FILE *rec_file = NULL;
Uint32 rec_started = 0, rec_last_msg_time = 0, rec_last_msg_delay = 0, rec_last_msg_file_time = 0;
Uint8 rec_last_message[8192];
int replaying = 0;
float rec_speed = 1.0f;

void cpy_str(Uint8 *dest, Uint8 *source, int n)
{
int i;
for(i=0;i<n;i++)
 dest[i] = source[i];
}

void rec_special_message(Uint8 protocol, Uint8 *msg, int n)
{
Uint8 temp[160];
temp[0] = protocol;
*((short*)(temp+1)) = n+1;
cpy_str((temp+3), msg, n);
record_msg(temp, n+3);
}

void rec_sigils_we_have()
{
int i;
int po2=1;
Uint32 sigils_we_have=0;
Uint8 temp[4];

for(i=0;i<32;i++)
 {
	 if(sigils_list[i].have_sigil==1)
   sigils_we_have |= po2;
	 po2*=2;
 }
*((Uint32*)temp) = sigils_we_have;
rec_special_message(GET_YOUR_SIGILS, temp, 4);
}

void rec_other_data()
{
int temp_time;
Uint8 temp[4];
rec_special_message(GET_ACTIVE_SPELL_LIST, (Uint8*)active_spells, 10);

*((short*)temp) = game_minute;
rec_special_message(NEW_MINUTE, temp, 2);

temp_time = client_server_delta_time + SDL_GetTicks();
*((int*)temp) = temp_time;
rec_special_message(SYNC_CLOCK, temp, 4);

*((short*)temp) = yourself;
rec_special_message(YOU_ARE, temp, 2);

rec_special_message(LOG_IN_OK, NULL, 0);

rec_special_message(CHANGE_MAP, map_file_name, strlen(map_file_name));
}

void rec_bags_list()
{
int i, n=0, my_offset;
Uint8 temp[1024];
for(i=0;i<200;i++)
 if(bag_list[i].obj_3d_id!=-1)
 {
	 my_offset=n*5+1;
	 *((Uint16 *)(temp+my_offset+0))=(int)(bag_list[i].x * 2);
	 *((Uint16 *)(temp+my_offset+2))=(int)(bag_list[i].y * 2);
	 *((Uint8 *) (temp+my_offset+4))=i;
	 n++;
 }
temp[0] = n;
rec_special_message(GET_BAGS_LIST, temp, n*5+1);
}

void rec_your_inventory()
{
Uint8 data[360];
int i,n=0;
Uint8 flags;

for(i=0;i<44;i++)
 if(item_list[i].quantity>0)
 {
	 flags = 0;
	 *((Uint16 *)(data+n*8+1)) = item_list[i].image_id;
	 *((Uint32 *)(data+n*8+1+2)) = item_list[i].quantity;
	 data[n*8+1+6] = item_list[i].pos;

	 if(item_list[i].is_resource)
    flags|=ITEM_RESOURCE;
	 if(item_list[i].is_reagent)
    flags|=ITEM_REAGENT;
	 if(item_list[i].use_with_inventory)
    flags|=ITEM_INVENTORY_USABLE;

	 data[n*8+1+7] = flags;
	 n++;
 }
data[0]=n;
rec_special_message(HERE_YOUR_INVENTORY, data, n*8+1);
}

void rec_your_stats()
{
Sint16 stats[95];

stats[0]=your_info.phy.cur;
stats[1]=your_info.phy.base;
stats[2]=your_info.coo.cur;
stats[3]=your_info.coo.base;
stats[4]=your_info.rea.cur;
stats[5]=your_info.rea.base;
stats[6]=your_info.wil.cur;
stats[7]=your_info.wil.base;
stats[8]=your_info.ins.cur;
stats[9]=your_info.ins.base;
stats[10]=your_info.vit.cur;
stats[11]=your_info.vit.base;
stats[12]=your_info.human_nex.cur;
stats[13]=your_info.human_nex.base;
stats[14]=your_info.animal_nex.cur;
stats[15]=your_info.animal_nex.base;
stats[16]=your_info.vegetal_nex.cur;
stats[17]=your_info.vegetal_nex.base;
stats[18]=your_info.inorganic_nex.cur;
stats[19]=your_info.inorganic_nex.base;
stats[20]=your_info.artificial_nex.cur;
stats[21]=your_info.artificial_nex.base;
stats[22]=your_info.magic_nex.cur;
stats[23]=your_info.magic_nex.base;
stats[24]=your_info.manufacturing_skill.cur;
stats[25]=your_info.manufacturing_skill.base;
stats[26]=your_info.harvesting_skill.cur;
stats[27]=your_info.harvesting_skill.base;
stats[28]=your_info.alchemy_skill.cur;
stats[29]=your_info.alchemy_skill.base;
stats[30]=your_info.overall_skill.cur;
stats[31]=your_info.overall_skill.base;
stats[32]=your_info.attack_skill.cur;
stats[33]=your_info.attack_skill.base;
stats[34]=your_info.defense_skill.cur;
stats[35]=your_info.defense_skill.base;
stats[36]=your_info.magic_skill.cur;
stats[37]=your_info.magic_skill.base;
stats[38]=your_info.potion_skill.cur;
stats[39]=your_info.potion_skill.base;
stats[40]=your_info.carry_capacity.cur;
stats[41]=your_info.carry_capacity.base;
stats[42]=your_info.material_points.cur;
stats[43]=your_info.material_points.base;
stats[44]=your_info.ethereal_points.cur;
stats[45]=your_info.ethereal_points.base;
stats[46]=your_info.food_level;
*((Uint32 *)(stats+49))=your_info.manufacturing_exp;
*((Uint32 *)(stats+51))=your_info.manufacturing_exp_next_lev;
*((Uint32 *)(stats+53))=your_info.harvesting_exp;
*((Uint32 *)(stats+55))=your_info.harvesting_exp_next_lev;
*((Uint32 *)(stats+57))=your_info.alchemy_exp;
*((Uint32 *)(stats+59))=your_info.alchemy_exp_next_lev;
*((Uint32 *)(stats+61))=your_info.overall_exp;
*((Uint32 *)(stats+63))=your_info.overall_exp_next_lev;
*((Uint32 *)(stats+65))=your_info.attack_exp;
*((Uint32 *)(stats+67))=your_info.attack_exp_next_lev;
*((Uint32 *)(stats+69))=your_info.defense_exp;
*((Uint32 *)(stats+71))=your_info.defense_exp_next_lev;
*((Uint32 *)(stats+73))=your_info.magic_exp;
*((Uint32 *)(stats+75))=your_info.magic_exp_next_lev;
*((Uint32 *)(stats+77))=your_info.potion_exp;
*((Uint32 *)(stats+79))=your_info.potion_exp_next_lev;
*((Uint32 *)(stats+85))=your_info.summoning_exp;
*((Uint32 *)(stats+87))=your_info.summoning_exp_next_lev;
*((Uint32 *)(stats+91))=your_info.crafting_exp;
*((Uint32 *)(stats+93))=your_info.crafting_exp_next_lev;
stats[83]=your_info.summoning_skill.cur;
stats[84]=your_info.summoning_skill.base;
stats[89]=your_info.crafting_skill.cur;
stats[90]=your_info.crafting_skill.base;
stats[47]=your_info.research_completed;
stats[81]=your_info.researching;
stats[82]=your_info.research_total;

rec_special_message(HERE_YOUR_STATS, (Uint8*)stats, 190);
}

void rec_knowledge_list()
{
int i;
Uint8 list[37];
for(i=0;i<37;i++)
 {
	 list[i]|=knowledge_list[i*8+0].present * 0x01;
	 list[i]|=knowledge_list[i*8+1].present * 0x02;
	 list[i]|=knowledge_list[i*8+2].present * 0x04;
	 list[i]|=knowledge_list[i*8+3].present * 0x08;
	 list[i]|=knowledge_list[i*8+4].present * 0x10;
	 list[i]|=knowledge_list[i*8+5].present * 0x20;
	 list[i]|=knowledge_list[i*8+6].present * 0x40;
	 list[i]|=knowledge_list[i*8+7].present * 0x80;
 }
rec_special_message(GET_KNOWLEDGE_LIST, list, 37);
}

/****************************************************************************/

void start_recording(Uint8 *new_file)
{
Uint8 temp[280];
int len;
if(rec_file)
{
 len = sprintf(temp, "Already recording to \"%s.rec\".", record_file);
 if(interface_mode!=interface_opening)
	 put_text_in_buffer(temp,len,0);
 else put_text_in_buffer(temp,len,54);
} else {
 sprintf(record_file, "%s.rec", new_file);
 rec_file = fopen(record_file, "wb");
 if(rec_file)
 {
	 rec_started = cur_time;
	 len = sprintf(temp, "Started recording to \"%s.rec\".", new_file);

	 //initiative recording
	 rec_sigils_we_have();
	 rec_other_data();
	 rec_bags_list();
	 rec_your_inventory();
	 rec_your_stats();
	 rec_knowledge_list();
	 update_all_actors();
 }
 else len = sprintf(temp, "Failed to start recording to \"%s.rec\".", new_file);
 if(interface_mode!=interface_opening)
   put_text_in_buffer(temp,len,0);
 else put_text_in_buffer(temp,len,54);
}
}

void end_recording()
{
Uint8 temp[280];
int len;
if(rec_file)
{
 len = sprintf(temp, "Done recording to \"%s\", file saved.", record_file);
 if(interface_mode!=interface_opening)
	 put_text_in_buffer(temp,len,0);
 else put_text_in_buffer(temp,len,54);
 fclose(rec_file);
 rec_file = NULL;
} else {
 len = sprintf(temp, "Not recording right now.");
 if(interface_mode!=interface_opening)
	 put_text_in_buffer(temp,len,0);
 else put_text_in_buffer(temp,len,54);
}
}

void record_msg(const Uint8 *in_data, Uint32 data_lenght)
{
Uint8 temp[4];
*(Uint32*)(temp) = cur_time - rec_started;
fwrite (temp, 4, 1, rec_file);
	 fwrite (in_data, data_lenght, 1, rec_file);
//	fprintf(rec_txt, "%u - %u : ", in_data[0], *(short*)(in_data+1)-1);
//	fwrite (&in_data[3], data_lenght-3, 1, rec_txt);
//	fprintf(rec_txt, "\n");
	 fflush (rec_file);
//	fflush (rec_txt);
}

void que_next_msg()
{
Uint32 temp, numread;
int lenght;

numread = fread(&temp, 4, 1, rec_file); //get file time of the message
if(numread != 1){end_replaying(); return;} //if got eof, end recording and exit the function
rec_last_msg_delay = temp - rec_last_msg_file_time;
rec_last_msg_file_time = temp;

numread = fread (rec_last_message, 1, 3, rec_file); //get protocol and lenght
if(numread != 3){end_replaying(); return;} //if got eof, end recording and exit the function
lenght = *((Uint16 *)(rec_last_message+1)) - 1;
if(lenght > 0)
{
 numread = fread (&rec_last_message[3], 1, lenght, rec_file); //get the rest of message
 if(numread != lenght){end_replaying(); return;} //if got eof, end recording and exit the function
}
}

void start_replaying(Uint8 *new_file)
{
Uint8 temp[280];
int len;
if(rec_file)
{
 len = sprintf(temp, "Already replaying (\"%s\").", record_file);
 if(interface_mode!=interface_opening)
	 put_text_in_buffer(temp,len,0);
 else put_text_in_buffer(temp,len,54);
} else {
 sprintf(record_file, "%s.rec", new_file);
 rec_file = fopen(record_file, "rb");
 if(rec_file)
 {
	 que_next_msg();
	 replaying = 1;
	 disconnected=2;
	 len = sprintf(temp, "Started replaying \"%s.rec\".", new_file);
 }
 else len = sprintf(temp, "Failed to start replaying \"%s.rec\".", new_file);
 if(interface_mode!=interface_opening)
   put_text_in_buffer(temp,len,0);
 else put_text_in_buffer(temp,len,54);
}
}

void end_replaying()
{
Uint8 temp[280];
int len;
if(rec_file)
{
 len = sprintf(temp, "\"%s\" replaying stopped.", record_file);
 if(interface_mode!=interface_opening)
	 put_text_in_buffer(temp,len,0);
 else put_text_in_buffer(temp,len,54);
 fclose(rec_file);
 rec_file = NULL;
 replaying = 0;
} else {
 len = sprintf(temp, "Not replaying right now.");
 if(interface_mode!=interface_opening)
	 put_text_in_buffer(temp,len,0);
 else put_text_in_buffer(temp,len,54);
}
}

void replay_qued_msg()
{
Uint32 time_change;
if(!rec_file) return;
time_change = cur_time - rec_last_msg_time;
if(rec_speed && (time_change>=rec_last_msg_delay/rec_speed))
{
 process_message_from_server(rec_last_message, *((Uint16*)(rec_last_message+1))+2);
 que_next_msg();
 rec_last_msg_time = cur_time;
}
}

record.h

#ifndef __RECORD_H__
#define __RECORD_H__

extern Uint8 record_file[256];
extern FILE *rec_file;
extern int replaying;
extern float rec_speed;

void record_msg(const Uint8 *in_data, Uint32 data_lenght);
void start_recording(Uint8 *new_file);
void end_recording();
void start_replaying(Uint8 *new_file);
void end_replaying();
void replay_qued_msg();

#endif

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×