PERSONAL.CPP
资源名称:tc3d.zip [点击查看]
上传用户:abcdshs
上传日期:2007-01-07
资源大小:1858k
文件大小:5k
源码类别:
游戏
开发平台:
Visual C++
- // (C) Copyright 1996 by Anthony J. Carin. All Rights Reserved.
- #include "stdafx.h"
- #include "personal.h"
- #include "stdio.h"
- void personal::load(LPCTSTR file)
- {
- char tmpbuf[300];
- FILE *fp = (FILE *) -1;
- short fperror = FALSE;
- m_file = file;
- if (file)
- {
- if (*file != 0)
- fp = fopen(file,"r");
- else
- fperror = TRUE;
- }
- else
- fperror = TRUE;
- if (fp > 0 && !fperror)
- {
- fscanf(fp, "%s", tmpbuf);
- if (tmpbuf[0] == 'M')
- m_gender = MALE;
- else
- m_gender = FEMALE;
- fscanf(fp, "%s", tmpbuf);
- m_face = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_hia = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_ugh = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_laugh = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_haircolor = atoi(tmpbuf);
- fscanf(fp, "%s", tmpbuf);
- m_skincolor = atoi(tmpbuf);
- fscanf(fp, "%s", tmpbuf);
- m_startlevel = (short)atoi(tmpbuf);
- fscanf(fp, "%s", tmpbuf);
- m_punchlist = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_upperarm = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_lowerarm = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_hand = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_thigh = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_lowerleg = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_foot = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_gluts = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_boob = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_hair = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_body = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_head = tmpbuf;
- fscanf(fp, "%s", tmpbuf);
- m_hight = (float) atof(tmpbuf);
- if (m_hight == 0.0f)
- m_hight = 1.0f;
- tmpbuf[0] = 0;
- fscanf(fp, "%s", tmpbuf);
- if (tmpbuf[0] == 0)
- m_normalpunch = "punch.dat";
- else
- m_normalpunch = tmpbuf;
- fclose(fp);
- }
- else
- {
- m_gender = FEMALE;
- m_punchlist =
- m_upperarm =
- m_lowerarm =
- m_hand =
- m_thigh =
- m_lowerleg =
- m_foot =
- m_gluts =
- m_boob =
- m_hair =
- m_body =
- m_head =
- m_face =
- m_hia =
- m_ugh =
- m_laugh = "";
- m_haircolor =
- m_skincolor = RGB(255,0,0);
- m_startlevel = 0;
- m_hight = 1.0f;
- }
- }
- void personal::saveas(LPCTSTR file)
- {
- FILE *fp;
- fp = fopen(file, "w");
- if (fp > 0)
- {
- if (m_gender == MALE)
- fprintf(fp, "Mn");
- else
- fprintf(fp, "Fn");
- fprintf(fp, "%sn", m_face);
- fprintf(fp, "%sn", m_hia);
- fprintf(fp, "%sn", m_ugh);
- fprintf(fp, "%sn", m_laugh);
- fprintf(fp, "%dn", (int) m_haircolor);
- fprintf(fp, "%dn", (int) m_skincolor);
- fprintf(fp, "%dn", (int) m_startlevel);
- fprintf(fp, "%sn", m_punchlist);
- fprintf(fp, "%sn", m_upperarm);
- fprintf(fp, "%sn", m_lowerarm);
- fprintf(fp, "%sn", m_hand);
- fprintf(fp, "%sn", m_thigh);
- fprintf(fp, "%sn", m_lowerleg);
- fprintf(fp, "%sn", m_foot);
- fprintf(fp, "%sn", m_gluts);
- fprintf(fp, "%sn", m_boob);
- fprintf(fp, "%sn", m_hair);
- fprintf(fp, "%sn", m_body);
- fprintf(fp, "%sn", m_head);
- fprintf(fp, "%5.3fn", m_hight);
- fprintf(fp, "%sn", m_normalpunch);
- fclose(fp);
- }
- }
- personal::personal(personal& p)
- {
- m_file = p.m_file;
- m_gender = p.m_gender;
- m_face = p.m_face;
- m_hia = p.m_hia;
- m_ugh = p.m_ugh;
- m_laugh = p.m_laugh;
- m_haircolor = p.m_haircolor;
- m_skincolor = p.m_skincolor;
- m_startlevel = p.m_startlevel;
- m_punchlist = p.m_punchlist;
- m_upperarm = p.m_upperarm;
- m_lowerarm = p.m_lowerarm;
- m_hand = p.m_hand;
- m_thigh = p.m_thigh;
- m_lowerleg = p.m_lowerleg;
- m_foot = p.m_foot;
- m_gluts = p.m_gluts;
- m_boob = p.m_boob;
- m_hair = p.m_hair;
- m_body = p.m_body;
- m_head = p.m_head;
- }
- void personal::operator =(personal& p)
- {
- m_file = p.m_file;
- m_gender = p.m_gender;
- m_face = p.m_face;
- m_hia = p.m_hia;
- m_ugh = p.m_ugh;
- m_laugh = p.m_laugh;
- m_haircolor = p.m_haircolor;
- m_skincolor = p.m_skincolor;
- m_startlevel = p.m_startlevel;
- m_punchlist = p.m_punchlist;
- m_upperarm = p.m_upperarm;
- m_lowerarm = p.m_lowerarm;
- m_hand = p.m_hand;
- m_thigh = p.m_thigh;
- m_lowerleg = p.m_lowerleg;
- m_foot = p.m_foot;
- m_gluts = p.m_gluts;
- m_boob = p.m_boob;
- m_hair = p.m_hair;
- m_body = p.m_body;
- m_head = p.m_head;
- }