- p = COM_Parse (p);
- if (!p)
- break;
- strcpy (e->flagnames[i], Get_COM_Token());
- }
-
- // find the length until close comment
- for (t=text ; t[0] && !(t[0]=='*' && t[1]=='/') ; t++)
- ;
-
- // copy the comment block out
- len = t-text;
- e->comments = (char*)malloc (len+1);
- memcpy (e->comments, text, len);
-#ifdef _WIN32
- // the win32 Gtk widgets are expecting text stuff to be in unix format (that is CR only instead of DOS's CR/LF)
- // we convert on the fly by replacing the LF with a ' ' (yeah I'm cheap)
- for (i=0 ; i<len ; i++)
- if (text[i] == '\r')
- e->comments[i] = ' ';
- else
- e->comments[i] = text[i];
-#endif
- e->comments[len] = 0;
-
- setSpecialLoad(e, "model=", e->modelpath);
- setSpecialLoad(e, "skin=", e->skinpath);
- char *pFrame = NULL;
- setSpecialLoad(e, "frame=", pFrame);
- if (pFrame != NULL)
- {
- e->nFrame = atoi(pFrame);
- delete pFrame; //Hydra - Fixed memory leak!
- }
-
- if(!e->skinpath)
- setSpecialLoad(e, "texture=", e->skinpath);
-
- // setup show flags
- e->nShowFlags = 0;
- if (strcmpi(e->name, "light") == 0 || strcmpi(e->name, "dlight") == 0 || strcmpi(e->name, "lightjunior") == 0)
- {
- e->nShowFlags |= ECLASS_LIGHT;
- }
-
- if ( (strnicmp(e->name, "info_player", strlen("info_player")) == 0)
- ||(strnicmp(e->name, "path_corner", strlen("path_corner")) == 0)
- ||(strnicmp(e->name, "team_ctf", strlen("team_ctf")) == 0)
- ||(strnicmp(e->name, "misc_teleporter_dest", strlen("misc_teleporter_dest")) == 0)
- )
- {
- e->nShowFlags |= ECLASS_ANGLE;
- }
- if (strcmpi(e->name, "path") == 0)
- {
- e->nShowFlags |= ECLASS_PATH;
- }
- if (strcmpi(e->name, "misc_model") == 0)
- {
- e->nShowFlags |= ECLASS_MISCMODEL;
- }
-
-
- return e;
+ // copy to the first /n
+ char* p = parms;
+ while ( *text && *text != '\n' )
+ *p++ = *text++;
+ *p = 0;
+ text++;
+ }
+
+ {
+ // any remaining words are parm flags
+ const char* p = parms;
+ for ( std::size_t i = 0 ; i < MAX_FLAGS ; i++ )
+ {
+ p = COM_Parse( p );
+ if ( !p ) {
+ break;
+ }
+ strcpy( e->flagnames[i], Get_COM_Token() );
+ }
+ }
+
+ e->m_comments = text;
+
+ setSpecialLoad( e, "model=", e->m_modelpath );
+ StringOutputStream buffer( string_length( e->m_modelpath.c_str() ) );
+ buffer << PathCleaned( e->m_modelpath.c_str() );
+ e->m_modelpath = buffer.c_str();
+
+ if ( !e->fixedsize ) {
+ EntityClass_insertAttribute( *e, "angle", EntityClassAttribute( "direction", "Direction", "0" ) );
+ }
+ else
+ {
+ EntityClass_insertAttribute( *e, "angle", EntityClassAttribute( "angle", "Yaw Angle", "0" ) );
+ }
+ EntityClass_insertAttribute( *e, "model", EntityClassAttribute( "model", "Model" ) );
+ EntityClass_insertAttribute( *e, "noise", EntityClassAttribute( "sound", "Sound" ) );
+
+ return e;