/** * @brief Parse 2D objects like text and images * @return 1 - increase the command position of the sequence by one * @sa seq2D_vals * @sa CL_SequenceFind2D */ static int SEQ_ExecuteObj2D (sequenceContext_t *context, const char *name, const char *data) { seq2D_t *s2d; const value_t *vp; int i; /* get sequence text */ s2d = SEQ_Find2D(context, name); if (!s2d) { /* create new sequence text */ for (i = 0, s2d = context->obj2Ds; i < context->numObj2Ds; i++, s2d++) if (!s2d->inuse) break; if (i >= context->numObj2Ds) { if (context->numObj2Ds >= MAX_SEQ2DS) Com_Error(ERR_FATAL, "Too many sequence 2d objects"); s2d = &context->obj2Ds[context->numObj2Ds++]; } /* allocate */ OBJZERO(*s2d); for (i = 0; i < 4; i++) s2d->color[i] = 1.0f; s2d->inuse = true; Q_strncpyz(s2d->font, "f_big", sizeof(s2d->font)); /* default font */ Q_strncpyz(s2d->name, name, sizeof(s2d->name)); } /* get values */ while (*data) { for (vp = seq2D_vals; vp->string; vp++) if (Q_streq(data, vp->string)) { data += strlen(data) + 1; switch (vp->type) { case V_TRANSLATION_STRING: data++; case V_HUNK_STRING: Mem_PoolStrDupTo(data, &Com_GetValue<char*>(s2d, vp), cl_genericPool, 0); break; default: Com_EParseValue(s2d, data, vp->type, vp->ofs, vp->size); break; } break; } if (!vp->string) Com_Printf("SEQ_ExecuteObj2D: unknown token '%s'\n", data); data += strlen(data) + 1; } return 1; }
/** * @brief Removed a sequence entity from the current sequence * @return 1 - increase the command position of the sequence by one * @sa CL_SequenceFind2D * @sa CL_SequenceFindEnt */ static int SEQ_ExecuteDelete (sequenceContext_t* context, const char* name, const char* data) { seqEnt_t* se = SEQ_FindEnt(context, name); if (se) se->inuse = false; seq2D_t* s2d = SEQ_Find2D(context, name); if (s2d) { s2d->inuse = false; Mem_Free(s2d->text); s2d->text = nullptr; } if (!se && !s2d) Com_Printf("SEQ_ExecuteDelete: couldn't find '%s'\n", name); return 1; }