home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / PASM.LZH / RENDEXEC.CPP < prev    next >
C/C++ Source or Header  |  1996-06-17  |  2KB  |  67 lines

  1. #include <owl\owlpch.h>
  2. #pragma hdrstop
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <dos.h>
  6. #include <cstring.h>
  7. #include <dir.h>
  8. #include "matrix.h"
  9. #include "suflib.h"
  10. #include "parts.h"
  11. #include "profile.h"
  12. #include "files.h"
  13.  
  14. #include "log.h"
  15.  
  16. static char *indfile = "_temp1.ind";
  17. static char *frmfile = "_temp.frm";
  18. static char *cRend   = "rendwin.exe";
  19.  
  20. static char *atrname[5] = {"WH", "BL", "RD", "GR", "MG"};
  21.  
  22. void RendMechanic(Parts *parts, CameraParts *camera, int color)
  23. {
  24.     char str[128];
  25.     FILE *fp;
  26.     sprintf(str, "%s%s", tempdir.c_str(), indfile);
  27.     if ((fp = fopen(str, "w")) == NULL) {
  28.         return;
  29.     }
  30.     sprintf(str, "%s%s", tempdir.c_str(), frmfile);
  31.     parts->FileWrite(camera, str, NULL);
  32.  
  33.     if (color < 0 || color > 4) {
  34.         fprintf(fp, "%s\n", atrfile.c_str());
  35.     } else {
  36.         fprintf(fp, "%s\\GENIE_%s.ATR\n", atrdir.c_str(), atrname[color]);
  37.     }
  38.     fprintf(fp, "%s%s\n", tempdir.c_str(), frmfile);
  39.     for (Parts *p = parts; p != NULL; p = p->next) {
  40.         for (Parts *op = parts; op != p && op != NULL; op = op->next) {
  41.             if (op->object == p->object) {
  42.                 break;
  43.             }
  44.         }
  45.         if (op == p || op == NULL) {
  46.             char *f = p->object->filename;
  47.             if (strncmpi(f, simplepartsdir.c_str(), simplepartsdir.length()) == 0) {
  48.                 fprintf(fp, "%s%s\n", partsdir.c_str(), f+simplepartsdir.length());
  49.             } else if (f[1] == ':' || f[0] == '\\') {
  50.                 fprintf(fp, "%s\n", f);
  51.             } else {
  52.                 fprintf(fp, "%s%s\n", partsdir.c_str(), f);
  53.             }
  54.         }
  55.     }
  56.     if (rendoption == "") {
  57.         fprintf(fp, "-c512x384 -n -g\n");
  58.     } else {
  59.         fprintf(fp, "%s\n", rendoption.c_str());
  60.     }
  61.     fclose(fp);
  62.  
  63.     sprintf(str, "%s%s @%s%s", pathdir.c_str(), cRend, tempdir.c_str(), indfile);
  64.     WinExec(str, SW_SHOW);
  65. }
  66.  
  67.