This repository has been archived by the owner on Dec 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added folder with Watcom C++ DLL project workspaces, to move some l…
…ogic from DIV code to external C DLLs: - Added base files to compile DLLs with Watcom C++ 10.6: - DIV.H. - DIV_DLL.LNK. - MAKE.BAT files, each per project, with specific setup, and main in root folder to launch compilations. - Added MATH.DLL project (sources and compiled DLL), ready to use. - Added INPUT.DLL project (sources and compiled DLL), ready to use. - Added test DLL sources and compiled DLL. - Added test PRG to test DLLs in DIV. - STRFIGHT.PRG: Fixed typos in comment header.
- Loading branch information
José Miguel Sánchez Fernández
committed
May 24, 2020
1 parent
56430c4
commit a12668d
Showing
20 changed files
with
1,822 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* ---------------------------------------------------------------------------- | ||
* Common code for all DIV DLLs. | ||
* (C) VisualStudioEX3, José Miguel Sánchez Fernández - 2020 | ||
* DIV Games Studio 2 (C) Hammer Technologies - 1998, 1999 | ||
* ---------------------------------------------------------------------------- */ | ||
|
||
#include "common.h" | ||
|
||
char* strCase(const char* input, const int mode) | ||
{ | ||
int len = strlen(input); | ||
char* output = strAlloc(len); | ||
|
||
for(int i = 0; i < len; i++) | ||
{ | ||
output[i] = mode ? | ||
tolower(input[i]) : | ||
toupper(input[i]); | ||
} | ||
output[len] = '\0'; | ||
|
||
return output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* ---------------------------------------------------------------------------- | ||
* Common code for all DIV DLLs. | ||
* (C) VisualStudioEX3, José Miguel Sánchez Fernández - 2020 | ||
* DIV Games Studio 2 (C) Hammer Technologies - 1998, 1999 | ||
* ---------------------------------------------------------------------------- */ | ||
|
||
#ifndef __COMMON_H_ | ||
#define __COMMON_H_ | ||
|
||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <ctype.h> | ||
|
||
#define GLOBALS | ||
#include "div.h" | ||
|
||
#define TRUE 1 | ||
#define FALSE 0 | ||
|
||
#define RESULT_OK -1 | ||
#define RESULT_ERROR -2 | ||
|
||
// Math function macros: | ||
#define _min(a, b) a < b ? a : b | ||
#define _max(a, b) a > b ? a : b | ||
#define _clamp(x, a, b) x < a ? a : (x > b ? b : x) | ||
#define _isClamped(x, a, b) x >= a && x <= b | ||
|
||
// Gets the string parameter from DIV call: | ||
#define getStringParm(offset) (char*)&mem[text_offset + offset] | ||
// Allocate string pointer in div memory: | ||
#define strAlloc(len) (char*)div_malloc(len + 1) | ||
// Convert string to upper case: | ||
#define strUpr(s) strCase(s, 0) | ||
// Convert string to lower case: | ||
#define strLwr(s) strCase(s, 1) | ||
|
||
// String functions: | ||
char* strCase(const char* input, const int mode); | ||
|
||
#endif |
Oops, something went wrong.